g++ bug(?) handling initialization.

Sergei Organov osv@javad.ru
Fri Oct 10 07:33:00 GMT 1997


Hello,

I compile the following simple code:

> cat test.cc

class A {
public:
  A();
};

class B {
public:
  B(A const ?);
  void f();
};

void foo()
{
  B b(A());
  b.f(); // Error occurs here
}

And get the following result from both 'egcs' and FSF g++:

> g++ -c test.cc -o test.o
test.cc: In function `void foo()':
test.cc:16: request for member `f' in `b(A (*)())', which is
of non-aggregate type `B ()(A (*)())'

I just couldn't imagine where the compiler got `B ()(A (*)())'
type for 'b'?

Is it a bug or am I missing something?

BR,
Sergei Organov.




More information about the Gcc-bugs mailing list