[Bug c++/104512] [c++20] consteval constructor does not need to initialize all data members
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 19 00:33:48 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104512
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://github.com/llvm/llv
| |m-project/issues/57627,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=106485
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
struct B {
bool b = true;
int i;
consteval B() {}
};
static_assert( []() consteval{ return B{}.b; }() );
```
Works for GCC. I think this is a bug in clang ...
static_assert is an immediate function context so B{} needs to be a evaluated
and such.
See https://github.com/llvm/llvm-project/issues/57627 for the clang bug.
See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106485#c2 .
More information about the Gcc-bugs
mailing list