Using "alias const(some_type) some_alias;" produces an alias for some_type instead of being an alias for const(some_type) for user-defined types. The following code demonstrates: ----- struct Foo { } typedef int Bar; alias const( int ) CONST_INT; alias const( int )[] INT_ARRAY; alias const( Bar ) CONST_BAR; alias const( Foo ) CONST_FOO; alias const( Object ) CONST_OBJECT; alias const( Object )[] OBJ_ARRAY; pragma( msg, CONST_INT.stringof ); // prints const int; should be const(int) ? pragma( msg, INT_ARRAY.stringof ); // prints const(int)[]; correct. pragma( msg, CONST_BAR.stringof ); // prints Bar; should be const(Bar) pragma( msg, CONST_FOO.stringof ); // prints Foo; should be const(Foo) pragma( msg, CONST_OBJECT.stringof ); // prints Object; should print const(Object) pragma( msg, OBJ_ARRAY.stringof ); // prints const(Object)[]; correct. /* Copy/pasted compiler output from DMD 2.003: const int const(int)[] Bar Foo Object const(Object)[] */
This was fixed in DMD2.022 or earlier.