+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
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)
{
/* 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. */
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
case PARM_DECL:
r = retrieve_local_specialization (t);
my_friendly_assert (r != NULL, 20020903);
+ mark_used (r);
return r;
case CONST_DECL:
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. */
-2004-02-19 Mark Mitchell <mark@codesourcery.com>
+2004-02-20 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/13927
+ * g++.dg/other/error8.C: Remove XFAIL markers.
+
+ PR c++/14173
+ * g++.dg/ext/packed5.C: New test.
+
+ PR c++/14199
+ * g++.dg/warn/Wunused-5.C: New test.
PR c++/14186
* g++.dg/lookup/member1.C: New test.
--- /dev/null
+// PR c++/14173
+
+struct A;
+
+void foo(const A&);
+
+struct A
+{
+ A(const A&);
+};
+
+struct B
+{
+ A a;
+ A bar() { return a; }
+};
void foo(void)
{
- union { int alpha; int beta; }; // { dg-error "previous declaration `int alpha'" }
- double alpha; // { dg-error "declaration of" }
+ union { int alpha; int beta; }; // { dg-error "previous declaration of `int alpha'" }
+ double alpha; // { dg-error "redeclared" }
}
// This checks both the templated version, and the position of the diagnostic
}
// The duplicated error messages are xfailed for now (tracked in the PR)
-// { dg-bogus "" "duplicate error messages" { xfail *-*-* } 8 }
-// { dg-bogus "" "duplicate error messages" { xfail *-*-* } 9 }
+// { dg-bogus "" "duplicate error messages" { target *-*-* } 8 }
+// { dg-bogus "" "duplicate error messages" { target *-*-* } 9 }
--- /dev/null
+// PR c++/14199
+// { dg-options "-W -Wall -Wunused" }
+
+struct X {
+ static void foo ();
+};
+
+template <typename T>
+void foo (const T &t) {
+ t.foo();
+}
+
+template void foo (const X &);