[Bug c++/99672] New: std::source_location yield different column numbers between free function and template functions

hewillk at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 19 15:25:59 GMT 2021


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

            Bug ID: 99672
           Summary: std::source_location yield different column numbers
                    between free function and template functions
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/8T3MGv

====

#include <iostream>
#include <source_location>

auto g(auto...) {
std::cout << std::source_location::current().column() << "\n";
}

auto f() {
std::cout << std::source_location::current().column() << "\n";
}

int main() {
g();
f();
std::cout << std::source_location::current().column() << "\n";
}

====

GCC-trunk output 43, 44, and 44, but the first one should be 44.


More information about the Gcc-bugs mailing list