This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66472] -Wshadow gets confused by using statements in template classes
- From: "chtz at informatik dot uni-bremen.de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 09 Jun 2015 13:15:53 +0000
- Subject: [Bug c++/66472] -Wshadow gets confused by using statements in template classes
- Auto-submitted: auto-generated
- References: <bug-66472-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66472
--- Comment #6 from Christoph Hertzberg <chtz at informatik dot uni-bremen.de> ---
Ok, good point on shadowing free functions.
Next pathological example: If you have a template specialization of your Base
with a static member variable called `size`, wouldn't the warning make sense?
template <class T>
struct Base {
Base(int y) {std::cout << "y=" <<y <<"\n";}
T size();
};
template<class T>
struct Bar : Base<T> {
using Base<T>::size;
Bar(int size) : Base<T>(size) {}
Bar() : Base<T>(size) {} // only works for T==int
};
// Specialization, probably not visible when Bar is defined:
template<>
struct Base<int> {
Base<int>(int x) {std::cout << "x=" <<x <<"\n";}
const static int size=42;
};