This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Missing warning...


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();
};



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]