noGlobalUsingEnum
Flags using enum X; (C++20) at global or namespace scope, where it
injects every enumerator of X into the enclosing scope. Inside a function
or class body it is allowed. This is a separate check from
noGlobalUsing so the two can be enabled independently.
using enum Color; // Bad — flagged, at namespace scope.
void run() {
using enum Color; // Good — confined to the function body.
}
It accepts the same enabled_names / disabled_names / path_exceptions
keys as noGlobalUsing, matched against the qualified enum name as
written (e.g. "molsys::HybridZone"); a leading :: is ignored.
Configuration
Key |
Type |
Default |
Description |
|---|---|---|---|
|
list of strings |
|
If non-empty, only |
|
list of strings |
|
|
|
array of tables |
|
Per-name file/directory exemptions; same semantics as in noGlobalUsing. |
[cpp.ast_check_config.noGlobalUsingEnum]
disabled_names = ["molsys::LegacyZone"]
# Allow a specific legacy enum only inside the legacy/ subtree
[[cpp.ast_check_config.noGlobalUsingEnum.path_exceptions]]
names = ["molsys::LegacyZone"]
paths = ["src/legacy/"]
Disabling
[cpp]
ast_check_disabled_ids = ["noGlobalUsingEnum"]