[Clang] Variadic template template parameter of another template template parameter causes spurious error upon instantiation · Issue #130362 · llvm/llvm-project (original) (raw)

Given the following code:

template <template <template <typename...> typename> typename> struct foo {};

template <template typename> struct bar {};

using baz = foo;

Clang 20 produces the following error:

<source>:1:52: error: too few template parameters in template template parameter redeclaration
    1 | template <template <template <typename...> typename> typename>
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
    2 | struct foo {};
      | ~~~~~~~~~~~~~~
    3 | 
    4 | template <template <typename> typename>
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:7:17: note: template template argument is incompatible with its corresponding template template parameter
    7 | using baz = foo<bar>;
      |                 ^
<source>:4:39: note: template parameter is declared here
    4 | template <template <typename> typename>
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
<source>:7:17: note: template template argument is incompatible with its corresponding template template parameter
    7 | using baz = foo<bar>;
      |                 ^
<source>:1:62: note: template parameter is declared here
    1 | template <template <template <typename...> typename> typename>
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Compiler explorer link: https://godbolt.org/z/7q7n459E1

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