This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/10481: Invalid use of non-static data member causes ICE.
- From: redi at gcc dot gnu dot org
- To: gcc-gnats at gcc dot gnu dot org
- Date: Thu, 24 Apr 2003 14:14:32 +0100 (BST)
- Subject: c++/10481: Invalid use of non-static data member causes ICE.
>Number: 10481
>Category: c++
>Synopsis: Invalid use of non-static data member causes ICE.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-illegal-code
>Submitter-Id: net
>Arrival-Date: Thu Apr 24 13:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Jonathan Wakely
>Release: 3.4 20030422 (experimental)
>Organization:
>Environment:
System: FreeBSD buffy.mintel.co.uk 4.8-RC-20030314-JPSNAP FreeBSD 4.8-RC-20030314-JPSNAP #0: Mon Mar 17 13:41:48 GMT 2003 jason at buffy dot mintel dot co dot uk:/usr/src/sys/compile/BUFFY i386
host: i386-unknown-freebsd4.8
build: i386-unknown-freebsd4.8
target: i386-unknown-freebsd4.8
configured with: /home/jw/src/cvs/gcc/configure --prefix=/home/jw --program-prefix=x --enable-languages=c,c++ : (reconfigured) /home/jw/src/cvs/gcc/configure --prefix=/home/jw/gcc33/ --enable-languages=c,c++ : (reconfigured) /home/jw/src/cvs/gcc/configure --prefix=/home/jw/gcc3/ --enable-languages=c,c++
>Description:
If you compile the code below the first error in function f() correctly
issues a diagnostic about invalid use of a non-static data member, but the
second function, B::f() causes an ICE. The only difference is that one
function is a class member.
>How-To-Repeat:
struct A
{
char a;
};
struct B
{
void f(const A&) const;
};
void f(const A& a)
{
unsigned s = sizeof(A::a); // ERROR -> diagnostic
}
void B::f(const A& a) const
{
unsigned s = sizeof(A::a); // ERROR -> ICE
}
>Fix:
Don't write bad code.
>Release-Note:
>Audit-Trail:
>Unformatted: