-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 concepts
Description
Given the following program:
#include <type_traits>
template <typename T>
concept some_concept = !std::is_same_v<T, int>;
template <some_concept>
struct A1 {};
template <some_concept>
struct A2 {};
template <template <some_concept> typename T>
struct X {
template <template <some_concept> typename T_>
using change_t = X<T_>;
};
int main() {
auto x1 = X<A1>{};
auto x2 = typename decltype(x1)::template change_t<A2>{};
}
it gives the following error:
<source>:19:17: error: template template argument 'A1' is more constrained than template template parameter 'T'
19 | auto x1 = X<A1>{};
| ^~
<source>:12:44: note: 'T' declared here
12 | template <template <some_concept> typename T>
| ^
<source>:7:8: note: 'A1' declared here
7 | struct A1 {};
| ^
It fails when trying to instantiate the template X<A1>
. If we strip away some seemingly unrelated code however, it compiles just fine:
#include <type_traits>
template <typename T>
concept some_concept = !std::is_same_v<T, int>;
template <some_concept>
struct A1 {};
template <template <some_concept> typename T>
struct X {
};
int main() {
auto x1 = X<A1>{};
}
Tested on clang trunk
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 concepts