]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Empty args for variadic concept [PR98717]
authorJason Merrill <jason@redhat.com>
Thu, 4 Feb 2021 16:46:45 +0000 (11:46 -0500)
committerJason Merrill <jason@redhat.com>
Fri, 5 Feb 2021 01:02:02 +0000 (20:02 -0500)
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
gcc/testsuite/g++.dg/cpp2a/concepts-variadic3.C [new file with mode: 0644]

index f46013855b9b5ce167ba9b24fc00f9be73883db2..f54c220253fb37dff358099ec2d5aad0aebccb77 100644 (file)
@@ -1275,7 +1275,6 @@ build_concept_check_arguments (tree arg, tree rest)
     }
   else
     {
-      gcc_assert (rest != NULL_TREE);
       args = rest;
     }
   return args;
@@ -1374,13 +1373,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 (file)
index 0000000..6fa7113
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/98717
+// { dg-do compile { target c++20 } }
+
+template<typename... T>
+concept True = true;
+
+static_assert(True<>);