File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -426,10 +426,10 @@ auto arr = new auto(10); // arr as int *
426
426
> In addition, `auto` cannot be used to derive array types:
427
427
>
428
428
> ```cpp
429
- > auto auto_arr2[10] = arr; // illegal, can't infer array type
429
+ > auto auto_arr2[10] = { arr} ; // illegal, can't infer array type
430
430
>
431
431
> 2.6.auto.cpp:30:19: error: 'auto_arr2' declared as array of 'auto'
432
- > auto auto_arr2[10] = arr;
432
+ > auto auto_arr2[10] = { arr} ;
433
433
> ```
434
434
435
435
### decltype
Original file line number Diff line number Diff line change @@ -361,10 +361,10 @@ auto arr = new auto(10); // arr 被推导为 int *
361
361
> 此外,`auto` 还不能用于推导数组类型:
362
362
>
363
363
> ```cpp
364
- > auto auto_arr2[10] = arr; // 错误, 无法推导数组元素类型
364
+ > auto auto_arr2[10] = { arr} ; // 错误, 无法推导数组元素类型
365
365
>
366
366
> 2.6.auto.cpp:30:19: error: 'auto_arr2' declared as array of 'auto'
367
- > auto auto_arr2[10] = arr;
367
+ > auto auto_arr2[10] = { arr} ;
368
368
> ```
369
369
370
370
### decltype
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ int main() {
37
37
auto i = 5 ; // type int
38
38
auto j = 6 ; // type int
39
39
auto arr = new auto (10 ); // type int*
40
- // auto auto_arr2[10] = arr;
40
+ // auto auto_arr2[10] = { arr} ;
41
41
// std::cout << add(i, j) << std::endl;
42
42
return 0 ;
43
43
}
You can’t perform that action at this time.
0 commit comments