Missing warning...

ao@infinet.com ao@infinet.com
Thu Jan 27 05:39:00 GMT 2000


Hi,

The following code fragment fails to warn about using an uninitialised
variable, which I believe it should. While the code is obviously
incorrect, a similar piece of code took me a while to track down
because the two variable names were almost identical.

The "bug" occurs in 2.95.2, both the solaris2.6(ultrasparc) and Linux
2.2(intel) versions.

/Mike

class foo
{
public:

  virtual void fn();
};

class bar : public foo
{
public:

  virtual void fn();
  int fn2();
};

int bug_fn(foo& x)
{
  bar& var = dynamic_cast<bar&>(var);
  return var.fn2();
};




More information about the Gcc-bugs mailing list