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

[Bug c++/48489] New: Invalid error message 'has no member named' when referring directly to the base class


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: unassigned@gcc.gnu.org
        ReportedBy: ethouris@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.


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