xref: /llvm-project/clang/test/CXX/basic/basic.start/basic.start.init/p2.cpp (revision f55ce36c029dd68577743179884ed43d76697937)
1*f55ce36cSDavid L. Jones // RUN: %clang_cc1 -verify %s -pedantic-errors -std=c++11
2*f55ce36cSDavid L. Jones // RUN: %clang_cc1 -verify %s -pedantic-errors -std=c++14
3*f55ce36cSDavid L. Jones // expected-no-diagnostics
4*f55ce36cSDavid L. Jones 
5*f55ce36cSDavid L. Jones struct foo_t {
6*f55ce36cSDavid L. Jones   union {
7*f55ce36cSDavid L. Jones     int i;
8*f55ce36cSDavid L. Jones     volatile int j;
9*f55ce36cSDavid L. Jones   } u;
10*f55ce36cSDavid L. Jones };
11*f55ce36cSDavid L. Jones 
12*f55ce36cSDavid L. Jones __attribute__((__require_constant_initialization__))
13*f55ce36cSDavid L. Jones static const foo_t x = {{0}};
14*f55ce36cSDavid L. Jones 
15*f55ce36cSDavid L. Jones union foo_u {
16*f55ce36cSDavid L. Jones   int i;
17*f55ce36cSDavid L. Jones   volatile int j;
18*f55ce36cSDavid L. Jones };
19*f55ce36cSDavid L. Jones 
20*f55ce36cSDavid L. Jones __attribute__((__require_constant_initialization__))
21*f55ce36cSDavid L. Jones static const foo_u y = {0};
22