Here's something that doesn't seem to be very simple or possible in D - "function" macros which can be used at the global scope, unlike regular functions which can't be.
 
Take the following macros in COM and directx:
 
#define MAKE_HRESULT(sev,fac,code) \
    ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
#define _FACD3D  0x876
#define MAKE_D3DHRESULT( code )  MAKE_HRESULT( 1, _FACD3D, code )
#define D3DERR_WRONGTEXTUREFORMAT               MAKE_D3DHRESULT(2072)
 
This defines a constant, D3DERR_WRONGTEXTUREFORMAT with some complicated value that you'd normally not be able to come up with without help from the macros.
 
Converting to D, however, leaves you with:
 
HRESULT MAKE_HRESULT(int sev, int fac, int code) { return (sev << 31) | (fac << 16) | code; }
HRESULT MAKE_D3DHRESULT(int code) { return MAKE_HRESULT(1, _FACD3D, code);
const HRESULT D3DERR_WRONGTEXTUREFORMAT=MAKE_D3DHRESULT(2072);
 
Which, at global scope, of course gives you an error about it not being a constant expression.  You can't call functions at global scope.
 
I've tried doing this with a mixin, but it doesn't seem possible to define a variable with a mixed-in name within a mixin.
 
Of course, it would be possible to run the original C++ file through the preprocessor to get the big ugly error codes, but this still doesn't solve the overall problem.