-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Open
Labels
c++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyVerified by a second party
Description
Consider the following (https://godbolt.org/z/cj1hMqbof):
struct A {
enum E : int;
};
namespace N {
enum A::E : int { e1 };
}
Clang rejects this with error: cannot define or redeclare 'E' here because namespace 'N' does not enclose namespace 'A'
, but A
is a struct and not a namespace.
Edit: more importantly, it seems that this code is well-formed per https://eel.is/c++draft/enum#dcl.enum-4:
If an enum-head-name contains a nested-name-specifier, the enclosing enum-specifier or opaque-enum-declaration D shall not inhabit a class scope and shall correspond to one or more declarations nominable in the class, class template, or namespace to which the nested-name-specifier refers ([basic.scope.scope]).
All those declarations shall have the same target scope; the target scope of D is that scope.
Metadata
Metadata
Assignees
Labels
c++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyVerified by a second party