Issue 134519
Summary [Clang] Spurious error when template template parameter substituted using a class template with an NTTP whose type is its first template parameter
Labels clang
Assignees
Reporter ednolan
    Given the following code:

```cpp
template <typename Foo, template <typename, Foo> typename>
class Bar {};

template <typename Foo, Foo>
class Quux : public Bar<Foo, Quux> {};

static_assert(sizeof(Quux<int, 0>));
```

Clang 20.1.2 and trunk produce the following error:

```
foo.cpp:4:20: error: conflicting deduction 'type-parameter-0-0' against 'int' for parameter
    4 | template <typename Foo, Foo>
      |                    ^
foo.cpp:5:30: note: template template argument has different template parameters than its corresponding template template parameter
    5 | class Quux : public Bar<Foo, Quux> {};
 |                              ^
foo.cpp:1:58: note: previous template template parameter is here
    1 | template <typename Foo, template <typename, Foo> typename>
      | ~~~~~~~~~~~~~~~~~~~~~~~~         ^
foo.cpp:7:15: note: in instantiation of template class 'Quux<int, 0>' requested here
    7 | static_assert(sizeof(Quux<int, 0>));
      |               ^
1 error generated.
```

Compiler explorer link: https://godbolt.org/z/5Mar9h7zE

The code is accepted by Clang 19, GCC, MSVC, and EDG.

Bisecting shows that this started with 28ad8978ee2054298d4198bf10c8cb68730af037.

CC @mizvekov 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to