[Bug 281] New: NRVO tests behave different than in DMD

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Sun Dec 10 14:13:06 UTC 2017


https://bugzilla.gdcproject.org/show_bug.cgi?id=281

            Bug ID: 281
           Summary: NRVO tests behave different than in DMD
           Product: GDC
           Version: development
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw at gdcproject.org
          Reporter: belka at caraus.de

extern (C) int printf(const(char*) fmt, ...);
/**********************************/
// 13089

struct S13089
{
    @disable this(this);    // non nothrow
}

void* p13089;

S13089[1000] foo13089() nothrow
{
    typeof(return) data;
    p13089 = &data;
    return data;
}

void main()
{
    immutable data = foo13089();
    assert(p13089 == &data);
}

The assertion holds in DMD but fails in GCC. The question is whether it is
something should be changed.

References:
http://forum.dlang.org/post/gverkczeotvadwmdowdl@forum.dlang.org
https://dlang.org/glossary.html#nrvo
https://github.com/D-Programming-GDC/GDC/pull/573

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the D.gnu mailing list