================
@@ -470,3 +470,20 @@ struct S2 {
 const struct S2 s2[2] = {{{"foo"}, 1}, [0].L[2] = 'x'}; // expected-warning 
{{initializer partially overrides prior initialization of this subobject}} \
                                                         // expected-note 
{{previous initialization is here}}
 static_assert(s2[0].L[2] == 'x');// expected-warning {{folding it to a 
constant is a GNU extension}}
+
+// gh121694
+const int a = 0;
+struct C { const int *p; };
+constexpr struct C c1 = {&a}; // expected-error{{constexpr pointer initializer 
is not null}}
----------------
aalmkainzi wrote:

btw clang also accepts that godbolt code. The difference is that if we want:
```C
nullptr_t woo;
constexpr struct C c1 = { woo };
```
to work, i think that means `nullptr_t` is always a constexpr, no matter what. 
and the snippet should work in global scope.

https://github.com/llvm/llvm-project/pull/228776
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to