C++ Logo

std-discussion

Advanced search

Array initialization

From: <rjshaw_at_[hidden]>
Date: Tue, 07 Apr 2026 02:17:20 +0000
In [dcl.init.general] :

-------------------------------------------------------------------------------------------------------
— If the initializer is a (non-parenthesized) braced-init-list or is = braced-init-list, the object or reference is

list-initialized (9.4.5).

...

— Otherwise, if the destination type is an array, the object is initialized as follows. Let x1 , . . . , xk be

the elements of the expression-list. ...
-------------------------------------------------------------------------------------------------------

The first case is for constructs like "int a[] = {1,2,3};", because "a" is an "object" [dcl.array].

What construct does the second case apply to ?

Received on 2026-04-07 02:17:30