[LLVMbugs] [Bug 22904] New: constructor elided with "-fno-elide-constructors" option
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Mar 14 04:02:49 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=22904
Bug ID: 22904
Summary: constructor elided with "-fno-elide-constructors"
option
Product: clang
Version: 3.4
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: gabi.francu at yahoo.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Compile with "-fno-elide-constructors" option
#include <iostream>
struct A
{
A() { std::cout << "default constructor" << std::endl; }
A(const A&) { std::cout << "copy constructor" << std:: endl; }
};
A getAnA()
{
A a;
return a;
}
int main()
{
getAnA();
}
The copy constructor is still elided.
Corect behaviour is obtained if the getAnA() is changed to:
A getAnA()
{
return A();
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150314/bb25e378/attachment.html>
More information about the llvm-bugs
mailing list