Skip to content

[C++20] [Modules] Cannot use concept with class template argument deduction in global module fragment #60486

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

Closed
davidstone opened this issue Feb 2, 2023 · 2 comments
Assignees
Labels
clang:modules C++20 modules and Clang Header Modules test-suite

Comments

@davidstone
Copy link
Contributor

davidstone commented Feb 2, 2023

Given the following valid set of translation units:

module;

template<typename = void>
struct s {
};

template<typename>
concept c = requires { s{}; };

export module a;
module;

template<typename = void>
struct s {
};

template<typename>
concept c = requires { s{}; };

export module b;

import a;

And compiling with

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

Causes Clang to fail with

b.cpp:8:9: error: redefinition of concept 'c' with different template parameters or requirements
concept c = requires { s{}; };
        ^
a.cpp:8:9: note: previous definition is here
concept c = requires { s{}; };
        ^
1 error generated.

The practical effect of this bug is that #include <ranges> fails when used in two modules with libstdc++.

@davidstone
Copy link
Contributor Author

Possibly another symptom of #60486

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

llvmbot commented Feb 2, 2023

@llvm/issue-subscribers-clang-modules

@ChuanqiXu9 ChuanqiXu9 self-assigned this Feb 3, 2023
CarlosAlbertoEnciso pushed a commit to SNSystems/llvm-debuginfo-analyzer that referenced this issue Feb 27, 2023
Close llvm/llvm-project#60486.

When I look back at this problem again, it only appears if we specify it
with `-fmodule-file=<BMI-path>`. And it disappears after we specify it
as `-fmodule-file=<module-name>=<BMI-path>`. Since we want to depreacate
the form `-fmodule-file=<BMI-path>`, we can think the problem goes
away.
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 test-suite
Projects
None yet
Development

No branches or pull requests

4 participants