This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8143: g++ gives an ice
- From: Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: ruggero at wam dot umd dot edu, gcc-gnats at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: Fri, 11 Oct 2002 00:24:14 +0200
- Subject: Re: c++/8143: g++ gives an ice
Hi,
the parser chokes on the following illegal code snippet (X is
undefined):
---------------------------snip here---------------------------
struct foo
{
X x;
foo(X) {}
foo(X y, int) : x() {}
};
---------------------------snip here---------------------------
The error messages with gcc 3.1 are:
bug.cc:3: 'X' is used as a type, but is not defined as a type.
bug.cc:5: parse error before `)' token
bug.cc:5: missing ';' before right brace
bug.cc:6: `X' was not declared in this scope
bug.cc:6: parse error before `,' token
bug.cc:6: ISO C++ forbids defining types within return type
bug.cc:6: semicolon missing after declaration of `struct foo'
bug.cc: In function `int foo(...)':
bug.cc:6: only constructors take base initializers
bug.cc:6: confused by earlier errors, bailing out
Gcc 2.95.x and 3.0.x handle the situation gracefully. Gcc 3.1 and 3.2
produce "confused by earlier errors, bailing out" and the main trunk
ICEs (checked on i686-pc-linux-gnu and mips-sgi-irix6.5).
Greetings,
Volker Reichelt
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8143