From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28708 invoked by alias); 6 Jun 2005 09:35:17 -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 28611 invoked by uid 48); 6 Jun 2005 09:34:59 -0000 Date: Mon, 06 Jun 2005 09:35:00 -0000 Message-ID: <20050606093459.28610.qmail@sourceware.org> From: "nathan at gcc dot gnu 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/msg00968.txt.bz2 List-Id: ------- Additional Comments From nathan at gcc dot gnu dot org 2005-06-06 09:34 ------- ug. This looks like a defect in the std. As has been pointed out, we cannot parse the default argument until the outer class is complete -- because the default argument of the nested class can legitimately call or access a static member of the outer class that happens to be declared after the nested class. However after the definition of the nested class, that template is complete according to the language, and should therefore be instantiable. When instantiating it, we have to instantiate the declarations of all its member functions [14.7.1]. Aha! 'but not ... the default arguments'. Default arguments are implicitly instantiated 'when the function is called in a context that requires the value of that default argument'. So, we need to remember we're instantiating a function declaration containing an unparsed default arg -- and then DTRT when the arg gets parsed. This isn't a regression (is it?), so won't be fixed until 4.1 is released. -- What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |nathan at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2005-06-04 10:46:16 |2005-06-06 09:34:54 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21903