December 10, 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@gdcproject.org
          Reporter: belka@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.