[Bug c++/46731] GCC shouts "cannot call member function 'void a::g()' without object" if a is a dependent base class

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 1 14:19:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46731

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-01 14:18:55 UTC ---
(In reply to comment #3)
> But I would argue that g is bound at first stage name-lookup
> and thus it is not a dependent name and thus the error is correct.

9.3.1p3 says that because it's found in the enclosing scope (during phase one)
it should be transformed into (*this).g() and so it's not called without an
object.

It's ill-formed for any specialisation b<T> where T is not a or some class
deriving from a, but for b<a> it's well-formed.



More information about the Gcc-bugs mailing list