Allow fewer initializer values in initializer expr lists than expected.
We now match C's behavior, where if we have an initializer list with too-few values for the underlying type, any additional elements are initialized to zero. Fixes issue #123.
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
// requires 10 values; 11 provided
|
||||
|
||||
int func() {
|
||||
int a[10] = {1,2,3,4,5,6,7,8,9,10,11};
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// requires 12 values; 11 provided
|
||||
|
||||
int func() {
|
||||
int a[12] = {1,2,3,4,5,6,7,8,9,10,11};
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
// Initializer list for array "int32[4]" must have 4 elements (has 3)
|
||||
// Initializer list for array "int32[2][4]" must have no more than 2 elements (has 3)
|
||||
|
||||
int a[2][4] = { { 1, 2, 3 }, { 1, 2, 3, 4 }, 1 };
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// Initializer list for array "int32[4]" must have 4 elements
|
||||
|
||||
int a[2][4] = { { 1, 2, 3 }, { 1, 2, 3, 4 } };
|
||||
Reference in New Issue
Block a user