From Jason Turner

[temp.alias]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmps32c_92u/{from.md → to.md} +23 -10
tmp/tmps32c_92u/{from.md → to.md} RENAMED
@@ -1,16 +1,16 @@
1
  ### Alias templates <a id="temp.alias">[[temp.alias]]</a>
2
 
3
  A *template-declaration* in which the *declaration* is an
4
- *alias-declaration* (Clause  [[dcl.dcl]]) declares the *identifier* to
5
- be an *alias template*. An alias template is a name for a family of
6
- types. The name of the alias template is a *template-name*.
7
 
8
  When a *template-id* refers to the specialization of an alias template,
9
  it is equivalent to the associated type obtained by substitution of its
10
- *template-argument*s for the *template-parameter*s in the *type-id* of
11
- the alias template.
12
 
13
  [*Note 1*: An alias template name is never deduced. — *end note*]
14
 
15
  [*Example 1*:
16
 
@@ -45,19 +45,19 @@ substitution still applies to the *template-id*.
45
  [*Example 2*:
46
 
47
  ``` cpp
48
  template<typename...> using void_t = void;
49
  template<typename T> void_t<typename T::foo> f();
50
- f<int>(); // error, int does not have a nested type foo
51
  ```
52
 
53
  — *end example*]
54
 
55
- The *type-id* in an alias template declaration shall not refer to the
56
- alias template being declared. The type produced by an alias template
57
- specialization shall not directly or indirectly make use of that
58
- specialization.
59
 
60
  [*Example 3*:
61
 
62
  ``` cpp
63
  template <class T> struct A;
@@ -68,5 +68,18 @@ template <class T> struct A {
68
  B<short> b; // error: instantiation of B<short> uses own type via A<short>::U
69
  ```
70
 
71
  — *end example*]
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ### Alias templates <a id="temp.alias">[[temp.alias]]</a>
2
 
3
  A *template-declaration* in which the *declaration* is an
4
+ *alias-declaration* [[dcl.pre]] declares the *identifier* to be an
5
+ *alias template*. An alias template is a name for a family of types. The
6
+ name of the alias template is a *template-name*.
7
 
8
  When a *template-id* refers to the specialization of an alias template,
9
  it is equivalent to the associated type obtained by substitution of its
10
+ *template-argument*s for the *template-parameter*s in the
11
+ *defining-type-id* of the alias template.
12
 
13
  [*Note 1*: An alias template name is never deduced. — *end note*]
14
 
15
  [*Example 1*:
16
 
 
45
  [*Example 2*:
46
 
47
  ``` cpp
48
  template<typename...> using void_t = void;
49
  template<typename T> void_t<typename T::foo> f();
50
+ f<int>(); // error: int does not have a nested type foo
51
  ```
52
 
53
  — *end example*]
54
 
55
+ The *defining-type-id* in an alias template declaration shall not refer
56
+ to the alias template being declared. The type produced by an alias
57
+ template specialization shall not directly or indirectly make use of
58
+ that specialization.
59
 
60
  [*Example 3*:
61
 
62
  ``` cpp
63
  template <class T> struct A;
 
68
  B<short> b; // error: instantiation of B<short> uses own type via A<short>::U
69
  ```
70
 
71
  — *end example*]
72
 
73
+ The type of a *lambda-expression* appearing in an alias template
74
+ declaration is different between instantiations of that template, even
75
+ when the *lambda-expression* is not dependent.
76
+
77
+ [*Example 4*:
78
+
79
+ ``` cpp
80
+ template <class T>
81
+ using A = decltype([] { }); // A<int> and A<char> refer to different closure types
82
+ ```
83
+
84
+ — *end example*]
85
+