Skip to content

Possibly wrong declaration visibility with C++ module imports #144230

Closed
@rohanlean

Description

@rohanlean

The following is accepted by clang version 20.1.6:

//--- A.cppm
export module A;
export using T = int;

//--- M.cppm
export module M;
import A;

//--- M.cpp
module M;

T x;

This is rejected:

//--- A.cppm
export module A;
export using T = int;

//--- P.cppm
export module M:P;
import A;

//--- M.cppm
export module M;
export import :P;

//--- M.cpp
module M;

T x;

But this is again accepted:

//--- A.cppm
export module A;
export using T = int;

//--- P.cppm
module M:P;
import A;

//--- M.cppm
export module M;
import :P;

//--- M.cpp
module M;

T x;

I think the relevant paragraphs are [basic.lookup.general]//p2,3 and that the correct behaviour is to reject in all cases. Because of [basic.lookup.general]//p2,3 in combination with [module.import]//p7 the correct behaviour is probably to accept in all cases.

Metadata

Metadata

Assignees

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