[Issue 1410] New: Aliasing const-typed user defined types not working correctly.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Aug 10 07:28:07 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1410
Summary: Aliasing const-typed user defined types not working
correctly.
Product: D
Version: 2.003
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: leikeze at gmail.com
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)[]
*/
--
More information about the Digitalmars-d-bugs
mailing list