This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/66472] -Wshadow gets confused by using statements in template classes


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

Christoph Hertzberg <chtz at informatik dot uni-bremen.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chtz at informatik dot uni-bremen.
                   |                            |de

--- Comment #1 from Christoph Hertzberg <chtz at informatik dot uni-bremen.de> ---
Wouldn't this actually be a valid warning if BaseClass had a constructor taking
a function pointer/member function pointer?

struct BaseClass {
  BaseClass(int) { std::cout << "int\n"; }
  BaseClass(int () ) { std::cout << "int()\n"; }
  BaseClass(int (BaseClass::*)()) {std::cout << "int (BaseClass::*)()\n"; }
  static int size() { return 0;}
  int size2() { return 0; }
};

struct Foo : public BaseClass {
  using BaseClass::size;
  using BaseClass::size2;

  // size shadows BaseClass::size!
  Foo(int size) : BaseClass(size) {}
  Foo() : BaseClass(size) {}      // uses BaseClass::size
  Foo(char) : BaseClass(size2) {} // uses BaseClass::size2
};


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]