From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6077 invoked by alias); 27 Jun 2006 18:01:21 -0000 Received: (qmail 6068 invoked by uid 22791); 27 Jun 2006 18:01:20 -0000 X-Spam-Check-By: sourceware.org Received: from mhs.swan.ac.uk (HELO mhs.swan.ac.uk) (137.44.1.33) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 27 Jun 2006 18:01:16 +0000 Received: from [137.44.2.59] (helo=cs-svr1.swan.ac.uk) by mhs.swan.ac.uk with esmtp (Exim 4.62) (envelope-from ) id 1FvHs8-0006CL-S7; Tue, 27 Jun 2006 19:01:12 +0100 Received: from cs-wsok.swansea.ac.uk (cs-wsok [137.44.2.227]) by cs-svr1.swan.ac.uk (Postfix) with ESMTP id BEF44292D9; Tue, 27 Jun 2006 19:01:12 +0100 (BST) Received: by cs-wsok.swansea.ac.uk (Postfix, from userid 3579) id 802BF23C00B; Tue, 27 Jun 2006 19:05:03 +0100 (BST) Date: Tue, 27 Jun 2006 18:01:00 -0000 From: Oliver Kullmann To: Pierre Chatelier , gcc-help@gcc.gnu.org Subject: Re: Template parameters problem Message-ID: <20060627180503.GA28901@cs-wsok.swansea.ac.uk> References: <9DC23426-6E00-4CD1-968F-0D6A0AF147B7@club-internet.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9DC23426-6E00-4CD1-968F-0D6A0AF147B7@club-internet.fr> User-Agent: Mutt/1.5.9i X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-06/txt/msg00238.txt.bz2 On Tue, Jun 27, 2006 at 07:35:38PM +0200, Pierre Chatelier wrote: > Hello, > > gcc reports an error that I do not understand; does anyone know if it > is a bug or some corner case of the standard ? > > #include > #include > using namespace std; > > void resetBar(const map& foo = map()) > { > }//ok > > struct Foo > { > void resetFoo(const map& foo = map()) > { > }//error (main.cpp:11: error: expected ',' or '...' before '>' token > main.cpp:11: error: wrong number of template > arguments (1, should be 4)) > }; > > Regards, > > Pierre Chatelier Hi, it must be struct Foo { void resetFoo(const std::map& foo = (std::map())) { } }; to disambiguate the syntax (declaration vs. definition; I believe that this is not a compiler issue; in such cases often additional brackets help, since they are allowed around expressions, but not around argument lists). Oliver