Title
Default arguments for parameters of function templates
Status
dup
Section
9.3.4.7 [dcl.fct.default]
Submitter
unknown

Created on 1998-10-24.00:00:00 last changed 268 months ago

Messages

Date: 2002-10-15.00:00:00

Notes from October 2002 meeting:

The example here is flawed. It's not clear what is being requested. One possibility is the extension introduced by issue 226. Other meanings don't seem to be useful.

Date: 2004-09-10.00:00:00

9.3.4.7 [dcl.fct.default] paragraph 4 says:

For non-template functions, default arguments can be added in later declarations of a functions in the same scope.
Why say for non-template functions? Why couldn't the following allowed?
    template <class T> struct B {
        template <class U> inline void f(U);
    };

    template <class T> template <class U>
    inline void B<T>::f(U = int) {} // adds default arguments
                                       // is this well-formed?
    void g()
    {
        B<int> b;
        b.f();
    }
If this is ill-formed, chapter 14 should mention this.

Rationale: This is sufficiently clear in the standard. Allowing additional default arguments would be an extension.

History
Date User Action Args
2002-11-08 00:00:00adminsetmessages: + msg789
2002-11-08 00:00:00adminsetstatus: extension -> dup
1999-09-14 00:00:00adminsetstatus: nad -> extension
1998-10-24 00:00:00admincreate