[Bug c++/66472] -Wshadow gets confused by using statements in template classes
chtz at informatik dot uni-bremen.de
gcc-bugzilla@gcc.gnu.org
Tue Jun 9 13:15:00 GMT 2015
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;
};
More information about the Gcc-bugs
mailing list