Title
Substitution of dependent template arguments in default template arguments
Status
nad
Section
13.2 [temp.param]
Submitter
Richard Smith

Created on 2015-10-06.00:00:00 last changed 94 months ago

Messages

Date: 2016-03-15.00:00:00

Rationale (March, 2016):

There is no problem with the specification, only with the implementations; the default argument for n is dependent because V has a dependent type.

Date: 2022-11-20.07:54:16

Consider the following example:

   template<typename T, T V, int n = sizeof(V)> using X = int[n];
   template<typename T> void f(X<T, 0>*) {}
   void g() { f<char>(0); }

Current implementations get confused here because they substitute V=0 into the default argument of X before knowing the type T and end up with f having type void (int (*)[sizeof(0)]), that is, the array bound does not depend on T. It's not clear what should happen here.

History
Date User Action Args
2017-02-06 00:00:00adminsetmessages: + msg5991
2017-02-06 00:00:00adminsetstatus: open -> nad
2015-10-06 00:00:00admincreate