You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Automerge: [C23] Fix compound literals within function prototype (#132097)
WG14 N2819 clarified that a compound literal within a function prototype
has a lifetime similar to that of a local variable within the function,
not a file scope variable.
// evaluation: I think it's still taking 'x' as being null from the call to
896
+
// f3() rather than tracking the assignment happening in the VLA.
897
+
constexprintf3(int *x, int (*y)[*(x=(int[]){1,2,3})]) { // both-warning {{object backing the pointer x will be destroyed at the end of the full-expression}}
898
+
return x[0]; // both-note {{read of dereferenced null pointer is not allowed in a constant expression}}
899
+
}
900
+
constexprint h = f3(0,0); // both-error {{constexpr variable 'h' must be initialized by a constant expression}} \
0 commit comments