Is an array bound a nondeduced context?
Section [temp.deduct.type]
Jack Rouse

Created on 1998-09-29.00:00:00 last changed 161 months ago


Date: 2001-04-15.00:00:00

[Moved to DR at 4/01 meeting.]

Date: 1999-10-15.00:00:00

Proposed resolution (04/01): In [temp.deduct.type] paragraph 4, add a third bullet:

  • An array bound that is an expression that references a template-parameter
Date: 1999-09-14.00:00:00

Paragraph 4 lists contexts in which template formals are not deduced. Were template formals in an expression in the array bound of an array type specification intentionally left out of this list? Or was the intent that such formals always be explicitly specified? Otherwise I believe the following should be valid:

    template <int I> class IntArr {};

    template <int I, int J>
    void concat( int (&d)[I+J], const IntArr<I>& a, const IntArr<J>& b ) {}

    int testing()
        IntArr<2> a;
        IntArr<3> b;
        int d[5];

        concat( d, a, b );
Can anybody shed some light on this?

From John Spicer:

Expressions involving nontype template parameters are nondeduced contexts, even though they are omitted from the list in [temp.deduct.type] paragraph 4. See [temp.deduct.type] paragraphs 12-14:

  1. A template type argument cannot be deduced from the type of a non-type template-argument.


  1. If, in the declaration of a function template with a non-type template-parameter, the non-type template-parameter is used in an expression in the function parameter-list, the corresponding template-argument must always be explicitly specified or deduced elsewhere because type deduction would otherwise always fail for such a template-argument.
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2003-04-25 00:00:00adminsetstatus: dr -> wp
2002-05-10 00:00:00adminsetmessages: + msg696
2001-05-20 00:00:00adminsetstatus: ready -> dr
2000-11-18 00:00:00adminsetstatus: review -> ready
2000-02-23 00:00:00adminsetmessages: + msg235
2000-02-23 00:00:00adminsetstatus: open -> review
1998-09-29 00:00:00admincreate