// RUN: %clang_cc1 -triple=x86_64-unknown-linux -frandomize-layout-seed=1234567890abcded \
// RUN: -verify -fsyntax-only -Werror %s
// NOTE: The current seed (1234567890abcded) is specifically chosen because it
// uncovered a bug in diagnostics. With it the randomization of "t9" places the
// "a" element at the end of the record. When that happens, the clang complains
// about excessive initializers, which is confusing, because there aren't
// excessive initializers. It should instead complain about using a
// non-designated initializer on a raqndomized struct.
// Initializing a randomized structure requires a designated initializer,
// otherwise the element ordering will be off. The only exceptions to this rule
// are:
//
// - A structure with only one element, and
// - A structure initialized with "{0}".
//
// These are well-defined situations where the field ordering doesn't affect
// the result.
typedef void ;
void ;
void ;
void ;
void ;
;
struct test t1 = ; // This should be fine per WG14 N2900 (in C23) + our extension handling of it in earlier modes
struct test t2 = ; // This should also be fine per C99 6.7.8p19
struct test t3 = ; // Okay
struct test t4 = ; // expected-error {{a randomized struct can only be initialized with a designated initializer}}
;
struct other_test t5 = ; // Okay
struct other_test t6 = ; // Okay
struct other_test t7 = ; // Okay
struct other_test t8 = ; // expected-error {{a randomized struct can only be initialized with a designated initializer}}
struct other_test t9 = ; // expected-error {{a randomized struct can only be initialized with a designated initializer}}
;
struct empty_test t10 = ; // Okay
;
struct degen_test t11 = ; // Okay
;
struct static_assert_test t12 = ; // Okay
;
struct enum_decl_test t13 = ; // Okay