From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6183 invoked by alias); 22 Apr 2005 21:12:26 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6146 invoked by uid 48); 22 Apr 2005 21:12:19 -0000 Date: Fri, 22 Apr 2005 21:12:00 -0000 From: "sebor at roguewave dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20050422211216.21165.sebor@roguewave.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/21165] New: bogus error on a user-defined conversion in a template X-Bugzilla-Reason: CC X-SW-Source: 2005-04/txt/msg03176.txt.bz2 List-Id: The test case below demonstrates two problems: 1) the line number in the error message points to an expression that involves only two ints (i.e., no object of T::BI as the message claims). 2) the program is well formed and the error is a regression from previous versions of the compiler. $ cat t.cpp && gcc -c t.cpp /* 1 */ struct A /* 2 */ { /* 3 */ A (int = 0); /* 4 */ operator int () const; /* 5 */ }; /* 6 */ /* 7 */ struct B /* 8 */ { /* 9 */ typedef int BI; /* 10 */ typedef A BA; /* 11 */ /* 12 */ }; /* 13 */ /* 14 */ template /* 15 */ struct C /* 16 */ { /* 17 */ typedef typename T::BA BA; /* 18 */ typedef typename T::BI BI; /* 19 */ /* 20 */ BA foo (BA ba) { /* 21 */ const int i = BI (ba); /* 22 */ /* 23 */ if (i < 0) /* 24 */ return A (); /* 25 */ /* 26 */ return A (); /* 27 */ } /* 28 */ }; /* 29 */ /* 30 */ template struct C; t.cpp: In member function 'typename T::BA C< , T>::foo(typename T::BA)': t.cpp:23: error: 'typename T::BI' used where a 'int' was expected -- Summary: bogus error on a user-defined conversion in a template 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 GCC build triplet: sparc-sun-solaris2.9 GCC host triplet: sparc-sun-solaris2.9 GCC target triplet: sparc-sun-solaris2.9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21165