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: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Aug 2004 21:12:13 -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 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.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17011