[basic.scope.scope] Remove incorrect namespace redeclaration example CWG3214 - #9241
[basic.scope.scope] Remove incorrect namespace redeclaration example CWG3214#9241yehudamber wants to merge 1 commit into
Conversation
Since the adoption of P2996 "Reflection for C++26", and the changes it made to [namespace.alias], namespace aliases are no longer alternative names for namespaces but entities of their own kind. Therefore, redeclaring a namespace as a namespace alias, even denoting the original namespace, violates [basic.link]/11.3, since one declaration declares the entity as a namespace and the other does not.
|
Ah, [basic.link]/8 says that two declarations declare the same entity if they correspond (and various other things not relevant here), which they do since they introduce the same name. But that reasoning would seem to apply equally to |
Good point. I thought [basic.scope.scope]/4.2 covers such cases, but I see now it does not apply when the other declaration declares a type alias. |
|
I agree [basic.link]/8 is problematic. Maybe something like this?
? |
|
@katzdm We already have "D1 and D2 both declare type aliases or namespace aliases that have the same underlying entity, or" in the next bullet, so something feels redundant here. Also, I get confused whether type aliases are meant to have namespaces as underlying entities with this phrasing. Maybe make that two bullets? Also, I'm not seeing how this fixes the problem that should NOT declare the same entity twice. |
|
"either D1 and D2 both declare type aliases or neither declares a type alias" and the same for namespace aliases? |
|
@jensmaurer It's two different cases - I'm fine with two different bullets, but we should keep the existing bullet separate. So, this for instance would be fine (and equivalent) to me:
Something along the lines of what @timsong-cpp said would be fine as well. No strong preference on the phrasing. |
|
This is not an editorial issue, and removing the example does not fix anything. CWG3214 |
|
@jensmaurer Seems good, thank you! |
Since the adoption of P2996 "Reflection for C++26", and the changes it made to [namespace.alias], namespace aliases are no longer alternative names for namespaces but entities of their own kind. Therefore, redeclaring a namespace as a namespace alias, even denoting the original namespace, violates [basic.link]/11.3, since one declaration declares the entity as a namespace and the other does not.