Issue 84220
Summary Clang's error on non-pack parameter of alias template in a dependent type
Labels clang
Assignees
Reporter jonathanpoelen
    It seems that clang does not consider `sizeof...(xs)` to be a dependent _expression_ when the call to foo is made with a known number of arguments. The _expression_ must absolutely contain `xs...`.

The following code compiles with gcc, but not clang (https://godbolt.org/z/TYzvjTePT):

```cpp
template<int>
struct foo_impl {
  template<class>
  using f = int;
};

template<class... xs> constexpr int sizeof_pack = sizeof...(xs);

template<class... xs>
using foo = typename foo_impl< // error: pack expansion used as argument for non-pack parameter of alias template
  sizeof...(xs) // does not work
  // sizeof_pack<xs...>  // ok
>::template f<xs...>; // f is dependent on xs

template<class... xs>
using test = list<foo<xs>...>;

// template<class... xs>
// using test = foo<xs...>; // ok with pack...

test<int> a; // ko
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to