Created on 2021-11-22.00:00:00 last changed 33 months ago
Notes from the December, 2021 teleconference:
The suggested resolution deals specifically with unnamed namespaces, but there are related examples that do not involve unnamed namespaces. The problem needs to be solved more generally in the specification of lookup.
Suggested resolution:
Change 9.8.2.2 [namespace.unnamed] paragraph 1 as follows:
...where inline appears if and only if it appears in the unnamed-namespace-definition and all occurrences of unique in each scope in a translation unit are replaced by the same scope-specific identifier, and this identifier differs from all other identifiers in the translation unit.
According to 9.8.2.2 [namespace.unnamed] paragraph 1,
An unnamed-namespace-definition behaves as if it were replaced by
inlineopt namespace unique { /* empty body */ }
using namespace unique ;
namespace unique { namespace-body }where inline appears if and only if it appears in the unnamed-namespace-definition and all occurrences of unique in a translation unit are replaced by the same identifier, and this identifier differs from all other identifiers in the translation unit.
The use of a single identifier for all occurrences of unique within a translation unit leads to problems when an inline unnamed namespace contains a nested unnamed namespace, e.g.,
inline namespace { namespace { } }
In this case, the unnamed namespace cannot be reopened because the lookup for unique finds both the outer and inner namespaces and is thus ambiguous.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-02-18 07:47:23 | admin | set | messages: + msg6725 |
2022-01-06 00:00:00 | admin | set | messages: + msg6612 |
2022-01-06 00:00:00 | admin | set | status: open -> drafting |
2021-11-22 00:00:00 | admin | create |