This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/96: Re: No warning with uninitialised reference...
- To: gcc-gnats at sourceware dot cygnus dot com
- Subject: c++/96: Re: No warning with uninitialised reference...
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Sat, 11 Mar 2000 00:07:44 +0100
- References: <200003102044.PAA16180@shell.oh.voyager.net>
- Resent-Cc: gcc-prs at gcc dot gnu dot org, ao at infinet dot com
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, "Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>
>Number: 96
>Category: c++
>Synopsis: No warning with uninitialised reference...
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: analyzed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 10 15:26:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: ao@infinet.com
>Release: 2.95.2
>Organization:
>Environment:
>Description:
Original-Message-Id: <200003102044.PAA16180@shell.oh.voyager.net>
Date: Fri, 10 Mar 2000 15:44:12 -0500 (EST)
Hi,
The following code fails to give a warning about using an uninitialised
reference. While the code is obviously incorrect, this cost me a lot of
time trying to debug a crashing server. Please note that I am not at all
being critical of the work done on gcc, but I would like to note that an
error such as this is very difficult to track until you actually notice
the incorrect code...
Regards,
/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); // <-- the second "var" should be "x"
return var.fn2();
};
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: