From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12125 invoked by alias); 22 Jan 2004 03:40:08 -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 12118 invoked by uid 48); 22 Jan 2004 03:40:08 -0000 Date: Thu, 22 Jan 2004 03:40:00 -0000 From: "gianni at mariani dot ws" To: gcc-bugs@gcc.gnu.org Message-ID: <20040122034003.13808.gianni@mariani.ws> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/13808] New: conversion operator template with template as parameter fails parsing X-Bugzilla-Reason: CC X-SW-Source: 2004-01/txt/msg02746.txt.bz2 List-Id: The code below compiles fine under Comeau and VC++7.1. gcc 3.3.2 gives the following diagnostic: t2x.cpp:14: error: parse error before `<' token t2x.cpp:14: error: syntax error before `<' token t2x.cpp:19: error: parse error before `}' token t2x.cpp: In function `int main()': t2x.cpp:33: error: conversion from `X' to non-scalar type `D' requested make: *** [t2x] Error 1 The "struct C" commented allows this to compile and function as expected which indicates that there most likely is a parsing error (expecting a typename but have a template instead). Using the "typename" keyword does not correct the problem. struct X { // struct C; //uncomment to make this work. template class C> C Func() { return C(); } template class C > operator C () { return C(); } }; template class D { }; int main() { X x; x.Func(); D d = x; } Credit for finding this problem goes to: Leor Zolman http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=58nt00110jirtteaml6p5o45j6l19le1cl%404ax.com&rnum=9 -- Summary: conversion operator template with template as parameter fails parsing Product: gcc Version: 3.3.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gianni at mariani dot ws CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13808