On Wed, Oct 23, 2019 at 1:11 PM Vladimir Grigoriev via Std-Discussion <std-discussion@lists.isocpp.org> wrote:
In the section Section 9.7.1 Namespace definition: if the C++ 20 Standard there is written

2 In a named-namespace-definition, the identifier is the name of the namespace. If the identifier, when looked up (6.4.1), refers to a namespace-name (but not a namespace-alias) that was introduced in the namespace in which the named-namespace-definition appears or that was introduced in a member of the inline namespace set of that namespace, the namespace-definition extends the previously-declared namespace. Otherwise, the identifier is introduced as a namespace-name into the declarative region in which the named-namespace definition appears.


This program is compiled successfully.

#include <iostream>

inline namespace N1
{
inline namespace N2
{
namespace N3
{
void f( int ) { std::cout << "f( int )\n"; }
}
}

namespace N3
{
void f( char ) { std::cout << "f( char )\n"; }
}
}

int main()
{
N3::f( 10 );
N2::N3::f( 'A' );
}

Is it a reasonable intention of the Standard that such a program would be well-formed?

It seems to me that if this had not been intentionally allowed, then the author of this paragraph would not have written "or... in a member of the inline namespace set".

 

With best regards
(Vlad from Moscow)

You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
--
Std-Discussion mailing list
Std-Discussion@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion


--
Brian Bi