Issue 162023
Summary error: template template argument ... is more constrained than template template parameter ... when it's actually not
Labels new issue
Assignees
Reporter hannowinter
    Given the following program:
```cpp
#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:
```cpp
#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
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to