Skip to content

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

Closed
@davidstone

Description

@davidstone

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++.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions