public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22040] New: gcc 4.0 examines dependent base classes
@ 2005-06-12 18:20 sebor at roguewave dot com
  2005-06-12 19:06 ` [Bug c++/22040] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: sebor at roguewave dot com @ 2005-06-12 18:20 UTC (permalink / raw)
  To: gcc-bugs

Gcc 4.0 (and prior) rejects the well-fromed program below. The error message
suggests that the compiler attempts to call the function A<int>::foo() defined
in the dependent base class of B<int> contrary to the requirement in 14.6.2, p3,
but fails to consider the function foo(A<int>).

$ cat t.cpp && g++ t.cpp
/*   1 */ template <class T> struct A { int foo (T) { return 1; } };
/*   2 */ template <class T> int foo (T) { return 2; }
/*   3 */ template <class T> struct B: T { int bar () { return foo (T ()); } };
/*   4 */ int foo (A<int>) { return 0; }
/*   5 */ int main () { return B<A<int> >().bar (); }
t.cpp: In member function 'int B<T>::bar() [with T = A<int>]':
t.cpp:5:   instantiated from here
t.cpp:3: error: no matching function for call to 'B<A<int> >::foo(A<int>)'
t.cpp:1: note: candidates are: int A<T>::foo(T) [with T = int]

-- 
           Summary: gcc 4.0 examines dependent base classes
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/22040] gcc 4.0 examines dependent base classes
  2005-06-12 18:20 [Bug c++/22040] New: gcc 4.0 examines dependent base classes sebor at roguewave dot com
@ 2005-06-12 19:06 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-12 19:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-12 19:06 -------
I have seen this bug before.
Yes, PR 5660.

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

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |rejects-valid
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-06-12 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-12 18:20 [Bug c++/22040] New: gcc 4.0 examines dependent base classes sebor at roguewave dot com
2005-06-12 19:06 ` [Bug c++/22040] " 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).