[LLVMbugs] [Bug 9783] New: Differs with GCC for time of destroying temporaries when initializing non-class object.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Apr 22 17:06:13 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9783
Summary: Differs with GCC for time of destroying temporaries
when initializing non-class object.
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: schaub.johannes at googlemail.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
GCC prints "true", while clang prints "false" for this:
struct A {
bool &b;
A(bool &b):b(b) { }
~A() { std::cout << b; }
bool yield() { return true; }
};
bool b = A(b).yield();
int main() { }
I cannot see what the Standard requires for this; it appears to be unspecified
or undefined (because the write to "b" doesn't appear to be part of any
expression/evaluation, it may be interleaved with the read of "b" in ~A).
The IRC channel was discussing this. The SO community engaged in discussing it
too; see http://stackoverflow.com/q/5760866/34509.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list