Skip to content
Snippets Groups Projects
Commit 7b0f6920 authored by Richard Smith's avatar Richard Smith
Browse files

Diagnose an attempt to give a deduction-guide a function body.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294397 91177308-0d34-0410-b5e6-96231b3b80d8
parent 50aef85f
No related branches found
No related tags found
No related merge requests found
......@@ -1972,6 +1972,8 @@ def err_deduction_guide_name_not_class_template : Error<
"cannot specify deduction guide for "
"%select{<error>|function template|variable template|alias template|"
"template template parameter|dependent template name}0 %1">;
def err_deduction_guide_defines_function : Error<
"deduction guide cannot have a function definition">;
// C++1y deduced return types
def err_auto_fn_deduction_failure : Error<
......
......@@ -8129,6 +8129,9 @@ void Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
 
// FIXME: Check that the return type can instantiate to a specialization of
// the template specified as the deduction-guide's name.
if (D.isFunctionDefinition())
Diag(D.getIdentifierLoc(), diag::err_deduction_guide_defines_function);
}
 
//===----------------------------------------------------------------------===//
......
......@@ -77,11 +77,11 @@ const volatile static constexpr inline A(int(&)[29]) -> A<int>; // expected-erro
A(int(&)[30]) const -> A<int>; // expected-error {{deduction guide cannot have 'const' qualifier}}
// FIXME: No definition is allowed.
A(int(&)[40]) -> A<int> {}
A(int(&)[41]) -> A<int> = default; // expected-error {{only special member functions may be defaulted}}
A(int(&)[42]) -> A<int> = delete;
A(int(&)[43]) -> A<int> try {} catch (...) {}
// No definition is allowed.
A(int(&)[40]) -> A<int> {} // expected-error {{deduction guide cannot have a function definition}}
A(int(&)[41]) -> A<int> = default; // expected-error {{deduction guide cannot have a function definition}} expected-error {{only special member functions may be defaulted}}
A(int(&)[42]) -> A<int> = delete; // expected-error {{deduction guide cannot have a function definition}}
A(int(&)[43]) -> A<int> try {} catch (...) {} // expected-error {{deduction guide cannot have a function definition}}
#ifdef CLASS
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment