Clang Project

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