public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xmh970252187 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [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
Date: Fri, 05 Mar 2021 07:20:13 +0000	[thread overview]
Message-ID: <bug-99399-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-03-05  7:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05  7:20 xmh970252187 at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-99399-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).