1 | union Foo { |
---|---|
2 | int val = 42; |
3 | static const int sVal1 = -42; |
4 | static Foo sVal2; |
5 | }; |
6 | |
7 | Foo Foo::sVal2{}; |
8 | |
9 | namespace { |
10 | union Bar { |
11 | int val = 137; |
12 | static const int sVal1 = -137; |
13 | static Bar sVal2; |
14 | }; |
15 | |
16 | Bar Bar::sVal2{}; |
17 | } // namespace |
18 | |
19 | int main() { |
20 | Foo foo; |
21 | Bar bar; |
22 | auto sum = Bar::sVal1 + Foo::sVal1 + Foo::sVal2.val + Bar::sVal2.val; |
23 | |
24 | return 0; |
25 | } |
26 |