Misleading typo in C++ error

Peter Bienstman Peter.Bienstman@rug.ac.be
Wed Jan 26 06:39:00 GMT 2000


Hi,

Compiling the following snippet (2.95.2)

class A {};
class B : public A {};

void f(const A& a)
{
  dynamic_cast<B*>(&a);

  const A a2;
  dynamic_cast<B*>(&a2);
}

leads to

error.cpp: In function `void f(const A &)':
error.cpp:6: cannot dynamic_cast `+a' (of type `const class A *') to type
`class B*'
error.cpp:8: uninitialized const `a2'
error.cpp:9: cannot dynamic_cast `&a2' (of type `const class A *') to type
`class B*'

I suppose the error message on line 6 should print '&a' instead of `+a',
just as it does on line 9?

Peter

-------------------------------------
Peter Bienstman
Department of Information Technology
INTEC/IMEC - University of Gent
St.-Pietersnieuwstraat 41
B-9000 Gent - Belgium
E-mail: Peter.Bienstman@rug.ac.be
Tel: +32 9 264 3445
Fax: +32 9 264 3593
-------------------------------------



More information about the Gcc-bugs mailing list