[Concepts] Add diagnostic: non template declaration

Summary:
Adding diagnostic for concepts declared as non template (function
or variable)

Reviewers: faisalv, fraggamuffin, rsmith, hubert.reinterpretcast

Subscribers: nwilson, cfe-commits

Differential Revision: http://reviews.llvm.org/D11490

Patch by Nathan Wilson!

llvm-svn: 243690
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 98db0c7..f273de1 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4865,6 +4865,12 @@
     // 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);