diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-02-20 08:57:33 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-02-20 08:57:33 +0000 |
commit | c0694c4b781c1c4e961ef74f1a70c0df7a6b67b6 (patch) | |
tree | 805d38b660862895cfdc82561ded42eea78f8a55 /gcc/cp | |
parent | 15316a6f7639a7173c375d8c3d0e24957982f27e (diff) | |
download | gcc-c0694c4b781c1c4e961ef74f1a70c0df7a6b67b6.zip gcc-c0694c4b781c1c4e961ef74f1a70c0df7a6b67b6.tar.gz gcc-c0694c4b781c1c4e961ef74f1a70c0df7a6b67b6.tar.bz2 |
re PR c++/14199 (Unjustified warning about unused variable)
PR c++/14199
* pt.c (tsubst_copy): Call mark_used for a PARM_DECL.
PR c++/14173
* semantics.c (begin_class_definition): Set TYPE_PACKED correctly
for all type variants.
PR c++/14173
* g++.dg/ext/packed5.C: New test.
PR c++/14199
* g++.dg/warn/Wunused-5.C: New test.
PR c++/13927
* decl.c (duplicate_decls): Return error_mark_node for invalid
redeclarations.
* name-lookup.c (push_namespace): Ignore the return value from
pushdecl.
* pt.c (push_template_decl_real): Robustify.
PR c++/13927
* g++.dg/other/error8.C: Remove XFAIL markers.
From-SVN: r78159
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/cp/decl.c | 5 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 2 | ||||
-rw-r--r-- | gcc/cp/pt.c | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 11 |
5 files changed, 32 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d1dea6d..e3f51e9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,21 @@ +2004-02-20 Mark Mitchell <mark@codesourcery.com> + + PR c++/14199 + * pt.c (tsubst_copy): Call mark_used for a PARM_DECL. + + PR c++/14173 + * semantics.c (begin_class_definition): Set TYPE_PACKED correctly + for all type variants. + 2004-02-19 Mark Mitchell <mark@codesourcery.com> + PR c++/13927 + * decl.c (duplicate_decls): Return error_mark_node for invalid + redeclarations. + * name-lookup.c (push_namespace): Ignore the return value from + pushdecl. + * pt.c (push_template_decl_real): Robustify. + PR c++/14186 * name-lookup.c (push_class_level_binding): Do not complain about adding a binding for a member whose name is the same as the diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f3821c3..1db274e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1319,10 +1319,7 @@ duplicate_decls (tree newdecl, tree olddecl) olddecl = TREE_VALUE (olddecl); cp_error_at ("previous declaration of `%#D'", olddecl); - /* New decl is completely inconsistent with the old one => - tell caller to replace the old one. */ - - return NULL_TREE; + return error_mark_node; } else if (!types_match) { diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index e823ae3..be1b822 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3080,7 +3080,7 @@ push_namespace (tree name) /* Make a new namespace, binding the name to it. */ d = build_lang_decl (NAMESPACE_DECL, name, void_type_node); DECL_CONTEXT (d) = FROB_CONTEXT (current_namespace); - d = pushdecl (d); + pushdecl (d); if (anon) { /* Clear DECL_NAME for the benefit of debugging back ends. */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 779347b..1f97a53 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2774,6 +2774,9 @@ push_template_decl_real (tree decl, int is_friend) int is_partial; int new_template_p = 0; + if (decl == error_mark_node) + return decl; + /* See if this is a partial specialization. */ is_partial = (DECL_IMPLICIT_TYPEDEF_P (decl) && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE @@ -7381,6 +7384,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) case PARM_DECL: r = retrieve_local_specialization (t); my_friendly_assert (r != NULL, 20020903); + mark_used (r); return r; case CONST_DECL: diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 511c7bc..b7a7f4a 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2042,7 +2042,16 @@ begin_class_definition (tree t) maybe_process_partial_specialization (t); pushclass (t); TYPE_BEING_DEFINED (t) = 1; - TYPE_PACKED (t) = flag_pack_struct; + if (flag_pack_struct) + { + tree v; + TYPE_PACKED (t) = 1; + /* Even though the type is being defined for the first time + here, there might have been a forward declaration, so there + might be cv-qualified variants of T. */ + for (v = TYPE_NEXT_VARIANT (t); v; v = TYPE_NEXT_VARIANT (v)) + TYPE_PACKED (v) = 1; + } /* Reset the interface data, at the earliest possible moment, as it might have been set via a class foo; before. */ |