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

* [Bug c++/48489] Invalid error message 'has no member named' when referring directly to the base class
  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 ` redi at gcc dot gnu.org
  2011-10-16 18:25 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2011-04-07 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.04.07 13:02:52
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-04-07 13:02:52 UTC ---
The attachment can be simplified to:

struct Base{ };

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

int main()
{
    Concrete d;
    d.Base::setValue();
}


which gives the error:
error: 'struct Concrete' has no member named 'setValue'

expected:
error: 'struct Base' has no member named 'setValue'


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

* [Bug c++/48489] Invalid error message 'has no member named' when referring directly to the base class
  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
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-16 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-16 18:24:48 UTC ---
On it.


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

* [Bug c++/48489] Invalid error message 'has no member named' when referring directly to the base class
  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
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-10-17  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-10-17 09:48:06 UTC ---
Author: paolo
Date: Mon Oct 17 09:48:02 2011
New Revision: 180080

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180080
Log:
/cp
2011-10-17  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/48489
    * typeck.c (finish_class_member_access_expr): Fix error call
    for TREE_CODE (access_path) == TREE_BINFO.

/testsuite
2011-10-17  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/48489
    * g++.dg/inherit/error5.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/inherit/error5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/48489] Invalid error message 'has no member named' when referring directly to the base class
  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
                   ` (2 preceding siblings ...)
  2011-10-17  9:48 ` paolo at gcc dot gnu.org
@ 2011-10-17  9:50 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-17  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-17 09:50:18 UTC ---
Fixed for 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).