Created on 2022-03-29.00:00:00 last changed 45 months ago
Consider:
template <typename Ty>
struct S {
Ty i;
consteval S() = default;
};
template <typename Ty>
struct T {
Ty i;
consteval T() {}
};
S<int> one; // only Clang rejects
T<int> two; // Clang, GCC, ICC, MSVC reject
void locals() {
S<int> three; // only Clang rejects
T<int> four; // Clang, GCC, ICC, MSVC reject
}
A consteval function should always be evaluated at compile time and never fall back to runtime, thus all four cases should be rejected. Issue 2558 is related.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-03-29 00:00:00 | admin | create | |