The new verification code produces an ICE for incorrect code. Add the
same logic as already used in comptypes to to bail out under certain
conditions.
PR c/115696
gcc/c/
* c-typeck.cc (comptypes_verify): Bail out for
identical, empty, and erroneous input types.
gcc/testsuite/
* gcc.dg/pr115696.c: New test.
static bool
comptypes_verify (tree type1, tree type2)
{
+ if (type1 == type2 || !type1 || !type2
+ || TREE_CODE (type1) == ERROR_MARK || TREE_CODE (type2) == ERROR_MARK)
+ return true;
+
if (TYPE_CANONICAL (type1) != TYPE_CANONICAL (type2)
&& !TYPE_STRUCTURAL_EQUALITY_P (type1)
&& !TYPE_STRUCTURAL_EQUALITY_P (type2))
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wno-implicit-int" } */
+
+a(); /* { dg-warning "no type or storage" } */
+a; /* { dg-error "redeclared" } */
+ /* { dg-warning "no type or storage" "" { target *-*-* } .-1 } */
+a(); /* { dg-warning "no type or storage" } */