www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1410] New: Aliasing const-typed user defined types not working correctly.

reply d-bugmail puremagic.com writes:

           Summary: Aliasing const-typed user defined types not working
           Product: D
           Version: 2.003
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: leikeze 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
pragma( msg, OBJ_ARRAY.stringof ); // prints const(Object)[]; correct.

/* Copy/pasted compiler output from DMD 2.003:
const int

Aug 10 2007
parent d-bugmail puremagic.com writes:

Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED

--- Comment #1 from Don <clugdbug yahoo.com.au> 2009-09-10 14:16:47 PDT ---
This was fixed in DMD2.022 or earlier.

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 10 2009