public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16965] New: [3.4/3.5 regression] Confusing mismatch in error messages
@ 2004-08-10 14:31 bangerth at dealii dot org
  2004-08-10 14:31 ` [Bug c++/16965] " bangerth at dealii dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2004-08-10 14:31 UTC (permalink / raw)
  To: gcc-bugs

Consider this little example, derived from PR 16963: 
------------- 
template <typename T> struct B { 
    static int Bar(T); 
}; 
struct D : B<int>, B<char> {}; 
 
int i1 = D().Bar(1); 
int i2 = D::Bar(2); 
------------- 
Note that Bar() is static, so trying to call it via D().Bar or D::Bar 
shouldn't make a difference (for a moment ignore the fact that the 
code doesn't compile at all, probably for a good reason, as discussed 
in PR 16963). However, we get this confusing mismatch in error messages: 
 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc:6: error: request for member `Bar' is ambiguous 
x.cc:2: error: candidates are: static int B<T>::Bar(T) [with T = char] 
x.cc:2: error:                 static int B<T>::Bar(T) [with T = int] 
x.cc:7: error: `Bar' is not a member of `D' 
 
The error message in line 7 is clearly not helpful, and wrong above 
that. It should simply read the same as the ambiguity message in line 6. 
This is a regression in 3.4 and mainline over previous versions that 
simply printed as expected: 
 
g/x> /home/bangerth/bin/gcc-3.3*/bin/c++ -c x.cc 
x.cc:6: error: request for member `Bar' is ambiguous 
x.cc:2: error: candidates are: static int B<T>::Bar(T) [with T = char] 
x.cc:2: error:                 static int B<T>::Bar(T) [with T = int] 
x.cc:7: error: request for member `Bar' is ambiguous 
x.cc:2: error: candidates are: static int B<T>::Bar(T) [with T = char] 
x.cc:2: error:                 static int B<T>::Bar(T) [with T = int] 
 
W.

-- 
           Summary: [3.4/3.5 regression] Confusing mismatch in error
                    messages
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-08-17 17:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-10 14:31 [Bug c++/16965] New: [3.4/3.5 regression] Confusing mismatch in error messages bangerth at dealii dot org
2004-08-10 14:31 ` [Bug c++/16965] " bangerth at dealii dot org
2004-08-15  5:51 ` pinskia at gcc dot gnu dot org
2004-08-17  7:24 ` mmitchel at gcc dot gnu dot org
2004-08-17 17:32 ` cvs-commit at gcc dot gnu dot org
2004-08-17 17:37 ` mmitchel 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).