B
Bolin
When compiling the following code:
Code:
#include <iostream>
struct B {};
struct A
{
A(B b1, B b2) {};
void foo() { std::cout << "foo called" << std::endl; }
};
int main(int argc, char * argv[])
{
A a(B(), B());
a.foo();
return 0;
}
[\code]
the compiler will interprete the first line of the main function as a
function pointer declaration, and thus will fail at the next line. Does
somebody know why this is so, and if there is an elegant way to solve
this problem that does not involve temporary variables?
B.