[LLVMbugs] [Bug 14488] New: Wrong private constructor selected during compilation
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Dec 3 07:33:58 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=14488
Bug #: 14488
Summary: Wrong private constructor selected during compilation
Product: clang
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: release blocker
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: dummymail000 at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
The following code using construction with = sign also has problems (valid
C++98):
#include <iostream>
struct QBasicAtomicInteger
{
QBasicAtomicInteger(int value)
{
std::cout << "This is a constructor from int" << std::endl;
}
private:
QBasicAtomicInteger(const QBasicAtomicInteger &)
{
std::cout << "This is a copy constructor" << std::endl;
}
};
struct QMetaTypeIdQObject
{
static int qt_metatype_id()
{
static QBasicAtomicInteger metatype_id = 0;
return 0;
}
};
int main()
{
QMetaTypeIdQObject::qt_metatype_id();
return 0;
}
error: calling a private constructor of class 'QBasicAtomicInteger'
Using a non-assignment constructor doesn't raise the issue. If the
copy-constructor is turned public, what is executed in the end is the int
constructor anyway.
--
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