Bug 1410 – Aliasing const-typed user defined types not working correctly.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2007-08-10T09:28:00Z
Last change time
2015-06-09T01:14:14Z
Keywords
wrong-code
Assigned to
nobody
Creator
leikeze
Blocks
2573, 1417

Comments

Comment #0 by leikeze — 2007-08-10T09:28:06Z
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)[] */
Comment #1 by clugdbug — 2009-09-10T14:16:47Z
This was fixed in DMD2.022 or earlier.