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

           Summary: Invalid error message 'has no member named' when
                    referring directly to the base class
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ethou...@gmail.com


Created attachment 23908
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23908
Short C++ code that reproduces the problem.

There is one case, having that:

struct Base { };
struct Concrete: Base { void setValue( string, string ); };

and using:

v->BaseType::setValue( this->name, this->value );

[with template parameter BaseType = Base]

generates the following error:

newmpl.cc:37:35: error: ‘struct Concrete’ has no member named ‘setValue’

which is a lie, because Concrete::setValue exists. The mistaken here is the
name of the class that does not have given member, which should be ‘struct
Base’ here, because this call refers directly to the given class (not to the
'v' pointer's class).

Please find the reproduction example in attachment (no dependencies but C++
standard library). You can see that the 'Base' class has 'setValue' commented
out in order to make this error occur.

The same behavior is with the latest version, gcc 4.7.0.

Reply via email to