Created on 2023-04-19.00:00:00 last changed 19 months ago
Proposed resolution:
This wording is relative to N4944.
Modify [namespace.std] as indicated:
-?- The restrictions on the use of namespace std apply only to a top-level namespace named std. Namespaces named std nested in program-defined namespaces are not restricted this way or otherwise reserved.
-1- Unless otherwise specified, the behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std.
[ 2023-05-24; Reflector poll ]
Set priority to 4 after reflector poll.
[ 2023-04-24; Ville provides wording ]
[namespace.std] p1 says
Unless otherwise specified, the behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std.
Which std namespace does the rule intend to refer to? Does the text refer to any namespace named std? Consider this case:
namespace A{ namespace std{ // UB or not? void show(){} namespace B{ void fun(){} // UB or not? } } } int main(){ }
A resemble usage like the above example can be seen in a libcudacxx github code, for example.
Suggested resolution: We may want to say the namespace std only refers to the namespace whose declaration inhabits the global scope. [namespace.std] p2, p7 that refers to namespace std have a similar issue.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-05-24 14:33:00 | admin | set | messages: + msg13575 |
2023-04-29 09:02:50 | admin | set | messages: + msg13534 |
2023-04-29 09:02:50 | admin | set | messages: + msg13533 |
2023-04-19 00:00:00 | admin | create |