Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 281 - NRVO tests behave different than in DMD
Summary: NRVO tests behave different than in DMD
Status: NEW
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: development
Hardware: All All
: --- minor
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2017-12-10 14:13 CET by Eugene Wissner
Modified: 2017-12-10 14:13 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Wissner 2017-12-10 14:13:06 CET
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