Consider the requires expression:
constexpr auto b = requires { []{}; };
GCC pass the following two static_assert:
static_assert(b);
static_assert(!b);
This looks extremely weird. I expect that the value of b should be true. Is this just a GCC Bug?
This isn't Schrödinger's Requirement: b should clearly be either true or false.
The requirement here:
constexpr auto b = requires { []{}; };
is a simple-requirement. We're just checking that if the expression []{} is a valid expression. And... it is! So b should just be true. This is a gcc bug (and doubly so with StoryTeller's example demonstrating that in a slighly different spelling b doesn't even count as a constant expression).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With