File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -490,10 +490,10 @@ char8_t utf8_str[] = u8"\u0123";
490490The ` constinit ` specifier requires that a variable must be initialized at compile-time.
491491``` c++
492492const char * g () { return "dynamic initialization"; }
493- constexpr const char* f(bool p ) { return p ? "constant initializer" : g() ; }
493+ constexpr const char* f() { return "constant initializer"; }
494494
495- constinit const char* c = f(true); // OK
496- constinit const char* d = g(false); // ERROR: ` g ` is not constexpr, so ` d ` cannot be evaluated at compile-time.
495+ constinit const char* c = f(); // OK
496+ constinit const char* d = g(); // ERROR: ` g ` is not constexpr, so ` d ` cannot be evaluated at compile-time.
497497```
498498
499499### \_\_VA\_OPT\_\_
Original file line number Diff line number Diff line change @@ -594,10 +594,10 @@ char8_t utf8_str[] = u8"\u0123";
594594The `constinit` specifier requires that a variable must be initialized at compile-time.
595595```c++
596596const char* g() { return "dynamic initialization"; }
597- constexpr const char* f(bool p ) { return p ? "constant initializer" : g() ; }
597+ constexpr const char* f() { return "constant initializer"; }
598598
599- constinit const char* c = f(true); // OK
600- constinit const char* d = g(false); // ERROR: `g` is not constexpr, so `d` cannot be evaluated at compile-time.
599+ constinit const char* c = f(); // OK
600+ constinit const char* d = g(); // ERROR: `g` is not constexpr, so `d` cannot be evaluated at compile-time.
601601```
602602
603603### \_\_VA\_OPT\_\_
You can’t perform that action at this time.
0 commit comments