summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 98db0c7b5ae..f273de12583 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4865,6 +4865,12 @@ NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D,
// C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
// applied only to the definition of a function template or variable
// template, declared in namespace scope
+ if (!TemplateParamLists.size()) {
+ Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_decl_non_template);
+ return nullptr;
+ }
+
if (!DC->getRedeclContext()->isFileContext()) {
Diag(D.getIdentifierLoc(),
diag::err_concept_decls_may_only_appear_in_namespace_scope);
OpenPOWER on IntegriCloud