C++ Logo


Advanced search

A contradiction in the description of the enclosed namespace

From: Vladimir Grigoriev <vlad.moscow_at_[hidden]>
Date: Fri, 25 Oct 2019 14:33:55 +0300
It seems there is a contradiction in the C++ 20 Standard relative to the enclosing namespace.

According to the section 9.7.1 Namespace definition of the C++ 20 Standard a namespace definition is a declaration

3 Because a namespace-definition contains declarations in its namespace-body and a namespace-definition is itself a declaration , it follows that namespace-definitions can be nested.


4 The enclosing namespaces of a declaration are those namespaces in which the declaration lexically appears , except for a redeclaration of a namespace member outside its original namespace (e.g., a definition as specified in

And now

8. ... The enclosing namespace set of O is the set of namespaces consisting of the innermost non-inline namespace enclosing an inline namespace O, together with any intervening inline namespaces.

A question arises whether an inline namespace is a declaration?:) Because its enclosing namespace is not the same as the enclosing namespace of a declaration.

I think that the last quote should have some additional clarification words.

With best regards
(Vlad from Moscow)

You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com

Received on 2019-10-25 06:36:12