From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21210 invoked by alias); 14 Apr 2003 04:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 21197 invoked by uid 71); 14 Apr 2003 04:36:00 -0000 Date: Mon, 14 Apr 2003 04:36:00 -0000 Message-ID: <20030414043600.21196.qmail@sources.redhat.com> To: gdr@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Giovanni Bajo" Subject: Re: c++/3638: [2003-01-02] Template class instanciated using wrong type Reply-To: "Giovanni Bajo" X-SW-Source: 2003-04/txt/msg00595.txt.bz2 List-Id: The following reply was made to PR c++/3638; it has been noted by GNATS. From: "Giovanni Bajo" To: , , , , Cc: "Wolfgang Bangerth" , "Gabriel Dos Reis" Subject: Re: c++/3638: [2003-01-02] Template class instanciated using wrong type Date: Mon, 14 Apr 2003 06:28:21 +0200 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p r=3638 This bug is pratically the same of c++/10394, but it shows a wrong code generation issue that was not noticed before: -------------------------------------------------------------- #include using namespace std; template struct traits { typedef long next; }; template struct c1 { template struct c2 { c1 c; }; c1() { cout << __PRETTY_FUNCTION__ << endl; } }; template void foo() { c1::next>::c2(); typename c1::next>::template c2(); } int main() { foo(); } -------------------------------------------------------------- When executed on 3.2/3.3, this prints: c1<_T>::c1() [with _T = int] c1<_T>::c1() [with _T = long int] when the type should obviously be the same. So it's a bug related to the implicit typename/template keywords. It's fixed in 3.4 because implicit typename/template are not allowed anymore, so the bug simply does not happen. Moreover, it's not a regression because 2.95 was giving an ICE on this code. I guess this should be closed, unless we consider the code generation bug serious enough to need a fix on the 3.3 branch. Giovanni Bajo