Here we're crashing from verify_sequence_points for this requires-expr
condition because it contains a templated CAST_EXPR with empty operand,
and verify_tree doesn't ignore this empty operand only because the
manual tail recursion that it performs for unary expression trees skips
the NULL test.
PR c++/105304
gcc/c-family/ChangeLog:
* c-common.cc (verify_tree) [restart]: Move up to before the
NULL test.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires30.C: New test.
enum tree_code code;
enum tree_code_class cl;
+ restart:
/* X may be NULL if it is the operand of an empty statement expression
({ }). */
if (x == NULL)
return;
- restart:
code = TREE_CODE (x);
cl = TREE_CODE_CLASS (code);
--- /dev/null
+// PR c++/105304
+// { dg-do compile { target c++20 } }
+// { dg-additional-options "-Wall -Wsequence-point" }
+
+struct A { };
+
+int main() {
+ if (requires { A(); })
+ ;
+}