https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102350
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- That would be an aliasing violation. The artificial vars created by __builtin_source_location have the std::source_location::__impl type, so accessing those using some other dynamic type is invalid.