public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99399] New: why does not a pack expansion that is a using-delcaration which intends to introduce the base classes's constructor accept by GCC
@ 2021-03-05  7:20 xmh970252187 at gmail dot com
  2021-03-05  7:22 ` [Bug c++/99399] " xmh970252187 at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: xmh970252187 at gmail dot com @ 2021-03-05  7:20 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-09  5:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05  7:20 [Bug c++/99399] New: why does not a pack expansion that is a using-delcaration which intends to introduce the base classes's constructor accept by GCC xmh970252187 at gmail dot com
2021-03-05  7:22 ` [Bug c++/99399] " xmh970252187 at gmail dot com
2021-08-12 21:52 ` pinskia at gcc dot gnu.org
2021-12-08 14:12 ` marxin at gcc dot gnu.org
2021-12-08 15:46 ` pinskia at gcc dot gnu.org
2021-12-08 15:47 ` pinskia at gcc dot gnu.org
2021-12-09  5:52 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).