https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107070
Bug ID: 107070 Summary: GCC thinks !!b is an lvalue (bool b;) Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nir.livne at gmail dot com Target Milestone: --- #include <iostream> // gcc result: 0 1 // clang result: 1 1 // msvc result: 1 1 int main() { bool b = true; // #1 GCC result with 0 while it should be 1 std::cout << std::is_same<decltype(!(!b)), bool>::value << "\n"; auto bb = (!(!b)); std::cout << std::is_same<decltype(bb), bool>::value << "\n"; // #2 this should not compile // !!b = true; }