Proposed Resolution (04/99):
Change the example in 13.2 [temp.param]
paragraph 8 from:
template<int *a> struct R { /* ... */ };
template<int b[5]> struct S { /* ... */ };
int *p;
R<p> w; // OK
S<p> x; // OK due to parameter adjustment
int v[5];
R<v> y; // OK due to implicit argument conversion
S<v> z; // OK due to both adjustment and conversion
to:
template<int *a> struct R { /* ... */ };
template<int b[5]> struct S { /* ... */ };
int p;
R<&p> w; // OK
S<&p> x; // OK due to parameter adjustment
int v[5];
R<v> y; // OK due to implicit argument conversion
S<v> z; // OK due to both adjustment and conversion
Furthermore, in 13.4.3 [temp.arg.nontype] paragraph 1:
The example in
13.2 [temp.param]
paragraph
8 is: I've been looking for the verbiage that specifies that this is an error
and haven't found it. In particular, nothing in 13.2 [temp.param]
("Template parameters")
nor 13.4.3 [temp.arg.nontype]
("Template non-type arguments") appears to rule out this case.
(13.4.3 [temp.arg.nontype] paragraph 1
allows an argument to be "the name of an object or function with
external linkage," with no limitation on the kinds of parameters such a
name can match; "p" is, in fact, such a name.) Should the resolution of the French comment include beefing up one or
both of these sections to cover the applicable rules explicitly?
Proposed Resolution (04/99):
Change the example in 13.2 [temp.param]
paragraph 8 from:
template<int* a> struct R { /*...*/ };
int* p;
R<p> w;
There was a French comment was that this is an error, and there was general
agreement with that.
template<int *a> struct R { /* ... */ };
template<int b[5]> struct S { /* ... */ };
int *p;
R<p> w; // OK
S<p> x; // OK due to parameter adjustment
int v[5];
R<v> y; // OK due to implicit argument conversion
S<v> z; // OK due to both adjustment and conversion
to:
template<int *a> struct R { /* ... */ };
template<int b[5]> struct S { /* ... */ };
int p;
R<&p> w; // OK
S<&p> x; // OK due to parameter adjustment
int v[5];
R<v> y; // OK due to implicit argument conversion
S<v> z; // OK due to both adjustment and conversion
Furthermore, in 13.4.3 [temp.arg.nontype] paragraph 1: