GNU C++ (g++ -pedantic -Wall) 接受这个:
typedef int MyInt;
class Test
{
public:
MyInt foo();
void bar(MyInt baz);
};
int Test::foo()
{
return 10;
}
void Test::bar(int baz)
{
}
int main(void)
{
Test t;
t.bar(t.foo());
return 0;
}
它是合法的 C++ 吗?其他编译器可能会接受它吗?