Skip to content

Commit 278c1e2

Browse files
committed
Fix function call in constinit section.
1 parent 65d08b8 commit 278c1e2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CPP20.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,10 @@ char8_t utf8_str[] = u8"\u0123";
490490
The `constinit` specifier requires that a variable must be initialized at compile-time.
491491
```c++
492492
const 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\_\_

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,10 @@ char8_t utf8_str[] = u8"\u0123";
594594
The `constinit` specifier requires that a variable must be initialized at compile-time.
595595
```c++
596596
const 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\_\_

0 commit comments

Comments
 (0)