diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 3df509bbed01fba942f8aebd05fde6fad052eefc..cd07e48cb5a05bcc9480a272270266f0edb3909f 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -28815,6 +28815,12 @@ finish_concept_definition (cp_expr id, tree init) return error_mark_node; } + if (current_template_depth > 1) + { + error_at (loc, "concept %qE has multiple template parameter lists", *id); + return error_mark_node; + } + /* Initially build the concept declaration; its type is bool. */ tree decl = build_lang_decl_loc (loc, CONCEPT_DECL, *id, boolean_type_node); DECL_CONTEXT (decl) = current_scope (); diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-err4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-err4.C new file mode 100644 index 0000000000000000000000000000000000000000..57a96a095c78a9cebdd139581269c1ba5a1ace10 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-err4.C @@ -0,0 +1,6 @@ +// PR c++/105067 +// { dg-do compile { target c++20 } } + +template<class> +template<class> +concept C = true; // { dg-error "parameter list" }