From 301e21af2c964ac3f7505d5bf9a45d2fe812ff29 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 19 Jan 2000 09:04:41 +0000 Subject: [PATCH] tree.c (bot_manip): Set DECL_CONTEXT for newly created VAR_DECLs. * tree.c (bot_manip): Set DECL_CONTEXT for newly created VAR_DECLs. From-SVN: r31498 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/tree.c | 8 ++++++-- .../g++.old-deja/g++.other/inline6.C | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/inline6.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5be6a0f51d0..32daf4ba007 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-01-19 Mark Mitchell + + * tree.c (bot_manip): Set DECL_CONTEXT for newly created + VAR_DECLs. + 2000-01-18 Nathan Sidwell * cp-tree.h (get_tinfo_fn_dynamic): Remove prototype. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 3bf874a8351..432ec29f39e 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1560,9 +1560,13 @@ bot_manip (tp, walk_subtrees, data) } else { + tree var; + u = copy_node (t); - TREE_OPERAND (u, 0) = build (VAR_DECL, TREE_TYPE (t)); - layout_decl (TREE_OPERAND (u, 0), 0); + var = build (VAR_DECL, TREE_TYPE (t)); + DECL_CONTEXT (var) = current_function_decl; + layout_decl (var, 0); + TREE_OPERAND (u, 0) = var; } /* Map the old variable to the new one. */ diff --git a/gcc/testsuite/g++.old-deja/g++.other/inline6.C b/gcc/testsuite/g++.old-deja/g++.other/inline6.C new file mode 100644 index 00000000000..06173629afa --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/inline6.C @@ -0,0 +1,19 @@ +// Build don't link: +// Special g++ Options: -O2 +// Origin: Mark Mitchell + +struct S +{ +}; + +void f (S s = S ()); + +inline void g () +{ + f (); +} + +void h () +{ + g (); +}