The GNU C++ (g++ -pedantic -Wall) accepts this:
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;
}
Is it legal C++? Are other compilers likely to accept it?