https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89856
Oliver Rosten <oliver.rosten at googlemail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |oliver.rosten at googlemail dot co | |m --- Comment #4 from Oliver Rosten <oliver.rosten at googlemail dot com> --- I think I've come across a case where this is symptomatic of a serious problem -see https://github.com/ojrosten/SourceLoc The project comprises three files in the Test directory: Main.cpp Test.cpp Test.hpp Both the cpps depend on the hpp. The latter contains an unused variable inline const std::string foo{}; The presence of this seems to cause: 1. The ld warning related to this bug report; 2. std::source_location::current() to misbehave: building and running causes the path to Main.cpp to be output twice, whereas it should just be printed once, with the path to Test.cpp appearing second. Any of the following cures both of the problems: 1. Removing foo; 2. Removing inline; 3. Replacing const with constexpr In the much more complex project where I first encountered this, I reliably got a segmentation fault. I was able to cure this by removing inline in a handful of places.