parse error in throw(A())

Nathan Sidwell nathan@acm.org
Mon Nov 23 13:26:00 GMT 1998


Hi,

the following gives a parse error on the final throw
--begin parsethrow.ii
struct A
{
  A::A(int);
  A::A();
};
void fn()
{
  throw(int(5));
  throw(A(5));
  throw(A());
}
--end parsethrow.ii

here's the transcript
nathan@laie:1871>ss-g++ -c -v parsethrow.ii 
Reading specs from
/home/staff/nathan/solaris/local/sparc-SunOS_5/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.92.23/specs
gcc version egcs-2.92.23 19981122 (gcc2 ss-980609 experimental)

/home/staff/nathan/solaris/local/sparc-SunOS_5/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.92.23/cc1plus
parsethrow.ii -quiet -version -o /var/tmp/cc1dDaLH.s
GNU C++ version egcs-2.92.23 19981122 (gcc2 ss-980609 experimental)
(sparc-sun-solaris2.5.1) compiled by GNU C version egcs-2.91.57 19980901
(egcs-1.1 release).
parsethrow.ii: In function `void fn()':
parsethrow.ii:10: parse error before `;'

throw <expr> is ok provided expr isn't surrounded in parentheses, or is
a non-default constructor. It blows up on a parenthesized default
constructor.

Yes, I know the workaround. Just thought I'd report it.

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk



More information about the Gcc-bugs mailing list