public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected
@ 2004-08-05 19:30 dvv at gcc dot dvv dot org
  2004-08-05 19:34 ` [Bug c++/16889] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dvv at gcc dot dvv dot org @ 2004-08-05 19:30 UTC (permalink / raw)
  To: gcc-bugs

Ambiguity is not detected in this code:

// start of code
class B {
public:
    B* p;
    B* f();
    virtual ~B();
};

class B1 : virtual public B {
};

class B2 : virtual public B {
};

class B3 : public B {
};

class BB : public B1, public B2, public B3 {
};

#include <iostream>

B*
B::f ()
{
    std::cout << this << std::endl;

    return this;
}

B::~B()
{
    std::cout << this << ".~B()" << std::endl;
}

int
main ()
{
    BB b;
    b.B1::f();
    b.B2::f();
    b.B3::f();
    b.f();
}
// end of code

2.95.3 correctly rejects this code.

-- 
           Summary: regression from 2.95.3: ambiguity is not detected
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dvv at gcc dot dvv dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/16889] [3.4/3.5 Regression] ambiguity is not detected
  2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
@ 2004-08-05 19:34 ` pinskia at gcc dot gnu dot org
  2004-08-05 20:31 ` bangerth at dealii dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-05 19:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-05 19:34 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3.4
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-05 19:34:53
               date|                            |
            Summary|regression from 2.95.3:     |[3.4/3.5 Regression]
                   |ambiguity is not detected   |ambiguity is not detected
   Target Milestone|---                         |3.4.2


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


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

* [Bug c++/16889] [3.4/3.5 Regression] ambiguity is not detected
  2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
  2004-08-05 19:34 ` [Bug c++/16889] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-08-05 20:31 ` bangerth at dealii dot org
  2004-08-05 20:36 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2004-08-05 20:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-08-05 20:31 -------
This is the obvious minimal example: 
---------------------------- 
struct B { 
    int f(); 
}; 
 
struct B1 : virtual B {}; 
struct B2 : B {}; 
struct BB : B1, B2 {}; 
 
int i = BB().f(); 
------------------------------------- 
 
g/x> ~/bin/gcc-3.4*/bin/c++ -c x.cc 
 
g/x> ~/bin/gcc-3.3/bin/c++ -c x.cc 
x.cc:9: error: request for member `f' is ambiguous 
x.cc:2: error: candidates are: int B::f() 
x.cc:2: error:                 int B::f() 
 
To my great surprise, the picture changes once one makes member function f() a  
member _variable_: 
--------------------------- 
struct B { 
    int i; 
}; 
 
struct B1 : virtual B {}; 
struct B2 : B {}; 
struct BB : B1, B2 {}; 
 
int i = BB().i; 
------------------------------------ 
 
In this case, gcc3.4 suddently does spit out an error message (though not a very 
enlightening) whereas 3.3 shows the same message as before: 
 
g/x> ~/bin/gcc-3.4*/bin/c++ -c x.cc 
x.cc:9: error: `B' is an ambiguous base of `BB' 
 
g/x> ~/bin/gcc-3.3/bin/c++ -c x.cc 
x.cc:9: error: request for member `i' is ambiguous 
x.cc:2: error: candidates are: int B::i 
x.cc:2: error:                 int B::i 
 
W. 

-- 


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


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

* [Bug c++/16889] [3.4/3.5 Regression] ambiguity is not detected
  2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
  2004-08-05 19:34 ` [Bug c++/16889] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-08-05 20:31 ` bangerth at dealii dot org
@ 2004-08-05 20:36 ` pinskia at gcc dot gnu dot org
  2004-08-05 20:48 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-05 20:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-05 20:36 -------
: Search converges between 2003-02-19-trunk (#187) and 2003-02-20-trunk (#188).

-- 


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


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

* [Bug c++/16889] [3.4/3.5 Regression] ambiguity is not detected
  2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
                   ` (2 preceding siblings ...)
  2004-08-05 20:36 ` pinskia at gcc dot gnu dot org
@ 2004-08-05 20:48 ` pinskia at gcc dot gnu dot org
  2004-08-14 15:56 ` nathan at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-05 20:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-05 20:48 -------
Most likely caused by:
2003-02-20  Nathan Sidwell  <nathan@codesourcery.com>

        Change base class access representation. Share virtual base
        binfos.
        * cp/call.c (build_special_member_call): Remove binfo_for_vbase
        call.
        * cp/class.c (build_base_path): Likewise.
        ....


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at codesourcery dot
                   |                            |com


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


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

* [Bug c++/16889] [3.4/3.5 Regression] ambiguity is not detected
  2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
                   ` (3 preceding siblings ...)
  2004-08-05 20:48 ` pinskia at gcc dot gnu dot org
@ 2004-08-14 15:56 ` nathan at gcc dot gnu dot org
  2004-08-24 16:06 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-08-14 15:56 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/16889] [3.4/3.5 Regression] ambiguity is not detected
  2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
                   ` (4 preceding siblings ...)
  2004-08-14 15:56 ` nathan at gcc dot gnu dot org
@ 2004-08-24 16:06 ` cvs-commit at gcc dot gnu dot org
  2004-08-24 16:18 ` [Bug c++/16889] [3.4 " nathan at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-24 16:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-24 16:06 -------
Subject: Bug 16889

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2004-08-24 16:06:22

Modified files:
	gcc/cp         : ChangeLog search.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/lookup: ambig1.C ambig2.C 

Log message:
	cp:
	PR c++/16889
	* (is_subobject_of_p): Resurrect & optimize.
	(lookup_field_r): Use it.
	testsuite:
	PR c++/16889
	* g++.dg/lookup/ambig[12].C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4299&r2=1.4300
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&r1=1.310&r2=1.311
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4181&r2=1.4182
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/16889] [3.4 Regression] ambiguity is not detected
  2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
                   ` (5 preceding siblings ...)
  2004-08-24 16:06 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-24 16:18 ` nathan at gcc dot gnu dot org
  2004-08-24 16:34 ` cvs-commit at gcc dot gnu dot org
  2004-09-24 14:05 ` cvs-commit at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-08-24 16:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2004-08-24 16:18 -------
	PR c++/16889
	* (is_subobject_of_p): Resurrect & optimize.
	(lookup_field_r): Use it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/16889] [3.4 Regression] ambiguity is not detected
  2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
                   ` (6 preceding siblings ...)
  2004-08-24 16:18 ` [Bug c++/16889] [3.4 " nathan at gcc dot gnu dot org
@ 2004-08-24 16:34 ` cvs-commit at gcc dot gnu dot org
  2004-09-24 14:05 ` cvs-commit at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-24 16:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-24 16:34 -------
Subject: Bug 16889

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	nathan@gcc.gnu.org	2004-08-24 16:34:15

Modified files:
	gcc/cp         : ChangeLog search.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/lookup: ambig1.C ambig2.C 

Log message:
	cp:
	PR c++/16889
	* (is_subobject_of_p): Resurrect & optimize.
	(lookup_field_r): Use it.
	testsuite:
	PR c++/16889
	* g++.dg/lookup/ambig[12].C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.151&r2=1.3892.2.152
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.284.4.3&r2=1.284.4.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.258&r2=1.3389.2.259
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/16889] [3.4 Regression] ambiguity is not detected
  2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
                   ` (7 preceding siblings ...)
  2004-08-24 16:34 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-24 14:05 ` cvs-commit at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-24 14:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-24 14:05 -------
Subject: Bug 16889

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2004-09-24 14:04:59

Modified files:
	gcc/cp         : search.c ChangeLog 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/lookup: ambig3.C 

Log message:
	cp:
	PR c++/16889
	* search.c (lookup_field_queue_p): Correct check for hidden base.
	
	* search.c (bfs_walk): Remove.
	(lookup_member): Use dfs_walk_real.
	(dfs_walk_real): Move and adjust documentation from bfs_walk.
	testsuite:
	PR c++/16889
	* g++.dg/lookup/ambig3.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&r1=1.321&r2=1.322
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4383&r2=1.4384
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4341&r2=1.4342
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

end of thread, other threads:[~2004-09-24 14:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-05 19:30 [Bug c++/16889] New: regression from 2.95.3: ambiguity is not detected dvv at gcc dot dvv dot org
2004-08-05 19:34 ` [Bug c++/16889] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-08-05 20:31 ` bangerth at dealii dot org
2004-08-05 20:36 ` pinskia at gcc dot gnu dot org
2004-08-05 20:48 ` pinskia at gcc dot gnu dot org
2004-08-14 15:56 ` nathan at gcc dot gnu dot org
2004-08-24 16:06 ` cvs-commit at gcc dot gnu dot org
2004-08-24 16:18 ` [Bug c++/16889] [3.4 " nathan at gcc dot gnu dot org
2004-08-24 16:34 ` cvs-commit at gcc dot gnu dot org
2004-09-24 14:05 ` cvs-commit at gcc dot gnu dot org

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).