Thread overview
[Issue 3138] New: Const bug
Jul 06, 2009
Don
Sep 22, 2009
Don
Dec 29, 2009
Stewart Gordon
July 06, 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@puremagic.com
        ReportedBy: bugzilla@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: -------
July 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3138


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au




--- Comment #1 from Don <clugdbug@yahoo.com.au>  2009-07-06 00:46:47 PDT ---
I cannot reproduce this. Works for me DMD2.031 Windows. (crashes at runtime
with a range error).
What compiler version are you using?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 22, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3138


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-09-22 06:04:13 PDT ---
This was crashing in 2.026, but fixed by 2.030.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 29, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3138


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|accepts-invalid             |ice-on-invalid-code
                 CC|                            |smjg@iname.com


--- Comment #3 from Stewart Gordon <smjg@iname.com> 2009-12-29 13:44:03 PST ---
It may've been fixed now, but still, how is this accepts-invalid?

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