You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> must be a <non_terminal where="11.2">class-type</non_terminal> or a <non_terminal where="11.1"
139
+
>value-type</non_terminal
140
+
>. The type cannot be an abstract <non_terminal where="11.2"
141
+
>class-type</non_terminal
142
+
>. </paragraph
143
+
>
144
+
<paragraph
145
+
>The optional <non_terminal where="14.4.1"
146
+
>argument-list</non_terminal
147
+
> (<hyperlink>14.4.1</hyperlink>) is permitted only if the type is a <non_terminal where="11.2"
148
+
>class-type</non_terminal
149
+
> or a <non_terminal where="11.1">struct-type</non_terminal>. </paragraph
150
+
>
151
+
<paragraph
152
+
>The compile-time processing of an <non_terminal where="14.5.10.1"
153
+
>object-creation-expression</non_terminal
154
+
> of the form new T(A), where T is a <non_terminal where="11.2"
155
+
>class-type</non_terminal
156
+
> or a <non_terminal where="11.1">value-type</non_terminal> and A is an optional <non_terminal
157
+
where="14.4.1"
158
+
>argument-list</non_terminal
159
+
>, consists of the following steps: <list>
160
+
<list_item
161
+
> If T is a <non_terminal where="11.1"
162
+
>value-type</non_terminal
163
+
> and A is not present: </list_item
164
+
>
165
+
<list>
166
+
<list_item
167
+
> The <non_terminal where="14.5.10.1"
168
+
>object-creation-expression</non_terminal
169
+
> is a default constructor invocation. The result of the <non_terminal where="14.5.10.1"
170
+
>object-creation-expression</non_terminal
171
+
> is a value of type T, namely the default value for T as defined in <hyperlink>11.1.1</hyperlink>. </list_item
172
+
>
173
+
</list>
174
+
<list_item
175
+
> Otherwise, if T is a <non_terminal where="11.2"
176
+
>class-type</non_terminal
177
+
> or a struct-type: </list_item
178
+
>
179
+
<list>
180
+
<list_item
181
+
> If T is an abstract <non_terminal where="11.2"
182
+
>class-type</non_terminal
183
+
>, a compile-time error occurs. </list_item
184
+
>
185
+
<list_item
186
+
> The instance constructor to invoke is determined using the overload resolution rules of <hyperlink>14.4.2</hyperlink>. The set of candidate instance constructors consists of all accessible instance constructors declared in T. If the set of candidate instance constructors is empty, or if a single best instance constructor cannot be identified, a compile-time error occurs. </list_item
187
+
>
188
+
<list_item
189
+
> The result of the <non_terminal where="14.5.10.1"
190
+
>object-creation-expression</non_terminal
191
+
> is a value of type T, namely the value produced by invoking the instance constructor determined in the step above. </list_item
192
+
>
193
+
</list>
194
+
<list_item
195
+
> Otherwise, the <non_terminal where="14.5.10.1"
196
+
>object-creation-expression</non_terminal
197
+
> is invalid, and a compile-time error occurs. </list_item
198
+
>
199
+
</list>
200
+
</paragraph>
201
+
<paragraph
202
+
>The run-time processing of an <non_terminal where="14.5.10.1"
203
+
>object-creation-expression</non_terminal
204
+
> of the form new T(A), where T is <non_terminal where="11.2"
205
+
>class-type</non_terminal
206
+
> or a <non_terminal where="11.1">struct-type</non_terminal> and A is an optional <non_terminal
207
+
where="14.4.1"
208
+
>argument-list</non_terminal
209
+
>, consists of the following steps: <list>
210
+
<list_item> If T is a class-type: </list_item>
211
+
<list>
212
+
<list_item> A new instance of class T is allocated. If there is not enough memory available to allocate the new instance, a System.OutOfMemoryException is thrown and no further steps are executed. </list_item>
213
+
<list_item
214
+
> All fields of the new instance are initialized to their default values (<hyperlink>12.2</hyperlink>). </list_item
215
+
>
216
+
<list_item
217
+
> The instance constructor is invoked according to the rules of function member invocation (<hyperlink>14.4.3</hyperlink>). A reference to the newly allocated instance is automatically passed to the instance constructor and the instance can be accessed from within that constructor as this. </list_item
218
+
>
219
+
</list>
220
+
<list_item> If T is a struct-type: </list_item>
221
+
<list>
222
+
<list_item
223
+
> An instance of type T is created by allocating a temporary local variable. Since an instance constructor of a <non_terminal
224
+
where="11.1"
225
+
>struct-type</non_terminal
226
+
> is required to definitely assign a value to each field of the instance being created, no initialization of the temporary variable is necessary. </list_item
227
+
>
228
+
<list_item
229
+
> The instance constructor is invoked according to the rules of function member invocation (<hyperlink>14.4.3</hyperlink>). A reference to the newly allocated instance is automatically passed to the instance constructor and the instance can be accessed from within that constructor as this. </list_item
0 commit comments