diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e0ad92a9e7b..8c2b64117c3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,9 +1,30 @@ +Fri Dec 27 10:31:40 1996 Paul Eggert + + * Make-lang.in (g++spec.o): Don't use $< with an explicit target; + this isn't portable to some versions of `make' (e.g. Solaris 2.5.1). + +Tue Dec 24 10:24:03 1996 Jeffrey A Law (law@cygnus.com) + + * decl.c (grokvardecl): Avoid ANSI style initialization. + +Sun Dec 22 04:22:06 1996 Jason Merrill + + * pt.c (tsubst): Tweak arg types for a FUNCTION_TYPE. + +Fri Dec 20 17:09:25 1996 Jason Merrill + + * pt.c (instantiate_class_template): Call grok_{ctor,op}_properties. + Fri Dec 20 12:17:12 1996 Brendan Kehoe * g++spec.c (lang_specific_driver): Put missing hyphen in front of arguments we compare against. Start the count of I at 1, not 0, since argv[0] is still the command. +Thu Dec 19 11:53:57 1996 Stan Shebs + + * lang-specs.h: Accept .cp as an C++ extension. + Mon Dec 16 22:43:31 1996 Brendan Kehoe * cp-tree.h (ptr_reasonably_similar): Add decl. diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index c4400b346a4..d10f9779724 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -76,7 +76,7 @@ g++.c: $(srcdir)/gcc.c ln -s $(srcdir)/gcc.c $@ || cp $(srcdir)/gcc.c $@ g++spec.o: $(srcdir)/cp/g++spec.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/cp/g++spec.c # N.B.: This is a copy of the gcc.o rule, with -DLANG_SPECIFIC_DRIVER added. # It'd be nice if we could find an easier way to do this---rather than have diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 3ec8df67f65..4d8d60f8eef 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1947,6 +1947,7 @@ extern tree build_new_method_call PROTO((tree, tree, tree, tree, int)); extern tree build_user_type_conversion PROTO((tree, tree, int)); extern tree build_new_function_call PROTO((tree, tree, tree)); extern tree build_new_op PROTO((enum tree_code, int, tree, tree, tree)); +extern tree type_decays_to PROTO((tree)); /* in class.c */ extern tree build_vbase_pointer PROTO((tree, tree)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 43a60d6f051..6bb865c1b4d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7227,7 +7227,9 @@ grokvardecl (type, declarator, specbits_in, initialized, constp) int constp; { tree decl; - RID_BIT_TYPE specbits = *specbits_in; + RID_BIT_TYPE specbits; + + specbits = *specbits_in; if (TREE_CODE (type) == OFFSET_TYPE) { @@ -9935,7 +9937,7 @@ grok_ctor_properties (ctype, decl) if (TREE_CHAIN (parmtypes) != NULL_TREE && TREE_CHAIN (parmtypes) == void_list_node) { - cp_error ("invalid constructor; you probably meant `%T (%T&)'", + cp_error ("invalid constructor; you probably meant `%T (const %T&)'", ctype, ctype); SET_IDENTIFIER_ERROR_LOCUS (DECL_NAME (decl), ctype); diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h index fbb72c9ed97..b3b6c0b6833 100644 --- a/gcc/cp/lang-specs.h +++ b/gcc/cp/lang-specs.h @@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */ g++. */ {".cc", "@c++"}, + {".cp", "@c++"}, {".cxx", "@c++"}, {".cpp", "@c++"}, {".c++", "@c++"}, diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1a7d20efbba..76c10f73406 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1125,6 +1125,32 @@ instantiate_class_template (type) CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 1; } + TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern); + TYPE_HAS_DESTRUCTOR (type) = TYPE_HAS_DESTRUCTOR (pattern); + TYPE_HAS_ASSIGNMENT (type) = TYPE_HAS_ASSIGNMENT (pattern); + TYPE_OVERLOADS_CALL_EXPR (type) = TYPE_OVERLOADS_CALL_EXPR (pattern); + TYPE_OVERLOADS_ARRAY_REF (type) = TYPE_OVERLOADS_ARRAY_REF (pattern); + TYPE_OVERLOADS_ARROW (type) = TYPE_OVERLOADS_ARROW (pattern); + TYPE_GETS_NEW (type) = TYPE_GETS_NEW (pattern); + TYPE_GETS_DELETE (type) = TYPE_GETS_DELETE (pattern); + TYPE_VEC_DELETE_TAKES_SIZE (type) = TYPE_VEC_DELETE_TAKES_SIZE (pattern); + TYPE_HAS_ASSIGN_REF (type) = TYPE_HAS_ASSIGN_REF (pattern); + TYPE_HAS_CONST_ASSIGN_REF (type) = TYPE_HAS_CONST_ASSIGN_REF (pattern); + TYPE_HAS_ABSTRACT_ASSIGN_REF (type) = TYPE_HAS_ABSTRACT_ASSIGN_REF (pattern); + TYPE_HAS_INIT_REF (type) = TYPE_HAS_INIT_REF (pattern); + TYPE_HAS_CONST_INIT_REF (type) = TYPE_HAS_CONST_INIT_REF (pattern); + TYPE_GETS_INIT_AGGR (type) = TYPE_GETS_INIT_AGGR (pattern); + TYPE_HAS_DEFAULT_CONSTRUCTOR (type) = TYPE_HAS_DEFAULT_CONSTRUCTOR (pattern); + TYPE_HAS_CONVERSION (type) = TYPE_HAS_CONVERSION (pattern); + TYPE_USES_COMPLEX_INHERITANCE (type) + = TYPE_USES_COMPLEX_INHERITANCE (pattern); + TYPE_USES_MULTIPLE_INHERITANCE (type) + = TYPE_USES_MULTIPLE_INHERITANCE (pattern); + TYPE_USES_VIRTUAL_BASECLASSES (type) + = TYPE_USES_VIRTUAL_BASECLASSES (pattern); + TYPE_PACKED (type) = TYPE_PACKED (pattern); + TYPE_ALIGN (type) = TYPE_ALIGN (pattern); + { tree binfo = TYPE_BINFO (type); tree pbases = TYPE_BINFO_BASETYPES (pattern); @@ -1214,6 +1240,13 @@ instantiate_class_template (type) } TYPE_METHODS (type) = tsubst_chain (TYPE_METHODS (pattern), args); + for (t = TYPE_METHODS (type); t; t = TREE_CHAIN (t)) + { + if (DECL_CONSTRUCTOR_P (t)) + grok_ctor_properties (type, t); + else if (IDENTIFIER_OPNAME_P (DECL_NAME (t))) + grok_op_properties (t, DECL_VIRTUAL_P (t), 0); + } DECL_FRIENDLIST (TYPE_MAIN_DECL (type)) = tsubst (DECL_FRIENDLIST (TYPE_MAIN_DECL (pattern)), @@ -1242,32 +1275,6 @@ instantiate_class_template (type) } } - TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern); - TYPE_HAS_DESTRUCTOR (type) = TYPE_HAS_DESTRUCTOR (pattern); - TYPE_HAS_ASSIGNMENT (type) = TYPE_HAS_ASSIGNMENT (pattern); - TYPE_OVERLOADS_CALL_EXPR (type) = TYPE_OVERLOADS_CALL_EXPR (pattern); - TYPE_OVERLOADS_ARRAY_REF (type) = TYPE_OVERLOADS_ARRAY_REF (pattern); - TYPE_OVERLOADS_ARROW (type) = TYPE_OVERLOADS_ARROW (pattern); - TYPE_GETS_NEW (type) = TYPE_GETS_NEW (pattern); - TYPE_GETS_DELETE (type) = TYPE_GETS_DELETE (pattern); - TYPE_VEC_DELETE_TAKES_SIZE (type) = TYPE_VEC_DELETE_TAKES_SIZE (pattern); - TYPE_HAS_ASSIGN_REF (type) = TYPE_HAS_ASSIGN_REF (pattern); - TYPE_HAS_CONST_ASSIGN_REF (type) = TYPE_HAS_CONST_ASSIGN_REF (pattern); - TYPE_HAS_ABSTRACT_ASSIGN_REF (type) = TYPE_HAS_ABSTRACT_ASSIGN_REF (pattern); - TYPE_HAS_INIT_REF (type) = TYPE_HAS_INIT_REF (pattern); - TYPE_HAS_CONST_INIT_REF (type) = TYPE_HAS_CONST_INIT_REF (pattern); - TYPE_GETS_INIT_AGGR (type) = TYPE_GETS_INIT_AGGR (pattern); - TYPE_HAS_DEFAULT_CONSTRUCTOR (type) = TYPE_HAS_DEFAULT_CONSTRUCTOR (pattern); - TYPE_HAS_CONVERSION (type) = TYPE_HAS_CONVERSION (pattern); - TYPE_USES_COMPLEX_INHERITANCE (type) - = TYPE_USES_COMPLEX_INHERITANCE (pattern); - TYPE_USES_MULTIPLE_INHERITANCE (type) - = TYPE_USES_MULTIPLE_INHERITANCE (pattern); - TYPE_USES_VIRTUAL_BASECLASSES (type) - = TYPE_USES_VIRTUAL_BASECLASSES (pattern); - TYPE_PACKED (type) = TYPE_PACKED (pattern); - TYPE_ALIGN (type) = TYPE_ALIGN (pattern); - if (! uses_template_parms (type)) { tree tmp; @@ -1803,8 +1810,8 @@ tsubst (t, args, nargs, in_decl) for (; values && values != void_list_node; values = TREE_CHAIN (values)) { - tree value - = tsubst (TREE_VALUE (values), args, nargs, in_decl); + tree value = TYPE_MAIN_VARIANT (type_decays_to + (tsubst (TREE_VALUE (values), args, nargs, in_decl))); tree purpose = tsubst_expr (TREE_PURPOSE (values), args, nargs, in_decl); tree x = build_tree_list (purpose, value);