diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-06-16 17:48:05 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-06-16 17:48:05 +0000 |
commit | 1b5f5f763a803b26effc0d8839189dfd702cc392 (patch) | |
tree | e804560654f45478defb7ef6556ef0b17b4593c9 | |
parent | 78d114ef2d4ab348ab5446b9fc29da04c65de7ac (diff) | |
download | gcc-1b5f5f763a803b26effc0d8839189dfd702cc392.zip gcc-1b5f5f763a803b26effc0d8839189dfd702cc392.tar.gz gcc-1b5f5f763a803b26effc0d8839189dfd702cc392.tar.bz2 |
decl2.c (import_export_decl): Use same_type_p, rather than relying on pointer-equality for types.
* decl2.c (import_export_decl): Use same_type_p, rather than
relying on pointer-equality for types.
* method.c (do_build_copy_constructor): Simplify.
From-SVN: r27555
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 5 | ||||
-rw-r--r-- | gcc/cp/method.c | 37 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.eh/catch2.C | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/copy2.C | 21 |
5 files changed, 48 insertions, 31 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4336252..1037548 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 1999-06-16 Mark Mitchell <mark@codesourcery.com> + * decl2.c (import_export_decl): Use same_type_p, rather than + relying on pointer-equality for types. + + * method.c (do_build_copy_constructor): Simplify. + * call.c (build_method_call): Remove bogus code for two-argument delete. * init.c (build_new_1): Expand on comment, and remove dead code. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 793a974..3b09993 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2807,7 +2807,7 @@ import_export_decl (decl) since it will not be emitted when the vtable for the type is output (which is when the unqualified version is generated). */ - && ctype == TYPE_MAIN_VARIANT (ctype)) + && same_type_p (ctype, TYPE_MAIN_VARIANT (ctype))) { DECL_NOT_REALLY_EXTERN (decl) = ! (CLASSTYPE_INTERFACE_ONLY (ctype) @@ -2818,7 +2818,8 @@ import_export_decl (decl) if (flag_weak) comdat_linkage (decl); } - else if (TYPE_BUILT_IN (ctype) && ctype == TYPE_MAIN_VARIANT (ctype)) + else if (TYPE_BUILT_IN (ctype) + && same_type_p (ctype, TYPE_MAIN_VARIANT (ctype))) DECL_NOT_REALLY_EXTERN (decl) = 0; else comdat_linkage (decl); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index cf03013..caa3eb5 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2231,42 +2231,21 @@ do_build_copy_constructor (fndecl) tree binfos = TYPE_BINFO_BASETYPES (current_class_type); int i; + /* Initialize all the base-classes. */ for (t = CLASSTYPE_VBASECLASSES (current_class_type); t; t = TREE_CHAIN (t)) - { - tree basetype = BINFO_TYPE (t); - tree p = convert_to_reference - (build_reference_type (basetype), parm, - CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE); - p = convert_from_reference (p); - - if (p == error_mark_node) - cp_error ("in default copy constructor"); - else - current_base_init_list = tree_cons (basetype, - p, current_base_init_list); - } - + current_base_init_list + = tree_cons (BINFO_TYPE (t), parm, current_base_init_list); for (i = 0; i < n_bases; ++i) { - tree p, basetype = TREE_VEC_ELT (binfos, i); - if (TREE_VIA_VIRTUAL (basetype)) + t = TREE_VEC_ELT (binfos, i); + if (TREE_VIA_VIRTUAL (t)) continue; - basetype = BINFO_TYPE (basetype); - p = convert_to_reference - (build_reference_type (basetype), parm, - CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE); - - if (p == error_mark_node) - cp_error ("in default copy constructor"); - else - { - p = convert_from_reference (p); - current_base_init_list = tree_cons (basetype, - p, current_base_init_list); - } + current_base_init_list + = tree_cons (BINFO_TYPE (t), parm, current_base_init_list); } + for (; fields; fields = TREE_CHAIN (fields)) { tree init, t; diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch2.C b/gcc/testsuite/g++.old-deja/g++.eh/catch2.C new file mode 100644 index 0000000..66c607a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/catch2.C @@ -0,0 +1,11 @@ +// Build don't link: +// Origin: Mike Danylchuk <miked@mpath.com> + +typedef char TCHAR; + +int main() +{ + try {} + catch( TCHAR* Err ) {} +} + diff --git a/gcc/testsuite/g++.old-deja/g++.other/copy2.C b/gcc/testsuite/g++.old-deja/g++.other/copy2.C new file mode 100644 index 0000000..2fb52a1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/copy2.C @@ -0,0 +1,21 @@ +// Origin: Mark Mitchell <mark@codesourcery.com> + +int i; + +struct B { + B () {} + B (B&) { i = 1; } + B (const B&) { i = 2; } +}; + +struct D : public B { + D () {} +}; + +int main () +{ + D d; + D d2 (d); + if (i != 2) + return 1; +} |