This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-07
(From submission #698.)
Consider:
namespace N {
inline namespace A {
constexpr int f(int *);
}
inline namespace B {
constexpr int f(long *);
}
} // namespace N
template <typename T> struct Q { using type = long; };
constexpr int N::f(Q<struct X *>::type *) { return 42; } // #1
namespace N {
inline namespace B {
struct X {};
}
} // namespace N
template <> struct Q<N::B::X *>; // explicit specialization after implicit instantiation
static_assert(N::B::f(0) == 42);
According to 6.4.6 [basic.scope.namespace] paragraph 1, the target scope of the declaration #1 is N::B. This is known only after establishing correspondence with the two earlier candidate declarations of f. However, a target scope for the elaborated-type-specifier struct X at #1 must be determined prior to establishing correspondence.
It would be reasonable to use N as the target scope for struct X, i.e. the scope named by the nested-name-specififer.