From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16944 invoked by alias); 3 Jun 2005 21:51:47 -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 16935 invoked by uid 48); 3 Jun 2005 21:51:44 -0000 Date: Fri, 03 Jun 2005 21:51:00 -0000 Message-ID: <20050603215144.16934.qmail@sourceware.org> From: "bangerth at dealii dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050603201311.21903.SSacek@appsecinc.com> References: <20050603201311.21903.SSacek@appsecinc.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/21903] Default argument of template function causes a compile-time error X-Bugzilla-Reason: CC X-SW-Source: 2005-06/txt/msg00385.txt.bz2 List-Id: ------- Additional Comments From bangerth at dealii dot org 2005-06-03 21:51 ------- Here's the same testcase again, but shorter: ------------------------------- struct O { template struct B { void set (T, bool=true); }; struct D : public B {}; }; void x () { O::D d; d.set(1); } ------------------------------- g/x> /home/bangerth/bin/gcc-3.4.4-pre/bin/c++ -c x.cc x.cc: In function `void x()': x.cc:12: error: the default argument for parameter 1 of `void O::B::set(T, bool) [with T = int]' has not yet been parsed Even if the error is justified, I must admit that I still don't understand what exactly is going on: everything has been parsed by the time we call d.set!? What exactly is going on? We should be giving a better explanation, and in addition someone might want to give me a better explanation as well. As a different problem: in the message, the argument should be counted from one, not zero -- I know C++ programmers like to count starting at zero, but the second argument will usually still be referred as 'argument 2', not 1. W. -- What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21903