public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48489] New: Invalid error message 'has no member named' when referring directly to the base class
@ 2011-04-07 11:59 ethouris at gmail dot com
  2011-04-07 13:03 ` [Bug c++/48489] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ethouris at gmail dot com @ 2011-04-07 11:59 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-10-17  9:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-07 11:59 [Bug c++/48489] New: Invalid error message 'has no member named' when referring directly to the base class ethouris at gmail dot com
2011-04-07 13:03 ` [Bug c++/48489] " redi at gcc dot gnu.org
2011-10-16 18:25 ` paolo.carlini at oracle dot com
2011-10-17  9:48 ` paolo at gcc dot gnu.org
2011-10-17  9:50 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).