C++ Logo

std-discussion

Advanced search

P1208R1 and the meaning of "call-site" for default non-type template parameters

From: Xavier Roche <xroche_at_[hidden]>
Date: Mon, 17 Jan 2022 17:21:44 +0100
P1208R1 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1208r1.html)
introduced a very neat std::source_location feature (which is not yet
implemented by all compilers/libraries)

A typical use of this new type will be involved:
- in a default function argument with the "call site" filled by default
- in a default struct/class member with the "call site" filled by default

However, when used within a default non-type parameter of a template,
it does not seem that the call site is the site instantiating the
template itself, but the template location.

Is this the expected behavior ? (Sorry if this is a rather silly question)

A very simple example:
https://godbolt.org/z/jW54vx8Ef

Regards,

Received on 2022-01-17 16:21:56