llvm-project/clang/test/Sema/warn-default-const-init-crash.c
Aaron Ballman 7a3b5d789d
[C] Fix crash-on-invalid due to infinite recursion (#140925)
There are two related issues being fixed in this patch. Both issues
relate to use of an invalid structure which contains a member that we
error recover such that the field has the same type as the structure. In
both cases, we would hit an infinite loop while analyzing the fields
because the type of the field matches the type of the record.

Fixes #140887
2025-05-22 06:47:34 -04:00

12 lines
401 B
C

// RUN: %clang_cc1 -fsyntax-only -verify %s
// This invalid code was causing a stack overflow, check that we issue
// reasonable diagnostics and not crash.
struct GH140887 { // expected-note {{definition of 'struct GH140887' is not complete until the closing '}'}}
struct GH140887 s; // expected-error {{field has incomplete type 'struct GH140887'}}
};
void gh140887() {
struct GH140887 s;
}