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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to