that the type we're copying is complete.
Boost.Regex now builds, although it's failing its regression tests
with our favorite "Sema doesn't consider destructor as used."
assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102271
91177308-0d34-0410-b5e6-
96231b3b80d8
"object|copying member subobject|copying array element|allocating object|"
"copying temporary|initializing base subobject|initializing vector element}0 "
"of type %1 invokes deleted constructor">;
-
+def err_temp_copy_incomplete : Error<
+ "copying a temporary object of incomplete type %0">;
+
// C++0x decltype
def err_cannot_determine_declared_type_of_overloaded_function : Error<
"cannot determine the %select{type|declared type}0 of an overloaded "
Loc = CurInitExpr->getLocStart();
break;
}
-
+
+ // Make sure that the type we are copying is complete.
+ if (S.RequireCompleteType(Loc, T, S.PDiag(diag::err_temp_copy_incomplete)))
+ return move(CurInit);
+
// Perform overload resolution using the class's copy constructors.
DeclarationName ConstructorName
= S.Context.DeclarationNames.getCXXConstructorName(
template struct Y<int, float>;
}
+
+namespace TemporaryObjectCopy {
+ // Make sure we instantiate classes when we create a temporary copy.
+ template<typename T>
+ struct X {
+ X(T);
+ };
+
+ template<typename T>
+ void f(T t) {
+ const X<int> &x = X<int>(t);
+ }
+
+ template void f(int);
+}