From 4e7c24d97dd65083a770252ce942f43d408fe11d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 4 Feb 2021 11:46:45 -0500 Subject: [PATCH] c++: Empty args for variadic concept [PR98717] Nice when fixing a bug is as easy as removing incorrect checks. gcc/cp/ChangeLog: PR c++/98717 * constraint.cc (build_concept_check_arguments): Remove assert. (build_concept_check): Allow empty args. gcc/testsuite/ChangeLog: PR c++/98717 * g++.dg/cpp2a/concepts-variadic3.C: New test. --- gcc/cp/constraint.cc | 8 -------- gcc/testsuite/g++.dg/cpp2a/concepts-variadic3.C | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-variadic3.C diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 9049d087859..31e0fb5079a 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -1345,7 +1345,6 @@ build_concept_check_arguments (tree arg, tree rest) } else { - gcc_assert (rest != NULL_TREE); args = rest; } return args; @@ -1444,13 +1443,6 @@ build_concept_check (tree target, tree args, tsubst_flags_t complain) tree build_concept_check (tree decl, tree arg, tree rest, tsubst_flags_t complain) { - if (arg == NULL_TREE && rest == NULL_TREE) - { - tree id = build_nt (TEMPLATE_ID_EXPR, decl, rest); - error ("invalid use concept %qE", id); - return error_mark_node; - } - tree args = build_concept_check_arguments (arg, rest); if (standard_concept_p (decl)) diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-variadic3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-variadic3.C new file mode 100644 index 00000000000..6fa7113e734 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-variadic3.C @@ -0,0 +1,7 @@ +// PR c++/98717 +// { dg-do compile { target c++20 } } + +template +concept True = true; + +static_assert(True<>); -- 2.30.2