diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-03-28 14:15:39 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-03-28 14:15:39 -0400 |
commit | 23e57329c6516a81a8d3eb21b365ca8a0ec0c41b (patch) | |
tree | 46310c753fa863d290445f139c3e536e4594112a | |
parent | ecb4882e362e80a1bf172453ac9b366edbb4e89c (diff) | |
download | gcc-23e57329c6516a81a8d3eb21b365ca8a0ec0c41b.zip gcc-23e57329c6516a81a8d3eb21b365ca8a0ec0c41b.tar.gz gcc-23e57329c6516a81a8d3eb21b365ca8a0ec0c41b.tar.bz2 |
c++: reject concept w/ multiple tparm lists [PR105067]
We weren't rejecting a concept declared with multiple template
parameter lists.
PR c++/105067
gcc/cp/ChangeLog:
* pt.cc (finish_concept_definition): Check that a concept is
declared with exactly one template parameter list.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-err4.C: New test.
-rw-r--r-- | gcc/cp/pt.cc | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/concepts-err4.C | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 3df509b..cd07e48 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 0000000..57a96a0 --- /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" } |