diff options
author | Richard Henderson <rth@redhat.com> | 2005-09-11 21:04:03 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-09-11 21:04:03 -0700 |
commit | 56b4ea3de8efa797ff0edf9504704803d2ae4981 (patch) | |
tree | 64e5cc4d84872a31748d1d4ba6500f40fa9fbad3 /gcc | |
parent | f489aff87aa4c15ffe681cfcaede591c533b331e (diff) | |
download | gcc-56b4ea3de8efa797ff0edf9504704803d2ae4981.zip gcc-56b4ea3de8efa797ff0edf9504704803d2ae4981.tar.gz gcc-56b4ea3de8efa797ff0edf9504704803d2ae4981.tar.bz2 |
decl2.c (build_anon_union_vars): Copy attributes from the base addr.
* decl2.c (build_anon_union_vars): Copy attributes from the base addr.
* pt.c (tsubst_decl): Substitute in DECL_VALUE_EXPR.
* g++.dg/other/error8.C: Update expected diagnostic text.
From-SVN: r104160
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 12 | ||||
-rw-r--r-- | gcc/cp/pt.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/error8.C | 8 |
5 files changed, 27 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 012b6e2..4ea174c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-09-11 Richard Henderson <rth@redhat.com> + + * decl2.c (build_anon_union_vars): Copy attributes from the base addr. + * pt.c (tsubst_decl): Substitute in DECL_VALUE_EXPR. + 2005-09-09 Gabriel Dos Reis <gdr@integrable-solutions.net> * parser.c (cp_parser_translation_unit): Simplify. The while-block diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 8ef6fa8..c2a90fc 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1101,12 +1101,18 @@ build_anon_union_vars (tree type, tree object) if (DECL_NAME (field)) { + tree base; + decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field)); - TREE_PUBLIC (decl) = TREE_PUBLIC (object); - TREE_STATIC (decl) = TREE_PUBLIC (object); - DECL_EXTERNAL (decl) = DECL_EXTERNAL (object); + + base = get_base_address (object); + TREE_PUBLIC (decl) = TREE_PUBLIC (base); + TREE_STATIC (decl) = TREE_STATIC (base); + DECL_EXTERNAL (decl) = DECL_EXTERNAL (base); + SET_DECL_VALUE_EXPR (decl, ref); DECL_HAS_VALUE_EXPR_P (decl) = 1; + decl = pushdecl (decl); } else if (ANON_AGGR_TYPE_P (TREE_TYPE (field))) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f78da93..85e8cb8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6674,6 +6674,13 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (r) = DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (t); type = check_var_type (DECL_NAME (r), type); + + if (DECL_HAS_VALUE_EXPR_P (t)) + { + tree ve = DECL_VALUE_EXPR (t); + ve = tsubst_expr (ve, args, complain, in_decl); + SET_DECL_VALUE_EXPR (r, ve); + } } else if (DECL_SELF_REFERENCE_P (t)) SET_DECL_SELF_REFERENCE_P (r); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b374e8..a4b62de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-09-11 Richard Henderson <rth@redhat.com> + + * g++.dg/other/error8.C: Update expected diagnostic text. + 2005-09-11 Francois-Xavier Coudert <coudert@clipper.ens.fr> PR libfortran/19872 diff --git a/gcc/testsuite/g++.dg/other/error8.C b/gcc/testsuite/g++.dg/other/error8.C index 1ccfe99..9246c2a 100644 --- a/gcc/testsuite/g++.dg/other/error8.C +++ b/gcc/testsuite/g++.dg/other/error8.C @@ -5,8 +5,8 @@ void foo(void) { - union { int alpha; int beta; }; // { dg-error "previous declaration of 'int alpha'" } - double alpha; // { dg-error "redeclared" } + union { int alpha; int beta; }; // { dg-error "previous declaration" } + double alpha; // { dg-error "conflicting declaration" } } // This checks both the templated version, and the position of the diagnostic @@ -20,7 +20,3 @@ void tfoo(void) }; // { dg-bogus "" "misplaced position of the declaration" { xfail *-*-* } } double alpha; // { dg-error "" "" } } - -// The duplicated error messages are xfailed for now (tracked in the PR) -// { dg-bogus "" "duplicate error messages" { target *-*-* } 8 } -// { dg-bogus "" "duplicate error messages" { target *-*-* } 9 } |