Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Modules] structs declared in different modules conflict with each other #61360

Open
davidstone opened this issue Mar 12, 2023 · 2 comments
Open
Labels
clang:modules C++20 modules and Clang Header Modules

Comments

@davidstone
Copy link
Contributor

Given the following two translation units

export module a;

export template<typename>
struct holder {
};

export struct a {
	holder<struct foo> m;
};
export module b;

import a;

struct b {
	holder<struct foo> m;
};

When compiled with

clang++ -std=c++20 -x c++-module --precompile -c a.cpp -o a.pcm
clang++ -std=c++20 -fmodule-file=a=a.pcm --precompile -x c++-module -c b.cpp -o b.pcm

Causes clang to fail with

b.cpp:6:16: error: declaration of 'foo' in module b follows declaration in module a
        holder<struct foo> m;
                      ^
a.cpp:8:16: note: previous declaration is here
        holder<struct foo> m;
                      ^
1 error generated.

I'm not 100% sure of what the standard mandates here.

@EugeneZelenko EugeneZelenko added clang:modules C++20 modules and Clang Header Modules and removed new issue labels Mar 12, 2023
@llvmbot
Copy link
Member

llvmbot commented Mar 12, 2023

@llvm/issue-subscribers-clang-modules

@ChuanqiXu9
Copy link
Member

This is somewhat similar with #61465.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:modules C++20 modules and Clang Header Modules
Projects
None yet
Development

No branches or pull requests

4 participants