From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8532 invoked by alias); 17 Mar 2003 00:06:02 -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 8462 invoked by uid 71); 17 Mar 2003 00:06:01 -0000 Date: Mon, 17 Mar 2003 00:06:00 -0000 Message-ID: <20030317000601.8457.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Martin Sebor Subject: Re: c++/10111: Parse error for default template parameter Reply-To: Martin Sebor X-SW-Source: 2003-03/txt/msg01094.txt.bz2 List-Id: The following reply was made to PR c++/10111; it has been noted by GNATS. From: Martin Sebor To: gcc-gnats@gcc.gnu.org Cc: Subject: Re: c++/10111: Parse error for default template parameter Date: Sun, 16 Mar 2003 17:03:49 -0700 Giovanni Bajo wrote: > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p > r=10111 > > Not a real bug. All boils down to a definition like this: > > void Foo(int a = A::something) {} > > There is an open defect report about this > (http://www.comeaucomputing.com/iso/cwg_active.html#325), because (shortly) > ISO C++ does not mandate that the compiler must understand that the comma is > separating template parameters, and not parameters of the function you are > declaring. Not necessarily. The issue is in Open state, so it's still a bug at least until the next revision of C++ (assuming issue 325 is accepted as a defect) :) > Simple workaround is putting a couple of paranthesis around the > default argument, the code will compile correctly: > > void Foo(int a = (A::something)) {} But this still doesn't seem to (at least not with 3.2.2). Incidentally, this test case is isolated from std::bitset. template struct A { typedef int I; static const I i = 0; }; template struct B { template B (const A&, typename A::I = (typename A::I ()), typename A::I = (A::i)) { } }; int main () { A a; B<0> b (a); } Regards Martin