This is the mail archive of the
mailing list for the GCC project.
const reference bug - Is there anyone out there?
- To: egcs-bugs at cygnus dot com
- Subject: const reference bug - Is there anyone out there?
- From: Hyman Rosen <hymie at prolifics dot com>
- Date: Tue, 18 Aug 1998 14:47:39 -0400
I've reported the following bug several times, but have seen absolutely
no responses, so I don't know whether it's being ignored, or whether it's
been filed away for future examination. Could someone please say?
The compiler allows a reference to pointer to const T to be directly
initialized with a pointer to T. This breaks const-correctness, and
allows const objects to be silently modified. Here's the test case:
extern "C" int printf(const char *, ...);
volatile const int c = 42;
volatile int *p;
volatile const int *&r = p;
r = &c;
*p = 0;
if (c != 42)