Bug 40224 - [4.3/4.4/4.5 regression] g++ Accepting invalid code
Summary: [4.3/4.4/4.5 regression] g++ Accepting invalid code
Status: RESOLVED DUPLICATE of bug 41131
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.3.5
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2009-05-22 14:56 UTC by Sergei Larin
Modified: 2009-08-31 16:45 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.0.1
Last reconfirmed: 2009-08-25 15:49:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Larin 2009-05-22 14:56:49 UTC
g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-threads=posix --prefix=/prj/dsp/qdsp6_aus/users/slarin/x86_gcc_4.4/bin --enable-languages=c,c++ --disable-checking
Thread model: posix
gcc version 4.4.0 (GCC)

Accepts the following code:

class X {
public:
	enum enumX { a=100 };
};

int main(void)
{
	X x;

	(void) &x.a;	// should not compile
}

It should not. This version:

gcc -v
Reading specs from /usr/***specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib64 --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit x86_64-suse-linux
Thread model: posix
gcc version 3.3.3 (SuSE Linux)

Correctly produces the following error:

fe1.cc: In function `int main()':
fe1.cc:12: error: non-lvalue in unary `&'
Comment 1 Wolfgang Bangerth 2009-08-25 15:49:33 UTC
Confirmed.
Comment 2 Jakub Jelinek 2009-08-31 16:45:29 UTC

*** This bug has been marked as a duplicate of 41131 ***