This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21903] Default argument of template function causes a compile-time error
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jun 2005 21:51:44 -0000
- Subject: [Bug c++/21903] Default argument of template function causes a compile-time error
- References: <20050603201311.21903.SSacek@appsecinc.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2005-06-03 21:51 -------
Here's the same testcase again, but shorter:
-------------------------------
struct O {
template<typename T> struct B {
void set (T, bool=true);
};
struct D : public B<int> {};
};
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<T>::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