Reputation: 43035
Consider the template function g()
and free function f()
:
#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();
}
Compiled with GCC-trunk get following output:
43
44
Why g()
and f()
yield different results? I expect the results are the same. Why a unit offset disappeared during the instantiation of the template?
Upvotes: 6
Views: 323