Thread overview
[Issue 1319] New: compiler crashes with functions that take const ref struct arguments
Jul 05, 2007
d-bugmail
Jul 26, 2007
d-bugmail
Jul 26, 2007
d-bugmail
[Issue 1319] compiler crashes with functions that take const ref arguments
Jul 31, 2007
d-bugmail
Oct 13, 2007
d-bugmail
Oct 29, 2007
d-bugmail
Nov 29, 2007
d-bugmail
Nov 29, 2007
d-bugmail
Feb 16, 2008
d-bugmail
July 05, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1319

           Summary: compiler crashes with functions that take const ref
                    struct arguments
           Product: D
           Version: 2.002
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thecybershadow@gmail.com


struct MyStruct
{
        // the presence/absence of fields is irrelevant
}

void test(const ref MyStruct scheme)
{
}

void main()
{
        MyStruct scheme;
        test(scheme);
}


-- 

July 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1319





------- Comment #1 from regan@netmail.co.nz  2007-07-26 07:33 -------
Same bug I think:

void main() { int delegate(const ref int) dg; const int i; dg(i); }

Found it trying to make opApply work with a const class reference.


-- 

July 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1319


kamm-removethis@incasoftware.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kamm-
                   |                            |removethis@incasoftware.de




------- Comment #2 from kamm-removethis@incasoftware.de  2007-07-26 08:17 -------
*** Bug 1374 has been marked as a duplicate of this bug. ***


-- 

July 31, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1319


kamm-removethis@incasoftware.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wstring@gmail.com




------- Comment #3 from kamm-removethis@incasoftware.de  2007-07-31 01:53 -------
*** Bug 1387 has been marked as a duplicate of this bug. ***


-- 

October 13, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1319


wbaxter@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jemandy@earthlink.net




------- Comment #4 from wbaxter@gmail.com  2007-10-13 15:00 -------
*** Bug 1576 has been marked as a duplicate of this bug. ***


-- 

October 29, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1319





------- Comment #5 from ddparnell@bigpond.com  2007-10-29 00:31 -------
I just tripped over this one today too. Here is my minimum test case...

 void Foo(const ref int A) {}
 void main()
 {
    Foo(1);
 }

And using 'invariant' instead of 'const' also crashes the compiler.


-- 

November 29, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1319


spam@extrawurst.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |critical




------- Comment #6 from spam@extrawurst.org  2007-11-29 06:31 -------
i am raising this one, cause it is really critical for me, i use a couple of really huge structs and i pass them by ref to methods but i want to protect them from being mutated which i want to use the const for. this is one big reason i am using the D2.0 branch in the first place. I have a rather big team of coders working on the project, i want to protect certain stuff from getting messed up by someone. please fix this.


-- 

November 29, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1319





------- Comment #7 from wbaxter@gmail.com  2007-11-29 17:30 -------
Agreed.  This is a big deal.  My code has lots of structs being passed around by ref for efficiency that really should be "const ref".  The fact that it's been reported 4 times by different people should also be a big clue.  Here's hoping for a fix in 2.009.  I don't see myself moving over to D2.x until this one is fixed because I've got too much code that should be "const ref" that I'll just have to go back over again when const ref finally works.


-- 

February 16, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1319


bugzilla@digitalmars.com changed:

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




------- Comment #8 from bugzilla@digitalmars.com  2008-02-16 05:59 -------
Fixed dmd 2.010


--