https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99013
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org, | |redi at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This is a side-effect of postponing evaluation of std::source_location::current() until folding when not evaluated in constexpr contexts. While the method is immediate function, the standard enforces requirements that make it impossible to evaluate where other immediate functions are evaluated. So in get_object_name2 it is evaluated during constant expression evaluation during parsing of the template when the template doesn't have any template arguments yet, while in get_object_name1 it is deferred until later and at that point the template is already instantiated. See PR93093 for more details.