[clang] Fix enum enumerator visibility loss when #include is between module imports (PR #188865)
Avi Kivity via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 30 02:00:57 PDT 2026
avikivity wrote:
> @avikivity I see an undesired side effect: enum redefinition is no longer diagnosed if the first declaration was in a module.
>
> Consider:
>
> ```c++
> // modA.ccpm
> module;
> enum Enum {
> ENUM
> };
> export module modA;
> ```
>
> ```c++
> // main.cc
> import modA;
> enum Enum {
> ENUM
> };
> enum Enum {
> ENUM
> };
> ```
>
> Before your change, this will (desirably) fail with a `error: redefinition of 'Enum'`. After your change, it will compile.
Clang 22.1.1 (unpatched) also does not reject the redefinition. The patch does not cause a regression, and it is yet another bug.
https://github.com/llvm/llvm-project/pull/188865
More information about the cfe-commits
mailing list