We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 951b13d commit 335e00fCopy full SHA for 335e00f
clang/test/AST/Interp/unions.cpp
@@ -30,3 +30,16 @@ constexpr A ab = {.d = 1.0};
30
static_assert(ab.d == 1.0, "");
31
static_assert(ab.a == 1, ""); // both-error {{not an integral constant expression}} \
32
// both-note {{read of member 'a' of union with active member 'd'}}
33
+
34
+namespace SimpleStore {
35
+ union A {
36
+ int a;
37
+ int b;
38
+ };
39
+ constexpr int foo() {
40
+ A a{.b = 4};
41
+ a.b = 10;
42
+ return a.b;
43
+ }
44
+ static_assert(foo() == 10, "");
45
+}
0 commit comments