This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g++ - pred
- To: Maciej Hrebien <m_hrebien at poczta dot onet dot pl>
- Subject: Re: g++ - pred
- From: Martin Sebor <sebor at roguewave dot com>
- Date: Sat, 17 Mar 2001 21:13:44 -0700
- CC: gcc-bugs at gcc dot gnu dot org
- Organization: Rogue Wave Software, Inc.
- References: <006001c0ae47$21ed8860$4f054dd5@igra.pl>
Maciej Hrebien wrote:
>
> Hello again,
>
> Please look at this:
>
> template<class T>
> struct Pre
> {
> void operator()(const T&, const T&){}
> static void op(const T&, const T&){}
> };
>
> template<class T, class PreT=Pre<T> >
^^^^^^^^^^^
Function templates don't allow default template arguments.
> void fun(const T& a, const T& b)
> {
> PreT::p(a,b);
> }
>
> main()
^^^^^^
Missing return type.
> {
> fun(1,2);
> return 0;
> }
>
> Why g++-2.95.2 gives me errors telling that I have default arg for template
> param
> if function template (PreT,fun)? I know that, I wrote it :) ISO/IEC 14882 p.
> 14.1 says that it should work.
You didn't read far enough, 14.1, p9 says it shouldn't:
"A default template-argument shall not be specified in a function template
declaration or a function template definition, ..."
Regards
Martin