[Bug c++/21146] unable to resolve visible symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21146 Jonathan Wakely changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=13590 Last reconfirmed|2009-02-07 20:18:28 |2020-8-26 Blocks|65608 |94404 --- Comment #7 from Jonathan Wakely --- (In reply to Manuel López-Ibáñez from comment #4) > Do we know how icc resolves the ambiguity? I assume it checks that the two lookup results for "S" actually name the same type, and so decides there's no ambiguity. I think that is correct according to [class.member.lookup]. The declaration sets for lookup of S in ::C and in ::B and in :S and in ::A<::S> all find the same type, ::S. So there is no ambiguity. This was ambiguous in C++03 but that was changed by CWG 39 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#39 So GCC is wrong. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65608 [Bug 65608] [meta-bug] friend issues https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94404 [Bug 94404] [meta-bug] C++ core issues
[Bug c++/21146] unable to resolve visible symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21146 --- Comment #6 from Jonathan Wakely --- EDG still accepts this, but Clang doesn't: 21146.cc:13:18: error: member 'S' found in multiple base classes of different types friend class A; ^ 21146.cc:7:8: note: member found by ambiguous name lookup struct S {}; ^ 21146.cc:4:13: note: member found by ambiguous name lookup typedef T S; ^ 21146.cc:13:18: error: member 'S' found in multiple base classes of different types friend class A; ^ 21146.cc:7:8: note: member found by ambiguous name lookup struct S {}; ^ 21146.cc:4:13: note: member found by ambiguous name lookup typedef T S; ^ 2 errors generated. I think GCC and Clang are right here.
[Bug c++/21146] unable to resolve visible symbol
--- Comment #5 from manu at gcc dot gnu dot org 2009-02-07 20:18 --- This still fails in GCC 4.4 icc accepts the code in strict mode, so I guess this is rejects-valid. -- manu at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords||rejects-valid Known to fail||4.4.0 Last reconfirmed|-00-00 00:00:00 |2009-02-07 20:18:28 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21146
[Bug c++/21146] unable to resolve visible symbol
--- Comment #4 from manu at gcc dot gnu dot org 2007-11-15 16:30 --- So, is this a bug or not? Do we know how icc resolves the ambiguity? -- manu at gcc dot gnu dot org changed: What|Removed |Added CC||manu at gcc dot gnu dot org Keywords||diagnostic http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21146
[Bug c++/21146] unable to resolve visible symbol
--- Comment #3 from reichelt at gcc dot gnu dot org 2007-04-09 18:32 --- Btw, since GCC 4.1.0 the error message is: bug.cc:13: error: reference to 'S' is ambiguous bug.cc:4: error: candidates are: typedef struct S A::S bug.cc:7: error: struct S bug.cc:13: error: template argument 1 is invalid bug.cc:13: error: friend declaration does not name a class or function -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21146
[Bug c++/21146] unable to resolve visible symbol
--- Additional Comments From bangerth at dealii dot org 2005-05-02 18:54 --- What is going wrong is this: the name 'S' may refer to both the local typedef in the base class 'A' as well as to the global structure '::S'. If I write either friend class A< A< ::S>::S>; or friend class A< ::S>; then the code is accepted by gcc. I don't know whether the ambiguity makes the code invalid. As a reference point, icc accepts the code in strict mode. W. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21146
[Bug c++/21146] unable to resolve visible symbol
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-21 12:59 --- 3.3.3 gave: t.cc:13: error: request for member `S' is ambiguous in multiple inheritance lattice t.cc:7: error: candidates are: struct S t.cc:4: error: typedef struct S A::S t.cc:13: error: template argument 1 is invalid t.cc:13: error: ISO C++ forbids declaration of `type name' with no type If the code is invalid, then we have a diagnostic regression. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21146