This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


920. Interaction of inline namespaces and using-declarations

Section: 9.3.4  [dcl.meaning]     Status: CD2     Submitter: Michael Wong     Date: 19 June, 2009

[Voted into WP at March, 2010 meeting as part of document N3079.]

According to 9.3.4 [dcl.meaning] paragraph 1,

When the declarator-id is qualified, the declaration shall refer to a previously declared member of the class or namespace to which the qualifier refers (or of an inline namespace within that scope (9.8.2 [namespace.def])), and the member shall not have been introduced by a using-declaration in the scope of the class or namespace nominated by the nested-name-specifier of the declarator-id.

This would appear to make the following example ill-formed, even though it would be well-formed if the using-declaration were omitted:

    namespace A {
      inline namespace B {
        template <class T> void foo() { }
     }
     using B::foo;
    }
    template void A::foo<int>();

This seems strange.

Proposed resolution (July, 2009):

Change 9.3.4 [dcl.meaning] paragraph 1 as follows:

...When the declarator-id is qualified, the declaration shall refer to a previously declared member of the class or namespace to which the qualifier refers (or, in the case of a namespace, of an element of the inline namespace within that scope set of that namespace (9.8.2 [namespace.def])), and; the member shall not merely have been introduced by a using-declaration in the scope of the class or namespace nominated by the nested-name-specifier of the declarator-id. [Note:...

(Note: this resolution depends on the resolution of issue 861.)