[Issue 1946] New: Compiler crashes on attempt to implicit cast const typedef to non-const.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 26 04:33:40 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1946

           Summary: Compiler crashes on attempt to implicit cast const
                    typedef to non-const.
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: sardonicpresence at gmail.com


If an attempt is made to implicitly cast a const instance of a typedef of a
class to a non-const instance, DMD 2.012 crashes.

The following code causes the compiler to crash:

  class Foo {}
  typedef Foo Test;

  void f(Test test) {}

  void main()
  {
    const Test test;
    f(test);
  }

If "typedef" is replaced with "alias" this does not occur. If "f(Test test)" is
declared as "f(in Test test)" this does not occur. If Test is typedef'd to a
value-type this does not occur (including structs).


-- 



More information about the Digitalmars-d-bugs mailing list