[Issue 3138] New: Const bug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 5 22:10:34 PDT 2009


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

           Summary: Const bug
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bugzilla at digitalmars.com


This code crashes the compiler:

class E(uint N) { }

class Boom
{
   typedef E!(5) ET;
public:
   ET foo() const  // Badness here!
   { return x[3]; }

   ET[int] x;
}

void main()
{
   auto b = new Boom();
   b.foo();
}

Technically, it's invalid, because I'm returning a mutable member reference
from a const member function.  However, the error message is to crash the
compiler.  Note that if you replace ET with a builtin or a non-template class,
it correctly emits the expected error.  Not sure why the template type blows it
up, but it does.

Dave

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


More information about the Digitalmars-d-bugs mailing list