https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99399
Bug ID: 99399 Summary: why does not a pack expansion that is a using-delcaration which intends to introduce the base classes's constructor accept by GCC Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: xmh970252187 at gmail dot com Target Milestone: --- template<typename...T> struct A:T...{ using T::T...; }; int main() { } This should have to be well-formed code is rejected by GCC while Clang accepts it. Here is the result (https://godbolt.org/z/a583Po) As per [temp.variadic#5.2] > In a using-declaration; the pattern is a using-declarator. Which means the pattern is `T::T`. As per [temp.variadic#7]: > The pattern of a pack expansion shall name one or more packs that are not > expanded by a nested pack expansion; such packs are called unexpanded packs > in the pattern. All of the packs expanded by a pack expansion shall have the > same number of arguments specified. There are two unexpanded packs in the pattern and they have the same number of arguments. As per [temp.variadic#6] and [temp.variadic#8.1] > For the purpose of determining whether a pack satisfies a rule regarding > entities other than packs, the pack is considered to be the entity that would > result from an instantiation of the pattern in which it appears. > if the pack is a template parameter pack, the element is a template parameter > ([temp.param]) of the corresponding kind (type or non-type) designating the > ith corresponding type or value template argument; That means `T` in the pattern would be considered as a type template parameter designating the corresponding template type argument. Eventually, as per [class.qual#2.2] > In a lookup in which function names are not ignored26 and the > nested-name-specifier nominates a class C: >> in a using-declarator of a using-declaration that is a member-declaration, >> if the name specified after the nested-name-specifier is the same as the >> identifier or the simple-template-id's template-name in the last component >> of the nested-name-specifier Assume the template parameters would be `class T0, class T1,class T2, ... ,class Tn` , the result of instantiating the pattern `T::T` will produce the list `T0::T0,T1::T1,T2::T2,...Tn::Tn`, which will satisfy the above rule. Hence, the result of instantiating `T::T` can be considered to nominate the corresponding constructor of the class named in the nested-name-specifier.