【发布时间】:2011-05-08 08:08:11
【问题描述】:
基本上这是this question 对最令人烦恼的解析的跟进。我可以理解这是由于函数声明和变量定义之间的歧义。
但在Comeau online,我只是厌倦了以下。
class T{
public:
T(int i){
}
int fun1(){
return 1;
}
};
int main()
{
T myT(10); // I thought it'd be a function declaration that takes an int and returns a type T
myT.fun1(); // and a compiler error out here.
}
但是它编译得很好并且没有错误。我查看了标准文档,但无法得出一个推理。
那么,我在这里错过了什么?
【问题讨论】:
-
为什么你会期望任何不同,你正确地构造了一个
T的实例
标签: c++ most-vexing-parse