C++ PATCH: PR 13927
Mark Mitchell
mark@codesourcery.com
Sat Feb 21 00:39:00 GMT 2004
This patch fixes PR 13927, whereby we issued a duplicate error
message.
Tested on i686-pc-linux-gnu, applied on the mainline.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
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-20 Mark Mitchell <mark@codesourcery.com>
PR c++/14173
* g++.dg/ext/packed5.C: New test.
PR c++/14199
* g++.dg/warn/Wunused-5.C: New test.
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.830
diff -c -5 -p -r1.830 pt.c
*** cp/pt.c 14 Feb 2004 11:28:59 -0000 1.830
--- cp/pt.c 20 Feb 2004 08:44:04 -0000
*************** tsubst_copy (tree t, tree args, tsubst_f
*** 7379,7388 ****
--- 7382,7392 ----
switch (code)
{
case PARM_DECL:
r = retrieve_local_specialization (t);
my_friendly_assert (r != NULL, 20020903);
+ mark_used (r);
return r;
case CONST_DECL:
{
tree enum_type;
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.388
diff -c -5 -p -r1.388 semantics.c
*** cp/semantics.c 3 Feb 2004 17:59:54 -0000 1.388
--- cp/semantics.c 20 Feb 2004 08:44:04 -0000
*************** begin_class_definition (tree t)
*** 2040,2050 ****
pushtag (TYPE_IDENTIFIER (t), t, 0);
}
maybe_process_partial_specialization (t);
pushclass (t);
TYPE_BEING_DEFINED (t) = 1;
! TYPE_PACKED (t) = flag_pack_struct;
/* Reset the interface data, at the earliest possible
moment, as it might have been set via a class foo;
before. */
if (! TYPE_ANONYMOUS_P (t))
{
--- 2040,2059 ----
pushtag (TYPE_IDENTIFIER (t), t, 0);
}
maybe_process_partial_specialization (t);
pushclass (t);
TYPE_BEING_DEFINED (t) = 1;
! 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. */
if (! TYPE_ANONYMOUS_P (t))
{
Index: testsuite/g++.dg/ext/packed5.C
===================================================================
RCS file: testsuite/g++.dg/ext/packed5.C
diff -N testsuite/g++.dg/ext/packed5.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/ext/packed5.C 20 Feb 2004 08:44:09 -0000
***************
*** 0 ****
--- 1,16 ----
+ // PR c++/14173
+
+ struct A;
+
+ void foo(const A&);
+
+ struct A
+ {
+ A(const A&);
+ };
+
+ struct B
+ {
+ A a;
+ A bar() { return a; }
+ };
Index: testsuite/g++.dg/warn/Wunused-5.C
===================================================================
RCS file: testsuite/g++.dg/warn/Wunused-5.C
diff -N testsuite/g++.dg/warn/Wunused-5.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/warn/Wunused-5.C 20 Feb 2004 08:56:26 -0000
***************
*** 0 ****
--- 1,13 ----
+ // 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 &);
More information about the Gcc-patches
mailing list