public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/104379] [9/10/11/12 Regression] -Wshadow warning given three times
Date: Fri, 04 Feb 2022 12:07:16 +0000	[thread overview]
Message-ID: <bug-104379-4-y9Cyup45Kx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104379-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104379

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
So you can imagine what happens if you combine constructor clones with
templates! :-D

template<typename T>
struct S
{
  int i;
  S(int i) { (void) i; }
};

S<int> i(1);
S<long> j(1);

wheeeeeeeee!

shad2.C: In constructor ‘S<T>::S(int)’:
shad2.C:5:9: warning: declaration of ‘i’ shadows a member of ‘S<T>’ [-Wshadow]
    5 |   S(int i) { (void) i; }
      |     ~~~~^
shad2.C:4:7: note: shadowed declaration is here
    4 |   int i;
      |       ^
shad2.C: In instantiation of ‘S<T>::S(int) [with T = int]’:
shad2.C:8:11:   required from here
shad2.C:5:9: warning: declaration of ‘i’ shadows a member of ‘S<int>’
[-Wshadow]
    5 |   S(int i) { (void) i; }
      |     ~~~~^
shad2.C:4:7: note: shadowed declaration is here
    4 |   int i;
      |       ^
shad2.C:5:9: warning: declaration of ‘i’ shadows a member of ‘S<int>’
[-Wshadow]
    5 |   S(int i) { (void) i; }
      |     ~~~~^
shad2.C:4:7: note: shadowed declaration is here
    4 |   int i;
      |       ^
shad2.C:5:9: warning: declaration of ‘i’ shadows a member of ‘S<int>’
[-Wshadow]
    5 |   S(int i) { (void) i; }
      |     ~~~~^
shad2.C:4:7: note: shadowed declaration is here
    4 |   int i;
      |       ^
shad2.C: In instantiation of ‘S<T>::S(int) [with T = long int]’:
shad2.C:9:12:   required from here
shad2.C:5:9: warning: declaration of ‘i’ shadows a member of ‘S<long int>’
[-Wshadow]
    5 |   S(int i) { (void) i; }
      |     ~~~~^
shad2.C:4:7: note: shadowed declaration is here
    4 |   int i;
      |       ^
shad2.C:5:9: warning: declaration of ‘i’ shadows a member of ‘S<long int>’
[-Wshadow]
    5 |   S(int i) { (void) i; }
      |     ~~~~^
shad2.C:4:7: note: shadowed declaration is here
    4 |   int i;
      |       ^
shad2.C:5:9: warning: declaration of ‘i’ shadows a member of ‘S<long int>’
[-Wshadow]
    5 |   S(int i) { (void) i; }
      |     ~~~~^
shad2.C:4:7: note: shadowed declaration is here
    4 |   int i;
      |       ^

  parent reply	other threads:[~2022-02-04 12:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04 11:12 [Bug c++/104379] New: [p/10/11/12 " redi at gcc dot gnu.org
2022-02-04 11:13 ` [Bug c++/104379] [9/10/11/12 " redi at gcc dot gnu.org
2022-02-04 11:20 ` redi at gcc dot gnu.org
2022-02-04 11:47 ` rguenth at gcc dot gnu.org
2022-02-04 11:54 ` rguenth at gcc dot gnu.org
2022-02-04 12:06 ` redi at gcc dot gnu.org
2022-02-04 12:07 ` redi at gcc dot gnu.org [this message]
2022-02-04 13:29 ` rguenther at suse dot de
2022-02-04 13:32 ` rguenth at gcc dot gnu.org
2022-02-07 14:07 ` jakub at gcc dot gnu.org
2022-02-08 19:18 ` cvs-commit at gcc dot gnu.org
2022-02-08 19:20 ` [Bug c++/104379] [9/10/11 " jakub at gcc dot gnu.org
2022-02-09  7:18 ` rguenther at suse dot de
2022-05-27  9:47 ` [Bug c++/104379] [10/11 " rguenth at gcc dot gnu.org
2022-06-28 10:47 ` jakub at gcc dot gnu.org
2023-07-07 10:42 ` [Bug c++/104379] [11 " rguenth 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-104379-4-y9Cyup45Kx@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).