clang/test/CXX/dcl.dcl/dcl.spec/dcl.constinit/p3.cpp
raw| 1 | // RUN: %clang_cc1 -std=c++2a -verify %s |
| 2 | |
| 3 | const char *g() { return "dynamic initialization"; } // expected-note {{declared here}} |
| 4 | constexpr const char *f(bool b) { return b ? "constant initialization" : g(); } // expected-note {{non-constexpr function 'g'}} |
| 5 | constinit const char *c = f(true); |
| 6 | constinit const char *d = f(false); // expected-error {{does not have a constant initializer}} expected-note 2{{}} |