diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2001-07-26 08:15:43 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2001-07-26 08:15:43 +0000 |
commit | 312b7c9dd9f2cc098788d5218e856a83ac0c22ae (patch) | |
tree | d9b05bb0215dfb18744a44da3abe262e1e935ed1 /gcc | |
parent | 648c220695b109476bae09a887821030f78bcaa1 (diff) | |
download | gcc-312b7c9dd9f2cc098788d5218e856a83ac0c22ae.zip gcc-312b7c9dd9f2cc098788d5218e856a83ac0c22ae.tar.gz gcc-312b7c9dd9f2cc098788d5218e856a83ac0c22ae.tar.bz2 |
spew.c (yylex): Only copy the token's lineno, if it is non-zero.
cp:
* spew.c (yylex): Only copy the token's lineno, if it is
non-zero.
testsuite:
* g++.old-deja/g++.other/lineno5.C: New test.
From-SVN: r44391
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/spew.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/lineno5.C | 19 |
4 files changed, 35 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 949dd82..dd1be64 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2001-07-26 Nathan Sidwell <nathan@codesourcery.com> + * spew.c (yylex): Only copy the token's lineno, if it is + non-zero. + +2001-07-26 Nathan Sidwell <nathan@codesourcery.com> + PR c++/3624 * call.c (resolve_args): Simplify, call convert_from_reference. diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c index 7a92d9d..28b2323 100644 --- a/gcc/cp/spew.c +++ b/gcc/cp/spew.c @@ -833,8 +833,13 @@ yylex () got_object = NULL_TREE; yychar = yychr; - yylval = nth_token (0)->yylval; - lineno = nth_token (0)->lineno; + { + struct token *tok = nth_token (0); + + yylval = tok->yylval; + if (tok->lineno) + lineno = tok->lineno; + } #ifdef SPEW_DEBUG if (spew_debug) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55f597f..f2354d4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2001-07-26 Nathan Sidwell <nathan@codesourcery.com> + * g++.old-deja/g++.other/lineno5.C: New test. + +2001-07-26 Nathan Sidwell <nathan@codesourcery.com> + * g++.old-deja/g++.pt/crash68.C: New test. 2001-07-26 Nathan Sidwell <nathan@codesourcery.com> diff --git a/gcc/testsuite/g++.old-deja/g++.other/lineno5.C b/gcc/testsuite/g++.old-deja/g++.other/lineno5.C new file mode 100644 index 0000000..dc779ed --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lineno5.C @@ -0,0 +1,19 @@ +// Build don't link: +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 25 Jul 2001 <nathan@codesourcery.com> + +// Origin: johanb@DoCS.UU.SE +// Bug 3621. At the end of saved input, we'd set the lineno to +// zero. This would confusing things no end, if there was a subsequent +// error. + +namespace tmp { + typedef int B; + B b; +} + +class A { + public: + int kaka(tmp::B = b); // ERROR - no b in scope +}; |