www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1319] New: compiler crashes with functions that take const ref struct arguments

reply d-bugmail puremagic.com writes:
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);
}


-- 
Jul 05 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1319






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.


-- 
Jul 26 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1319


kamm-removethis incasoftware.de changed:

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





-------
*** Bug 1374 has been marked as a duplicate of this bug. ***


-- 
Jul 26 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1319


kamm-removethis incasoftware.de changed:

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





-------
*** Bug 1387 has been marked as a duplicate of this bug. ***


-- 
Jul 30 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1319


wbaxter gmail.com changed:

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





*** Bug 1576 has been marked as a duplicate of this bug. ***


-- 
Oct 13 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1319






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.


-- 
Oct 28 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1319


spam extrawurst.org changed:

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





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.


-- 
Nov 29 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1319






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.


-- 
Nov 29 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1319


bugzilla digitalmars.com changed:

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





Fixed dmd 2.010


-- 
Feb 16 2008