Skip to content

Commit cfea443

Browse files
committed
fixing auto_cast wrong sample
仕様の例で、文の先頭に書いたauto(r);とauto(a);はキャストではなく 変数宣言として解釈されるため、prvalueの例になっておらずコンパイルエラーとなっていた。 cplusplus/draft@3e3793aa [stmt.ambig]
1 parent e08262c commit cfea443

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎lang/cpp23/auto_cast.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ int x = 0;
3939
const int& r = x;
4040
int a[3]{};
4141

42-
auto(r); // int型のprvalue
43-
auto(a); // int*型のprvalue
44-
auto{x}; // int型のprvalue。auto(x)と同じ
42+
(void)auto(r); // int型のprvalue
43+
(void)auto(a); // int*型のprvalue
44+
auto{x}; // int型のprvalue。auto(x)と同じ
4545
```
4646
4747
- `auto()`のように初期化子が空の場合と、`auto{a, b}`のように要素が2つ以上ある場合は型を推論できないため、不適格となる

0 commit comments

Comments
 (0)