With templated classes, is possible to not be able to determine is a member
function is a special member function before the class is instantiated. Only
these special member functions can be defaulted. In some cases, knowing
whether a function is a special member function can't be determined until
instantiation, so an uninstantiated function could possibly be defaulted too.
Add a case to the error diagnostic when the function marked with a default is
not known to be a special member function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282989
91177308-0d34-0410-b5e6-
96231b3b80d8
def err_definition_of_explicitly_defaulted_member : Error<
"definition of explicitly defaulted %select{default constructor|copy "
"constructor|move constructor|copy assignment operator|move assignment "
- "operator|destructor}0">;
+ "operator|destructor|function}0">;
def err_redefinition_extern_inline : Error<
"redefinition of a 'extern inline' function %0 is not supported in "
"%select{C99 mode|C++}1">;
X<true> x1;
X<false> x2; // expected-note {{in instantiation}}
+template <typename Type>
+class E {
+ explicit E(const int &) = default;
+};
+
+template <typename Type>
+E<Type>::E(const int&) {} // expected-error {{definition of explicitly defaulted function}}
+
}