Skip to content

Enum value name visibility issue with C++20 modules and GMF #131058

Open
@kamrann

Description

@kamrann

Clang appears to have an issue with visibility of enums included into a module GMF.

// decls.h
enum {
    SomeName,
};
// module.mpp
module;

#include "decls.h"

export module mod;
// consumer.cpp
import mod;

auto a = SomeName;

This compiles without error - I believe incorrectly. Other implementations agree that SomeName is not in scope within consumer.cpp.
Note that Clang agrees with the other implementations under -fmodules-reduced-bmi. Presumably this implies that Clang is making the values visible to name lookup when the enum itself is reachable through the BMI. I couldn't find wording specifically for this case, but it certainly seems wrong intuitively.

See compiler explorer repro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:modulesC++20 modules and Clang Header Modules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions