aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/c2y-invalid-constexpr.c
blob: 166827d0a7184ee65f69236bbf36252c50213f46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// RUN: %clang_cc1 -fsyntax-only -verify -std=c23 %s

// This was previously causing a stack overflow when checking the valid
// declaration of an invalid type. Ensure we issue reasonable diagnostics
// instead of crashing.
struct GH140887 { // expected-note {{definition of 'struct GH140887' is not complete until the closing '}'}}
  GH140887();     // expected-error {{must use 'struct' tag to refer to type 'GH140887'}} \
                     expected-error {{expected member name or ';' after declaration specifiers}} \
                     expected-error {{field has incomplete type 'struct GH140887'}}
};
constexpr struct GH140887 a; // expected-error {{constexpr variable 'a' must be initialized by a constant expression}}