public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20576] New: poor diagnostic
@ 2005-03-21 12:26 igodard at pacbell dot net
  2005-03-21 12:39 ` [Bug c++/20576] " igodard at pacbell dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: igodard at pacbell dot net @ 2005-03-21 12:26 UTC (permalink / raw)
  To: gcc-bugs

In:
struct bottom {};
template<typename v, typename next>
struct node: public next { v val; };
enum a {b, c}; enum x{y, z};
struct foo : public node<a,
                    node<x,
                        bottom> > {};
template<typename T, typename U>
void bar(node<T, U>&) {}
int main() { foo f; bar(f); return 0; }


you get:
~/ootbc/members/src$ g++ foo.cc
foo.cc: In function `int main()':
foo.cc:10: error: no matching function for call to `bar(foo&)'

Actually, there is a matching function, but the call is ambiguous because there 
are two matching base classes. The diagnostic should say so and identify the 
matching bases. This is reported correctly by other ambiguous calls where two 
different functions are matches to the argument set. In this case one function 
has two different matches, but the user's need in the diagnostic is the same: 
show what the compiler found.

Ivan

-- 
           Summary: poor diagnostic
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/20576] poor diagnostic
  2005-03-21 12:26 [Bug c++/20576] New: poor diagnostic igodard at pacbell dot net
@ 2005-03-21 12:39 ` igodard at pacbell dot net
  2005-03-21 22:05 ` bangerth at dealii dot org
  2005-06-20  3:01 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: igodard at pacbell dot net @ 2005-03-21 12:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2005-03-21 12:39 -------
The same case but using derivation from classes rather than templates:

struct foo {};
struct bar : public foo {};
struct baz : public bar {};
struct baf : public foo, public baz {};
void F(foo&) {}
int main() { baf b; F(b); return 0; }


gives a much better diagnostic:

~/ootbc/members/src$ g++ foo.cc
foo.cc:4: warning: direct base `foo' inaccessible in `baf' due to ambiguity
foo.cc: In function `int main()':
foo.cc:6: error: `foo' is an ambiguous base of `baf'


-- 


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


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

* [Bug c++/20576] poor diagnostic
  2005-03-21 12:26 [Bug c++/20576] New: poor diagnostic igodard at pacbell dot net
  2005-03-21 12:39 ` [Bug c++/20576] " igodard at pacbell dot net
@ 2005-03-21 22:05 ` bangerth at dealii dot org
  2005-06-20  3:01 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2005-03-21 22:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-03-21 22:05 -------
I'm absolutely positive this is a duplicate of a fair number of other PRs, 
though I can't find one with a 20 second search. PR 13979 may be one, but 
doesn't have a really short testcase so I can't tell for sure. 
 
W. 

-- 


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


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

* [Bug c++/20576] poor diagnostic
  2005-03-21 12:26 [Bug c++/20576] New: poor diagnostic igodard at pacbell dot net
  2005-03-21 12:39 ` [Bug c++/20576] " igodard at pacbell dot net
  2005-03-21 22:05 ` bangerth at dealii dot org
@ 2005-06-20  3:01 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-20  3:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-20 03:01 -------


*** This bug has been marked as a duplicate of 16057 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-06-20  3:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-21 12:26 [Bug c++/20576] New: poor diagnostic igodard at pacbell dot net
2005-03-21 12:39 ` [Bug c++/20576] " igodard at pacbell dot net
2005-03-21 22:05 ` bangerth at dealii dot org
2005-06-20  3:01 ` pinskia 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).