http://llvm.org/bugs/show_bug.cgi?id=11309
Bug #: 11309
Summary: move constructor does not suppress copy constructor
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++0x
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
The following code is used in g++'s std::shared_ptr, which currently does not
build with clang (at least in g++ 4.6.2).
The following code compiles in g++, but not in clang++. g++'s reasoning is (I
think):
1) The T(T&&) constructor stops automatic generation of the copy constructor.
2) When looking for a copy constructor, use the templated one.
However, this an area I feel a bit dodgy on, I lost track of how the rules were
changing as the standard was finalised.
Looking at the most recent draft I have access to (n3242), shared_ptr should
have a constructor:
shared_ptr(const shared_ptr& r) noexcept;
which g++ seems to be currently missing, and would clean this problem up.
struct S
{
S(const S&) = delete;
S() {};
};
template<typename X>
struct T : public S
{
template<typename _Tp1>
T(const T<_Tp1>& __r) { }
T(T&&) { }
T() {}
};
int main(void)
{
T<int> i;
T<int> j(i);
}
--
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