http://llvm.org/bugs/show_bug.cgi?id=12131
Bug #: 12131
Summary: Templated constructor not instanciated when copy
constructor implicitly deleted
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++0x
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Copying a shared_ptr from libstdc++ causes compilation error in clang++ trunk.
I reproduced the problem with a minimal code here:
// begin code
template<class T> struct C {
T x;
C() = default;
C(const C<T>&& obj): x(obj.x) {}
template<class U> C(const C<U>& obj): x(obj.x) {}
};
int main() {
C<int> x;
C<int> y(x);
return 0;
}
// end code
This compiles ok on gcc and as is correct as far as I can tell, clang++
-std=c++0x gives the following diagnostic:
error: call to implicitly-deleted copy constructor of 'C<int>
-- Some thoughts:
The default copy constructor is not generated because of the declared move
constructor, but the templated const reference constructor should match. Clang
dosn't instanciate C<T>::C<T>.
I'm not familiar with clang's codebase, but maybe what happens is that
internally the copy constructor is declared and marked deleted, as opposed to
simply not present - thus preventing the template from being considered?
--
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