在下面的代码中,如果here()
停止存在consteval
(完整的 RT 或constexpr
),则为insideline()
的调用行。但有了它的定义。这种差异从何而来?f()
main()
consteval
f()
#include <experimental/source_location>
#include <iostream>
consteval std::experimental::source_location here(
std::experimental::source_location loc = std::experimental::source_location::current())
{
return loc;
}
void f(const std::experimental::source_location& a = here())
{
std::cout << a.line() << std::endl; // will either print 17, or 10
}
int main()
{
f();
}