diff options
| author | Mark Mitchell <mark@codesourcery.com> | 2006-05-19 16:04:22 +0000 |
|---|---|---|
| committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2006-05-19 16:04:22 +0000 |
| commit | eaf6fb906eb9e8807f068dd917a738523382bfe2 (patch) | |
| tree | 87a70819ab712edee728af13b2ec95fe70702bdf /gcc/cp/semantics.c | |
| parent | affaef6e07c544cef985d95e213b6942fe1988da (diff) | |
| download | gcc-eaf6fb906eb9e8807f068dd917a738523382bfe2.zip gcc-eaf6fb906eb9e8807f068dd917a738523382bfe2.tar.gz gcc-eaf6fb906eb9e8807f068dd917a738523382bfe2.tar.bz2 | |
re PR c++/26433 (Syntax error using __FUNCTION__ in catch handler)
PR c++/26433
* cp-tree.h (begin_function_try_block): Change prototype.
(finish_function_handler_sequence): Likewise.
* parser.c (cp_parser_function_try_block): Adjust calls.
* pt.c (tsubst_expr): Adjust calls.
* semantics.c (begin_function_try_block): Create an artificial
outer scope.
(finish_function_handler_sequence): Close it.
PR c++/26433
* g++.dg/template/fntry1.C: New test.
From-SVN: r113911
Diffstat (limited to 'gcc/cp/semantics.c')
| -rw-r--r-- | gcc/cp/semantics.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index f7a3b40..6af4564 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -975,12 +975,18 @@ begin_try_block (void) return r; } -/* Likewise, for a function-try-block. */ +/* Likewise, for a function-try-block. The block returned in + *COMPOUND_STMT is an artificial outer scope, containing the + function-try-block. */ tree -begin_function_try_block (void) +begin_function_try_block (tree *compound_stmt) { - tree r = begin_try_block (); + tree r; + /* This outer scope does not exist in the C++ standard, but we need + a place to put __FUNCTION__ and similar variables. */ + *compound_stmt = begin_compound_stmt (0); + r = begin_try_block (); FN_TRY_BLOCK_P (r) = 1; return r; } @@ -1034,13 +1040,16 @@ finish_handler_sequence (tree try_block) check_handlers (TRY_HANDLERS (try_block)); } -/* Likewise, for a function-try-block. */ +/* Finish the handler-seq for a function-try-block, given by + TRY_BLOCK. COMPOUND_STMT is the outer block created by + begin_function_try_block. */ void -finish_function_handler_sequence (tree try_block) +finish_function_handler_sequence (tree try_block, tree compound_stmt) { in_function_try_handler = 0; finish_handler_sequence (try_block); + finish_compound_stmt (compound_stmt); } /* Begin a handler. Returns a HANDLER if appropriate. */ |
