This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17011] [3.4/3.5 regression] invalid default parameter diagnosed too late
- From: "mark at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Aug 2004 22:21:02 -0000
- Subject: [Bug c++/17011] [3.4/3.5 regression] invalid default parameter diagnosed too late
- References: <20040812193920.17011.reichelt@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From mark at codesourcery dot com 2004-08-12 22:20 -------
Subject: Re: [3.4/3.5 regression] invalid default parameter
diagnosed too late
bangerth at dealii dot org wrote:
>------- Additional Comments From bangerth at dealii dot org 2004-08-12 21:12 -------
>I had to do some research when discussing a bug within IBM's xlC compiler a week ago,
>and here simply paste a piece from a mail to them that also seems relevant in the
>present context:
>-----------------------------------
>However, here's the catch: let's assume that we may cause an implicit
>instantiation. Then, 14.7.1/1 says: "The implicit instantiation of a class
>template specialization causes the instantiation of the declarations, but
>not of the definitions or default arguments...".
>
>Furthermore, 14.7.2 says: "Unless a call is to a [...] member function of
>an explicitly specialized class template, a default argument for a [...]
>member function of a class template is implicitly instantiated when the
>function is called in a context that requires the value of the default
>argument."
>
>Additionally, 14.7.1/11 indicates to me that default arguments are only
>evaluated at the point where they are actually used.
>-----------------------------------
>
>This all may or may not be imminent here, but it at least points to the right paragraphs
>that state when exactly a default argument shall be evaluated.
>
>
That's a good point. I forgot about that. I'm not sure exactly how it
plays in with the QoI issue in 17011; it might mean that it would be
invalid for the compiler to issue a diagnostic, or it might nt. But,
it's certainly interesting.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17011