Fix scoping in source_location.cpp

This commit is contained in:
Lee Clagett 2021-03-03 23:47:13 -05:00
parent bb22848ac5
commit f49fa78d95

View file

@ -33,10 +33,10 @@ namespace lws
{ {
std::ostream& operator<<(std::ostream& os, const source_location loc) std::ostream& operator<<(std::ostream& os, const source_location loc)
{ {
char const* const just_name = loc.file_name() ?
std::strrchr(loc.file_name(), '/') : nullptr;
if (loc.line()) if (loc.line())
{ {
char const* const just_name = loc.file_name() ?
std::strrchr(loc.file_name(), '/') : nullptr;
os << (just_name ? just_name + 1 : loc.file_name()) << ':' << loc.line(); os << (just_name ? just_name + 1 : loc.file_name()) << ':' << loc.line();
} }
else else