-
-
Notifications
You must be signed in to change notification settings - Fork 3k
## 第二章 2.3类型推导中的一个疑问 #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
初次尝试提出问题,如果对任何人造成困扰,非常抱歉。 第二章 2.3节类型推导,auto小节中有如下示例: auto auto_arr2[10] = arr; // 错误, 无法推导数组元素类型
2.6.auto.cpp:30:19: error: 'auto_arr2' declared as array of 'auto'
auto auto_arr2[10] = arr; 联系上下文得知,我猜测arr指同一小节如下文本: auto i = 5; // i 被推导为 int
auto arr = new auto(10); // arr 被推导为 int * 动机那么,在arr是一个变量的情况下,请问将变量赋值给数组的行为本身合法吗?这里是不是存在第二个错误? int* auto_arr2[10] = arr; 即使是改为上面的行为就合法吗? 需求说明下面的写法不应该更加形象吗?更能指明主旨,auto不能推导数组类型。 auto auto_arr2[10] = {arr}; |
这行代码是错误的, int auto_arr2[10] = {arr}; //合法
我赞同添加括号,已提PR #112 |
感谢楼上各位的报告,没错,应该使用 |
Fixed in #112 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivation
Please briefly describe your motivation.
Requirements
Please list all of your suggestions.
动机
请描述你提交内容建议的动机。
需求说明
请描述你提交内容建议的详单,例如具体是增加哪个知识点的说明。
The text was updated successfully, but these errors were encountered: