Movatterモバイル変換


[0]ホーム

URL:


Issue 49 - WG21 CWG Issues
Title
Restriction on non-type, non-value template arguments
Status
tc1
Section
13.2 [temp.param]
Submitter
Mike Miller

Created on1998-10-16.00:00:00 last changed277 months ago

Messages

msg209 (view)
Date: 1999-04-15.00:00:00

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 fourth bullet item should be changed from "...where the & is optionalif the name refers to a function or array;" to "...where the & is optionalif the name refers to a function or array, or ifthe correspondingtemplate-parameter is a reference;"
  • the third bullet item should be removed.
msg52 (view)
Date: 2022-11-20.07:54:16

The example in13.2 [temp.param]paragraph8 is:

    template<int* a> struct R { /*...*/ };    int* p;    R<p> w;
There was a French comment was that this is an error, and there was generalagreement with that.

I've been looking for the verbiage that specifies that this is an errorand 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 1allows an argument to be "the name of an object or function withexternal linkage," with no limitation on the kinds of parameters such aname can match; "p" is, in fact, such a name.)

Should the resolution of the French comment include beefing up one orboth 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 { /* ... */ };    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 fourth bullet item should be changed from "...where the & is optionalif the name refers to a function or array;" to "...where the & is optionalif the name refers to a function or array, or ifthe correspondingtemplate-parameter is a reference;"
  • the third bullet item should be removed.
History
DateUserActionArgs
2003-04-25 00:00:00adminsetstatus: dr -> tc1
1999-09-14 00:00:00adminsetmessages: +msg209
1999-09-14 00:00:00adminsetstatus: drafting -> dr
1998-10-16 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp