c++/2469: ambiguity check fails for static member via multiple inheritance/templates

Thomas.Foerch@alcatel.de Thomas.Foerch@alcatel.de
Tue Apr 3 01:06:00 GMT 2001


>Number:         2469
>Category:       c++
>Synopsis:       ambiguity check fails for static member via multiple inheritance/templates
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 03 01:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Förch
>Release:        gcc version 2.96 20000731
>Organization:
>Environment:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-78)
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2 -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ Ambig.cc Ambig.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-78) (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-3
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1plus Ambig.ii -quiet -dumpbase Ambig.cc -version -o Ambig.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.1 2.96-78) (i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-78).
 as -V -Qy -o Ambig.o Ambig.s
GNU assembler version 2.10.90 (i386-redhat-linux) using BFD version 2.10.0.18
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o Ambig /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crti.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtbegin.o -L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -L/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../.. Ambig.o -lstdc++ -lm -lgcc -lc -lgcc /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crtn.o
>Description:
The compiler does not detect the ambiguity of public class variable,
when the class variable is inherited via a template. 

I would expect a compiler error message for the attached code like

[tom@trillian src]$ g++ -o Ambig Ambig.cc
Ambig.cc: In method `D<T>::D ()':
Ambig.cc:31: request for member `s' is ambiguous in multiple 
inheritance lattice
Ambig.cc:9: candidates are: int A::s
Ambig.cc:17:                 int B::s

This message occurs only, when the template C<T> is changed in the sample
code to an ordinary class.
>How-To-Repeat:
Compile the attached code
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="Ambig.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Ambig.cc"

Ly8jaW5jbHVkZSA8aW9zdHJlYW0+CgpjbGFzcyBBCnsKcHVibGljOgogIHN0YXRpYyBpbnQgczsK
fTsKCmludCBBOjpzID0gMTsKCmNsYXNzIEIKewpwdWJsaWM6CiAgc3RhdGljIGludCBzOwp9OwoK
aW50IEI6OnMgPSAyOwoKdGVtcGxhdGUgPGNsYXNzIFQ+CmNsYXNzIEM6IHB1YmxpYyBBCnt9OwoK
dGVtcGxhdGUgPGNsYXNzIFQ+CmNsYXNzIEQ6IHB1YmxpYyBDPFQ+LAoJIHB1YmxpYyBCCnsKcHVi
bGljOgogIEQoKSA6IEM8VD4oKQogIHsKICAgIGludCBpOwogICAgaSA9IHM7CiAgICAvL2NvdXQg
PDwgQjo6cyA8PCBlbmRsIDw8IEE6OnMgPDwgZW5kbCA8PCBDPFQ+OjpzIDw8IGVuZGwgPDwgcyA8
PCBlbmRsOwogIH0KfTsKCgppbnQgbWFpbigpCnsKICBEPGludD4gZDsKfQo=



More information about the Gcc-bugs mailing list