https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118903
Bug ID: 118903
Summary: constexpr variables with co_await expression in its
initialization expression
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hanicka at hanicka dot net
Target Milestone: ---
According
https://eel.is/c++draft/expr.const#10.23 "an await-expression ([expr.await]);"
await expression are not allowed in constant evaluation. GCC accepts it, but
silently not evaluate it.
```c++
auto test() -> super_simple_coroutine {
constexpr auto x = co_await awaitable{};
}
```
This code should be rejected. EDG and Clang rejects it, GCC silently accepts it
but attempt to read value yields error about reading uninitialized value, MSVC
does yeild similar error straight error about reading the error.
I think GCC should reject this.