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;
      |       ^

Reply via email to