D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1410 - Aliasing const-typed user defined types not working correctly.
Summary: Aliasing const-typed user defined types not working correctly.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks: 1417 2573
  Show dependency treegraph
 
Reported: 2007-08-10 09:28 UTC by Tim Healey
Modified: 2015-06-09 01:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Tim Healey 2007-08-10 09:28:06 UTC
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 Don 2009-09-10 14:16:47 UTC
This was fixed in DMD2.022 or earlier.