From cac78ea2814a35a8e797ba0ed6ab1f24531df18a Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 22 Nov 2000 22:43:49 +0000 Subject: [PATCH] pt.c (do_decl_instantiate): Explicitly clone constructors and destructors that haven't already been cloned. * pt.c (do_decl_instantiate): Explicitly clone constructors and destructors that haven't already been cloned. From-SVN: r37673 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 9 +++++++++ gcc/testsuite/g++.old-deja/g++.other/ctor1-aux.cc | 12 ++++++++++++ gcc/testsuite/g++.old-deja/g++.other/ctor1.C | 14 ++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/ctor1-aux.cc create mode 100644 gcc/testsuite/g++.old-deja/g++.other/ctor1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bc73be5a6f49..ef02d3d889ad 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-11-22 Mark Mitchell + + * pt.c (do_decl_instantiate): Explicitly clone constructors and + destructors that haven't already been cloned. + 2000-11-20 Richard Henderson * parse.y (yyparse_1): Rename the parser entry point. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3327110f949b..ddcdf8a43317 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9214,6 +9214,15 @@ do_decl_instantiation (declspecs, declarator, storage) cp_error ("storage class `%D' applied to template instantiation", storage); + /* Under the new ABI, we need to make sure to instantiate all the + cloned versions of constructors or destructors. */ + if (flag_new_abi && + (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (result) || + DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (result)) && + !(TREE_CHAIN (result) && + DECL_CLONED_FUNCTION (TREE_CHAIN (result)))) + clone_function_decl(result, /*update_method_vec_p=*/0); + SET_DECL_EXPLICIT_INSTANTIATION (result); mark_decl_instantiated (result, extern_p); repo_template_instantiated (result, extern_p); diff --git a/gcc/testsuite/g++.old-deja/g++.other/ctor1-aux.cc b/gcc/testsuite/g++.old-deja/g++.other/ctor1-aux.cc new file mode 100644 index 000000000000..9990ca29322d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/ctor1-aux.cc @@ -0,0 +1,12 @@ +// Origin: Mark Mitchell + +template +struct S { + template + S (U); +}; + +int main () +{ + S (3.0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/ctor1.C b/gcc/testsuite/g++.old-deja/g++.other/ctor1.C new file mode 100644 index 000000000000..1c67d0aa8465 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/ctor1.C @@ -0,0 +1,14 @@ +// Additional sources: ctor1-aux.cc +// Origin: Mark Mitchell + +template +struct S { + template + S (U); +}; + +template +template +S::S (U) {} + +template S::S (double); -- 2.43.5