[Bug c++/102350] __builtin_source_location not available in earlier language modes

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 16 10:41:22 GMT 2021


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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That is not possible, because std::source_location::current() should be
consteval and it can't be in C++ < 20, and without consteval it will behave
significantly differently.  Note, the C++ FE knows
std::source_location::current() and has magic behavior for it, just consteval
semantics is not enough.
And by providing std::source_location without the current method for C++ < 20
there would be no way to initialize it to __builtin_source_location (),
std::source_location::__impl is private...


More information about the Gcc-bugs mailing list