[Bug c++/93821] Define __cplusplus to 202002L in C++20

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 19 10:06:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93821

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Romain Geissler from comment #0)
> A few hours ago the clang folks did add explicit support for the flag
> -std=c++20, and not only did they change that, they also changed the value
> of __cplusplus to 202002L. I think in gcc this __cplusplus value shall be
> updated too.

The fact GCC didn't update the macro yet doesn't seem like a bug to me.


> Right now on Compiler Explorer you need to use this assertions so that there
> is no error on clang/gcc trunk:
> 
> #ifndef __clang__
> static_assert(__cplusplus == 201709L);
> #else
> static_assert(__cplusplus == 202002L);
> #endif

I don't understand this claim, why do you "need to use" that?

Why can't you test for > C++17 i.e. #if __cplusplus > 201703L ?


More information about the Gcc-bugs mailing list