[Bug c++/26644] New: const vs. almost-const
pentek_imre at mailbox dot hu
gcc-bugzilla@gcc.gnu.org
Sat Mar 11 14:35:00 GMT 2006
Hello, try to compile this code:
class G
{
public:
G();
~G();
bool test() const;
int *x;
};
G::G()
{
x=new int[7];
x[3]=99;
}
G::~G()
{
delete[] x;
}
bool G::test() const
{
x[3]--;
return true;
}
I used
g++ -W -Wall -ansi -pedantic G.cpp -c -o G.o
and it gives no errors, so *x isn't considered to be const, but IMHO it should
be.
I use this gcc:
Reading specs from /usr/lib/gcc/i586-uhu-linux/3.4.5/specs
Configured with: /var/uhubuild/work/compile/configure --prefix=/usr
--infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++
--enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib
--host=i586-uhu-linux
Thread model: posix
gcc version 3.4.5
--
Summary: const vs. almost-const
Product: gcc
Version: 3.4.5
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pentek_imre at mailbox dot hu
GCC host triplet: i586-uhu-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26644
More information about the Gcc-bugs
mailing list