From Jason Turner

[temp.arg.nontype]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmprsu2t39b/{from.md → to.md} +15 -14
tmp/tmprsu2t39b/{from.md → to.md} RENAMED
@@ -6,22 +6,24 @@ shall be one of:
6
  - for a non-type *template-parameter* of integral or enumeration type, a
7
  converted constant expression ([[expr.const]]) of the type of the
8
  *template-parameter*; or
9
  - the name of a non-type *template-parameter*; or
10
  - a constant expression ([[expr.const]]) that designates the address of
11
- an object with static storage duration and external or internal
12
- linkage or a function with external or internal linkage, including
13
- function templates and function *template-id*s but excluding
14
  non-static class members, expressed (ignoring parentheses) as `&`
15
- *id-expression*, except that the `&` may be omitted if the name refers
16
- to a function or array and shall be omitted if the corresponding
 
17
  *template-parameter* is a reference; or
18
  - a constant expression that evaluates to a null pointer value (
19
  [[conv.ptr]]); or
20
  - a constant expression that evaluates to a null member pointer value (
21
  [[conv.mem]]); or
22
- - a pointer to member expressed as described in  [[expr.unary.op]].
 
23
 
24
  A string literal ([[lex.string]]) does not satisfy the requirements of
25
  any of these categories and thus is not an acceptable
26
  *template-argument*.
27
 
@@ -75,18 +77,17 @@ the program is ill-formed.
75
  - for a non-type *template-parameter* of type pointer to object,
76
  qualification conversions ([[conv.qual]]) and the array-to-pointer
77
  conversion ([[conv.array]]) are applied; if the *template-argument*
78
  is of type `std::nullptr_t`, the null pointer conversion (
79
  [[conv.ptr]]) is applied. In particular, neither the null pointer
80
- conversion for a zero-valued integral constant expression (
81
- [[conv.ptr]]) nor the derived-to-base conversion ([[conv.ptr]]) are
82
- applied. Although `0` is a valid *template-argument* for a non-type
83
- *template-parameter* of integral type, it is not a valid
84
- *template-argument* for a non-type *template-parameter* of pointer
85
- type. However, both `(int*)0` and `nullptr` are valid
86
- *template-argument*s for a non-type *template-parameter* of type
87
- “pointer to int.”
88
  - For a non-type *template-parameter* of type reference to object, no
89
  conversions apply. The type referred to by the reference may be more
90
  cv-qualified than the (otherwise identical) type of the
91
  *template-argument*. The *template-parameter* is bound directly to the
92
  *template-argument*, which shall be an lvalue.
 
6
  - for a non-type *template-parameter* of integral or enumeration type, a
7
  converted constant expression ([[expr.const]]) of the type of the
8
  *template-parameter*; or
9
  - the name of a non-type *template-parameter*; or
10
  - a constant expression ([[expr.const]]) that designates the address of
11
+ a complete object with static storage duration and external or
12
+ internal linkage or a function with external or internal linkage,
13
+ including function templates and function *template-id*s but excluding
14
  non-static class members, expressed (ignoring parentheses) as `&`
15
+ *id-expression*, where the *id-expression* is the name of an object or
16
+ function, except that the `&` may be omitted if the name refers to a
17
+ function or array and shall be omitted if the corresponding
18
  *template-parameter* is a reference; or
19
  - a constant expression that evaluates to a null pointer value (
20
  [[conv.ptr]]); or
21
  - a constant expression that evaluates to a null member pointer value (
22
  [[conv.mem]]); or
23
+ - a pointer to member expressed as described in  [[expr.unary.op]]; or
24
+ - a constant expression of type `std::nullptr_t`.
25
 
26
  A string literal ([[lex.string]]) does not satisfy the requirements of
27
  any of these categories and thus is not an acceptable
28
  *template-argument*.
29
 
 
77
  - for a non-type *template-parameter* of type pointer to object,
78
  qualification conversions ([[conv.qual]]) and the array-to-pointer
79
  conversion ([[conv.array]]) are applied; if the *template-argument*
80
  is of type `std::nullptr_t`, the null pointer conversion (
81
  [[conv.ptr]]) is applied. In particular, neither the null pointer
82
+ conversion for a zero-valued integer literal ([[conv.ptr]]) nor the
83
+ derived-to-base conversion ([[conv.ptr]]) are applied. Although `0`
84
+ is a valid *template-argument* for a non-type *template-parameter* of
85
+ integral type, it is not a valid *template-argument* for a non-type
86
+ *template-parameter* of pointer type. However, both `(int*)0` and
87
+ `nullptr` are valid *template-argument*s for a non-type
88
+ *template-parameter* of type “pointer to int.”
 
89
  - For a non-type *template-parameter* of type reference to object, no
90
  conversions apply. The type referred to by the reference may be more
91
  cv-qualified than the (otherwise identical) type of the
92
  *template-argument*. The *template-parameter* is bound directly to the
93
  *template-argument*, which shall be an lvalue.