This is the mail archive of the gcc-help@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]

Re: GCC 4.6.0: cannot explicitly call overloaded base member function in C++0x mode with templates


On Sun, 17 Apr 2011, Harald van Dijk wrote:

I am getting an unexpected compiler error for this code with GCC 4.6.0:

struct A {
 int f();
 int f(int);
};
template <typename> struct B : A
{
};
template <typename T> struct C : B<T>
{
 void g() {
   A::f();
 }
};

It is accepted with the default options, but is rejected with
-std=c++0x:

a.ii: In member function âvoid C<T>::g()â:
a.ii:11:11: error: cannot call member function âint A::f()â without
object

It is accepted in GCC 4.5.2, both in default mode and in C++0x mode. Is
this a bug in GCC, or did C++0x make this invalid?

This looks really close to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47172
but apparently it wasn't fixed at the same time.


You want to open a new PR in bugzilla, which is the best place to report this kind of thing.

--
Marc Glisse


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