diff -Nrcpad gcc-4.4.1/gcc/cp/ChangeLog gcc-4.4.2/gcc/cp/ChangeLog *** gcc-4.4.1/gcc/cp/ChangeLog Wed Jul 22 07:29:16 2009 --- gcc-4.4.2/gcc/cp/ChangeLog Thu Oct 15 07:39:33 2009 *************** *** 1,3 **** --- 1,99 ---- + 2009-10-15 Release Manager + + * GCC 4.4.2 released. + + 2009-10-07 Jason Merrill + + PR c++/39863 + * pt.c (tsubst_pack_expansion): Don't do anything now if we + have incomplete packs of different lengths. + + PR c++/41038 + * tree.c (build_qualified_name): Call convert_from_reference. + + * pt.c (register_specialization): Push DECL_SOURCE_LOCATION to the + clones. + + * decl.c (grok_special_member_properties): Only adjust + TYPE_HAS_COMPLEX_* if the function is defaulted in the class body. + (cp_finish_decl): Push DECL_DELETED_FN/DECL_DEFAULTED_FN to the + clones. + + 2009-09-23 Dodji Seketeli + + PR debug/41065 + * decl.c (cp_finish_decl): Record the types used by the global + variable declaration we've just parsed. + + 2009-09-18 Jason Merrill + + * pt.c (get_pattern_parm): New. + (listify): Split out from... + (listify_autos): ...here. + (unify): Deduce std::initializer_list for T. + * call.c (build_over_call): Warn about it. + + 2009-09-09 Jack Howarth + + PR bootstrap/41180 + * Make-lang.in: Remove redundant code from linkage for darwin10. + + 2009-08-31 Jason Merrill + + PR c++/41127 + * parser.c (cp_parser_enum_specifier): Make sure the : is followed by a + type-specifier-seq before we commit. + + 2009-08-21 Jakub Jelinek + + PR c++/41131 + * tree.c (lvalue_p_1) : Return clk_none if + not TREE_STATIC. + + 2009-08-05 Jason Merrill + + PR c++/40948 + * init.c (build_vec_init): Evaluate the initializer before + starting the initialization try block. + + 2009-08-04 Dodji Seketeli + + PR c++/39987 + * pt.c (tsubst_default_argument): Let access checks of the + default argument happen in the context of the current function. + + 2009-08-04 Dodji Seketeli + + PR debug/39706 + * error.c (lang_decl_name): Print qualified names for decls + in namespace scope. + + 2009-08-03 Jason Merrill + Jakub Jelinek + + PR c++/40948 + * init.c (build_vec_init): Look through a TARGET_EXPR around a + CONSTRUCTOR. + + 2009-07-26 Simon Martin + + PR c++/40749 + * decl.c (grokdeclarator): Do not set TREE_NO_WARNING for functions + with a qualified return type. + + 2009-07-24 Jason Merrill + + Core issue 702 + * call.c (compare_ics): Give list-initialization of std::init_list + priority over conversion to scalar, too. + + 2009-07-21 Jason Merrill + + Core issue 934 + * call.c (reference_binding): Implement binding to { }. + (initialize_reference): Binding temporary to non-const && is fine. + * decl.c (grok_reference_init): Remove error for CONSTRUCTOR. + 2009-07-22 Release Manager * GCC 4.4.1 released. diff -Nrcpad gcc-4.4.1/gcc/cp/Make-lang.in gcc-4.4.2/gcc/cp/Make-lang.in *** gcc-4.4.1/gcc/cp/Make-lang.in Fri Dec 5 08:01:58 2008 --- gcc-4.4.2/gcc/cp/Make-lang.in Wed Sep 9 08:46:32 2009 *************** g++-cross$(exeext): g++$(exeext) *** 72,79 **** # Shared with C front end: CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \ ! incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \ ! c-gimplify.o c-omp.o tree-inline.o # Language-specific object files for C++ and Objective C++. CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ --- 72,79 ---- # Shared with C front end: CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \ ! incpath.o c-ppoutput.o c-cppbuiltin.o prefix.o \ ! c-gimplify.o c-omp.o # Language-specific object files for C++ and Objective C++. CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ diff -Nrcpad gcc-4.4.1/gcc/cp/call.c gcc-4.4.2/gcc/cp/call.c *** gcc-4.4.1/gcc/cp/call.c Mon Jul 13 06:06:27 2009 --- gcc-4.4.2/gcc/cp/call.c Thu Sep 24 12:49:25 2009 *************** reference_binding (tree rto, tree rfrom, *** 1211,1217 **** lvalue_p = clk_ordinary; from = TREE_TYPE (from); } ! else if (expr) lvalue_p = real_lvalue_p (expr); tfrom = from; --- 1211,1231 ---- lvalue_p = clk_ordinary; from = TREE_TYPE (from); } ! ! if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)) ! { ! maybe_warn_cpp0x ("extended initializer lists"); ! conv = implicit_conversion (to, from, expr, c_cast_p, ! flags); ! if (!CLASS_TYPE_P (to) ! && CONSTRUCTOR_NELTS (expr) == 1) ! { ! expr = CONSTRUCTOR_ELT (expr, 0)->value; ! from = TREE_TYPE (expr); ! } ! } ! ! if (lvalue_p == clk_none && expr) lvalue_p = real_lvalue_p (expr); tfrom = from; *************** reference_binding (tree rto, tree rfrom, *** 1347,1354 **** conversion operator). */ flags |= LOOKUP_NO_TEMP_BIND; ! conv = implicit_conversion (to, from, expr, c_cast_p, ! flags); if (!conv) return NULL; --- 1361,1369 ---- conversion operator). */ flags |= LOOKUP_NO_TEMP_BIND; ! if (!conv) ! conv = implicit_conversion (to, from, expr, c_cast_p, ! flags); if (!conv) return NULL; *************** build_over_call (struct z_candidate *can *** 5332,5337 **** --- 5347,5379 ---- && !TREE_ADDRESSABLE (type)) conv = conv->u.next; + /* Warn about initializer_list deduction that isn't currently in the + working draft. */ + if (cxx_dialect > cxx98 + && flag_deduce_init_list + && cand->template_decl + && is_std_init_list (non_reference (type))) + { + tree tmpl = TI_TEMPLATE (cand->template_decl); + tree realparm = DECL_ARGUMENTS (cand->fn); + tree patparm; + int k; + + for (k = j; k; --k) + realparm = TREE_CHAIN (realparm); + patparm = get_pattern_parm (realparm, tmpl); + + if (!is_std_init_list (non_reference (TREE_TYPE (patparm)))) + { + pedwarn (input_location, 0, "deducing %qT as %qT", + non_reference (TREE_TYPE (patparm)), + non_reference (type)); + pedwarn (input_location, 0, " in call to %q+D", cand->fn); + pedwarn (input_location, 0, + " (you can disable this with -fno-deduce-init-list)"); + } + } + val = convert_like_with_context (conv, TREE_VALUE (arg), fn, i - is_method, complain); *************** compare_ics (conversion *ics1, conversio *** 6242,6247 **** --- 6284,6297 ---- ref_conv1 = maybe_handle_ref_bind (&ics1); ref_conv2 = maybe_handle_ref_bind (&ics2); + /* List-initialization sequence L1 is a better conversion sequence than + list-initialization sequence L2 if L1 converts to + std::initializer_list for some X and L2 does not. */ + if (ics1->kind == ck_list && ics2->kind != ck_list) + return 1; + if (ics2->kind == ck_list && ics1->kind != ck_list) + return -1; + /* [over.ics.rank] When comparing the basic forms of implicit conversion sequences (as *************** compare_ics (conversion *ics1, conversio *** 6292,6317 **** conversion *t1; conversion *t2; ! for (t1 = ics1; t1->kind != ck_user && t1->kind != ck_list; t1 = t1->u.next) if (t1->kind == ck_ambig || t1->kind == ck_aggr) return 0; ! for (t2 = ics2; t2->kind != ck_user && t2->kind != ck_list; t2 = t2->u.next) if (t2->kind == ck_ambig || t2->kind == ck_aggr) return 0; - /* Conversion to std::initializer_list is better than other - user-defined conversions. */ - if (t1->kind == ck_list - || t2->kind == ck_list) - { - if (t2->kind != ck_list) - return 1; - else if (t1->kind != ck_list) - return -1; - else - return 0; - } - if (t1->cand->fn != t2->cand->fn) return 0; --- 6342,6354 ---- conversion *t1; conversion *t2; ! for (t1 = ics1; t1->kind != ck_user; t1 = t1->u.next) if (t1->kind == ck_ambig || t1->kind == ck_aggr) return 0; ! for (t2 = ics2; t2->kind != ck_user; t2 = t2->u.next) if (t2->kind == ck_ambig || t2->kind == ck_aggr) return 0; if (t1->cand->fn != t2->cand->fn) return 0; *************** initialize_reference (tree type, tree ex *** 7288,7293 **** --- 7325,7331 ---- if (!conv || conv->bad_p) { if (!(TYPE_QUALS (TREE_TYPE (type)) & TYPE_QUAL_CONST) + && !TYPE_REF_IS_RVALUE (type) && !real_lvalue_p (expr)) error ("invalid initialization of non-const reference of " "type %qT from a temporary of type %qT", diff -Nrcpad gcc-4.4.1/gcc/cp/cp-tree.h gcc-4.4.2/gcc/cp/cp-tree.h *** gcc-4.4.1/gcc/cp/cp-tree.h Mon Jul 13 06:06:27 2009 --- gcc-4.4.2/gcc/cp/cp-tree.h Fri Sep 18 21:53:23 2009 *************** extern tree get_template_info (tree); *** 4584,4589 **** --- 4584,4590 ---- extern int template_class_depth (tree); extern int is_specialization_of (tree, tree); extern bool is_specialization_of_friend (tree, tree); + extern tree get_pattern_parm (tree, tree); extern int comp_template_args (tree, tree); extern tree maybe_process_partial_specialization (tree); extern tree most_specialized_instantiation (tree); diff -Nrcpad gcc-4.4.1/gcc/cp/decl.c gcc-4.4.2/gcc/cp/decl.c *** gcc-4.4.1/gcc/cp/decl.c Tue Jul 7 22:08:01 2009 --- gcc-4.4.2/gcc/cp/decl.c Wed Oct 7 19:31:56 2009 *************** grok_reference_init (tree decl, tree typ *** 4345,4357 **** return NULL_TREE; } - if (TREE_CODE (init) == CONSTRUCTOR) - { - error ("ISO C++ forbids use of initializer list to " - "initialize reference %qD", decl); - return NULL_TREE; - } - if (TREE_CODE (init) == TREE_LIST) init = build_x_compound_expr_from_list (init, "initializer"); --- 4345,4350 ---- *************** cp_finish_decl (tree decl, tree init, bo *** 5556,5567 **** --- 5549,5567 ---- if (init && TREE_CODE (decl) == FUNCTION_DECL) { + tree clone; if (init == ridpointers[(int)RID_DELETE]) { /* FIXME check this is 1st decl. */ DECL_DELETED_FN (decl) = 1; DECL_DECLARED_INLINE_P (decl) = 1; DECL_INITIAL (decl) = error_mark_node; + FOR_EACH_CLONE (clone, decl) + { + DECL_DELETED_FN (clone) = 1; + DECL_DECLARED_INLINE_P (clone) = 1; + DECL_INITIAL (clone) = error_mark_node; + } init = NULL_TREE; } else if (init == ridpointers[(int)RID_DEFAULT]) *************** cp_finish_decl (tree decl, tree init, bo *** 5572,5578 **** DECL_INITIAL (decl) = NULL_TREE; } else ! DECL_DEFAULTED_FN (decl) = 1; } } --- 5572,5582 ---- DECL_INITIAL (decl) = NULL_TREE; } else ! { ! DECL_DEFAULTED_FN (decl) = 1; ! FOR_EACH_CLONE (clone, decl) ! DECL_DEFAULTED_FN (clone) = 1; ! } } } *************** cp_finish_decl (tree decl, tree init, bo *** 5778,5783 **** --- 5782,5796 ---- type. */ else if (TREE_CODE (type) == ARRAY_TYPE) layout_type (type); + + if (!processing_template_decl + && TREE_STATIC (decl) + && !at_function_scope_p () + && current_function_decl == NULL) + /* So decl is a global variable or a static member of a + non local class. Record the types it uses + so that we can decide later to emit debug info for them. */ + record_types_used_by_current_var_decl (decl); } else if (TREE_CODE (decl) == FIELD_DECL && TYPE_FOR_JAVA (type) && MAYBE_CLASS_TYPE_P (type)) *************** grokdeclarator (const cp_declarator *dec *** 7618,7624 **** bool unsigned_p, signed_p, short_p, long_p, thread_p; bool type_was_error_mark_node = false; bool parameter_pack_p = declarator? declarator->parameter_pack_p : false; - bool set_no_warning = false; bool template_type_arg = false; signed_p = declspecs->specs[(int)ds_signed]; --- 7631,7636 ---- *************** grokdeclarator (const cp_declarator *dec *** 8297,8303 **** /* We now know that the TYPE_QUALS don't apply to the decl, but to its return type. */ type_quals = TYPE_UNQUALIFIED; - set_no_warning = true; } /* Error about some types functions can't return. */ --- 8309,8314 ---- *************** grokdeclarator (const cp_declarator *dec *** 9499,9507 **** if (!processing_template_decl) cp_apply_type_quals_to_decl (type_quals, decl); - if (set_no_warning) - TREE_NO_WARNING (decl) = 1; - return decl; } } --- 9510,9515 ---- *************** move_fn_p (const_tree d) *** 9902,9907 **** --- 9910,9919 ---- /* Remember any special properties of member function DECL. */ + #define DECL_DEFAULTED_IN_CLASS_P(DECL) \ + (DECL_DEFAULTED_FN (DECL) \ + && (DECL_ARTIFICIAL (DECL) || DECL_INITIALIZED_IN_CLASS_P (DECL))) + void grok_special_member_properties (tree decl) { *************** grok_special_member_properties (tree dec *** 9928,9934 **** are no other parameters or else all other parameters have default arguments. */ TYPE_HAS_INIT_REF (class_type) = 1; ! if (!DECL_DEFAULTED_FN (decl)) TYPE_HAS_COMPLEX_INIT_REF (class_type) = 1; if (ctor > 1) TYPE_HAS_CONST_INIT_REF (class_type) = 1; --- 9940,9946 ---- are no other parameters or else all other parameters have default arguments. */ TYPE_HAS_INIT_REF (class_type) = 1; ! if (!DECL_DEFAULTED_IN_CLASS_P (decl)) TYPE_HAS_COMPLEX_INIT_REF (class_type) = 1; if (ctor > 1) TYPE_HAS_CONST_INIT_REF (class_type) = 1; *************** grok_special_member_properties (tree dec *** 9936,9942 **** else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl))) { TYPE_HAS_DEFAULT_CONSTRUCTOR (class_type) = 1; ! if (TREE_CODE (decl) == TEMPLATE_DECL || !DECL_DEFAULTED_FN (decl)) TYPE_HAS_COMPLEX_DFLT (class_type) = 1; } else if (is_list_ctor (decl)) --- 9948,9955 ---- else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl))) { TYPE_HAS_DEFAULT_CONSTRUCTOR (class_type) = 1; ! if (TREE_CODE (decl) == TEMPLATE_DECL ! || !DECL_DEFAULTED_IN_CLASS_P (decl)) TYPE_HAS_COMPLEX_DFLT (class_type) = 1; } else if (is_list_ctor (decl)) *************** grok_special_member_properties (tree dec *** 9955,9961 **** if (assop) { TYPE_HAS_ASSIGN_REF (class_type) = 1; ! if (!DECL_DEFAULTED_FN (decl)) TYPE_HAS_COMPLEX_ASSIGN_REF (class_type) = 1; if (assop != 1) TYPE_HAS_CONST_ASSIGN_REF (class_type) = 1; --- 9968,9974 ---- if (assop) { TYPE_HAS_ASSIGN_REF (class_type) = 1; ! if (!DECL_DEFAULTED_IN_CLASS_P (decl)) TYPE_HAS_COMPLEX_ASSIGN_REF (class_type) = 1; if (assop != 1) TYPE_HAS_CONST_ASSIGN_REF (class_type) = 1; diff -Nrcpad gcc-4.4.1/gcc/cp/error.c gcc-4.4.2/gcc/cp/error.c *** gcc-4.4.1/gcc/cp/error.c Fri Jul 10 22:31:34 2009 --- gcc-4.4.2/gcc/cp/error.c Tue Aug 4 12:28:27 2009 *************** lang_decl_name (tree decl, int v) *** 2181,2187 **** return decl_as_string (decl, TFF_DECL_SPECIFIERS); reinit_cxx_pp (); ! if (v == 1 && DECL_CLASS_SCOPE_P (decl)) { dump_type (CP_DECL_CONTEXT (decl), TFF_PLAIN_IDENTIFIER); pp_cxx_colon_colon (cxx_pp); --- 2181,2190 ---- return decl_as_string (decl, TFF_DECL_SPECIFIERS); reinit_cxx_pp (); ! if (v == 1 ! && (DECL_CLASS_SCOPE_P (decl) ! || (DECL_NAMESPACE_SCOPE_P (decl) ! && CP_DECL_CONTEXT (decl) != global_namespace))) { dump_type (CP_DECL_CONTEXT (decl), TFF_PLAIN_IDENTIFIER); pp_cxx_colon_colon (cxx_pp); diff -Nrcpad gcc-4.4.1/gcc/cp/init.c gcc-4.4.2/gcc/cp/init.c *** gcc-4.4.1/gcc/cp/init.c Mon Jul 13 06:06:27 2009 --- gcc-4.4.2/gcc/cp/init.c Thu Aug 6 17:22:19 2009 *************** build_vec_init (tree base, tree maxindex *** 2695,2700 **** --- 2695,2707 ---- gcc_assert (!init); inner_elt_type = strip_array_types (type); + + /* Look through the TARGET_EXPR around a compound literal. */ + if (init && TREE_CODE (init) == TARGET_EXPR + && TREE_CODE (TARGET_EXPR_INITIAL (init)) == CONSTRUCTOR + && from_array != 2) + init = TARGET_EXPR_INITIAL (init); + if (init && TREE_CODE (atype) == ARRAY_TYPE && (from_array == 2 *************** build_vec_init (tree base, tree maxindex *** 2763,2768 **** --- 2770,2786 ---- base = get_temp_regvar (ptype, rval); iterator = get_temp_regvar (ptrdiff_type_node, maxindex); + /* If initializing one array from another, initialize element by + element. We rely upon the below calls to do the argument + checking. Evaluate the initializer before entering the try block. */ + if (from_array && init && TREE_CODE (init) != CONSTRUCTOR) + { + base2 = decay_conversion (init); + itype = TREE_TYPE (base2); + base2 = get_temp_regvar (itype, base2); + itype = TREE_TYPE (itype); + } + /* Protect the entire array initialization so that we can destroy the partially constructed array if an exception is thrown. But don't do this if we're assigning. */ *************** build_vec_init (tree base, tree maxindex *** 2805,2820 **** } else if (from_array) { - /* If initializing one array from another, initialize element by - element. We rely upon the below calls the do argument - checking. */ if (init) ! { ! base2 = decay_conversion (init); ! itype = TREE_TYPE (base2); ! base2 = get_temp_regvar (itype, base2); ! itype = TREE_TYPE (itype); ! } else if (TYPE_LANG_SPECIFIC (type) && TYPE_NEEDS_CONSTRUCTING (type) && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type)) --- 2823,2830 ---- } else if (from_array) { if (init) ! /* OK, we set base2 above. */; else if (TYPE_LANG_SPECIFIC (type) && TYPE_NEEDS_CONSTRUCTING (type) && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type)) diff -Nrcpad gcc-4.4.1/gcc/cp/parser.c gcc-4.4.2/gcc/cp/parser.c *** gcc-4.4.1/gcc/cp/parser.c Tue Jun 9 04:23:00 2009 --- gcc-4.4.2/gcc/cp/parser.c Mon Aug 31 21:20:07 2009 *************** cp_parser_enum_specifier (cp_parser* par *** 11871,11881 **** else identifier = make_anon_name (); ! /* Check for the `:' that denotes a specified underlying type in C++0x. */ if (cp_lexer_next_token_is (parser->lexer, CPP_COLON)) { cp_decl_specifier_seq type_specifiers; /* At this point this is surely not elaborated type specifier. */ if (!cp_parser_parse_definitely (parser)) return NULL_TREE; --- 11871,11889 ---- else identifier = make_anon_name (); ! /* Check for the `:' that denotes a specified underlying type in C++0x. ! Note that a ':' could also indicate a bitfield width, however. */ if (cp_lexer_next_token_is (parser->lexer, CPP_COLON)) { cp_decl_specifier_seq type_specifiers; + /* Consume the `:'. */ + cp_lexer_consume_token (parser->lexer); + + /* Parse the type-specifier-seq. */ + cp_parser_type_specifier_seq (parser, /*is_condition=*/false, + &type_specifiers); + /* At this point this is surely not elaborated type specifier. */ if (!cp_parser_parse_definitely (parser)) return NULL_TREE; *************** cp_parser_enum_specifier (cp_parser* par *** 11883,11897 **** if (cxx_dialect == cxx98) maybe_warn_cpp0x ("scoped enums"); - /* Consume the `:'. */ - cp_lexer_consume_token (parser->lexer); - has_underlying_type = true; - /* Parse the type-specifier-seq. */ - cp_parser_type_specifier_seq (parser, /*is_condition=*/false, - &type_specifiers); - /* If that didn't work, stop. */ if (type_specifiers.type != error_mark_node) { --- 11891,11898 ---- diff -Nrcpad gcc-4.4.1/gcc/cp/pt.c gcc-4.4.2/gcc/cp/pt.c *** gcc-4.4.1/gcc/cp/pt.c Thu Jul 9 18:00:58 2009 --- gcc-4.4.2/gcc/cp/pt.c Wed Oct 7 19:31:56 2009 *************** static tree tsubst_expr (tree, tree, tsu *** 175,180 **** --- 175,182 ---- static tree tsubst_copy (tree, tree, tsubst_flags_t, tree); static tree tsubst_pack_expansion (tree, tree, tsubst_flags_t, tree); static tree tsubst_decl (tree, tree, tsubst_flags_t); + static tree listify (tree); + static tree listify_autos (tree, tree); /* Make the current scope suitable for access checking when we are processing T. T can be FUNCTION_DECL for instantiated function *************** register_specialization (tree spec, tree *** 1291,1298 **** to the primary function; now copy the inline bits to the various clones. */ FOR_EACH_CLONE (clone, fn) ! DECL_DECLARED_INLINE_P (clone) ! = DECL_DECLARED_INLINE_P (fn); check_specialization_namespace (fn); return fn; --- 1293,1304 ---- to the primary function; now copy the inline bits to the various clones. */ FOR_EACH_CLONE (clone, fn) ! { ! DECL_DECLARED_INLINE_P (clone) ! = DECL_DECLARED_INLINE_P (fn); ! DECL_SOURCE_LOCATION (clone) ! = DECL_SOURCE_LOCATION (fn); ! } check_specialization_namespace (fn); return fn; *************** tsubst_pack_expansion (tree t, tree args *** 7569,7574 **** --- 7575,7584 ---- } else if (len != my_len) { + if (incomplete) + /* We got explicit args for some packs but not others; + do nothing now and try again after deduction. */ + return t; if (TREE_CODE (t) == TYPE_PACK_EXPANSION) error ("mismatched argument pack lengths while expanding " "%<%T%>", *************** tsubst_pack_expansion (tree t, tree args *** 7715,7720 **** --- 7725,7777 ---- return result; } + /* Given PARM_DECL PARM, find the corresponding PARM_DECL in the template + TMPL. We do this using DECL_PARM_INDEX, which should work even with + parameter packs; all parms generated from a function parameter pack will + have the same DECL_PARM_INDEX. */ + + tree + get_pattern_parm (tree parm, tree tmpl) + { + tree pattern = DECL_TEMPLATE_RESULT (tmpl); + tree patparm; + + if (DECL_ARTIFICIAL (parm)) + { + for (patparm = DECL_ARGUMENTS (pattern); + patparm; patparm = TREE_CHAIN (patparm)) + if (DECL_ARTIFICIAL (patparm) + && DECL_NAME (parm) == DECL_NAME (patparm)) + break; + } + else + { + for (patparm = FUNCTION_FIRST_USER_PARM (pattern); + patparm; patparm = TREE_CHAIN (patparm)) + { + if (DECL_NAME (patparm) == DECL_NAME (parm)) + break; + if (FUNCTION_PARAMETER_PACK_P (patparm) + /* OK, this is a hack. We know that if PARAM_DECL is expanded + from PACK, its name (built with make_ith_pack_parameter_name) + is the string "#N" where is the name of PACK + and N is a number. + So we just check that naming pattern. */ + && (IDENTIFIER_LENGTH (DECL_NAME (patparm)) + < IDENTIFIER_LENGTH (DECL_NAME (parm))) + && ! strncmp (IDENTIFIER_POINTER (DECL_NAME (parm)), + IDENTIFIER_POINTER (DECL_NAME (patparm)), + IDENTIFIER_LENGTH (DECL_NAME (patparm))) + && (IDENTIFIER_POINTER (DECL_NAME (parm)) + [IDENTIFIER_LENGTH (DECL_NAME (patparm))] + == '#')) + break; + } + } + + return patparm; + } + /* Substitute ARGS into the vector or list of template arguments T. */ static tree *************** tsubst_default_argument (tree fn, tree t *** 8007,8017 **** cp_function_chain->x_current_class_ref = saved_class_ref; } - pop_access_scope (fn); - /* Make sure the default argument is reasonable. */ arg = check_default_argument (type, arg); return arg; } --- 8064,8074 ---- cp_function_chain->x_current_class_ref = saved_class_ref; } /* Make sure the default argument is reasonable. */ arg = check_default_argument (type, arg); + pop_access_scope (fn); + return arg; } *************** unify (tree tparms, tree targs, tree par *** 13320,13325 **** --- 13377,13388 ---- { tree elt, elttype; unsigned i; + tree orig_parm = parm; + + /* Replace T with std::initializer_list for deduction. */ + if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM + && flag_deduce_init_list) + parm = listify (parm); if (!is_std_init_list (parm)) /* We can only deduce from an initializer list argument if the *************** unify (tree tparms, tree targs, tree par *** 13345,13350 **** --- 13408,13423 ---- if (unify (tparms, targs, elttype, elt, elt_strict)) return 1; } + + /* If the std::initializer_list deduction worked, replace the + deduced A with std::initializer_list. */ + if (orig_parm != parm) + { + idx = TEMPLATE_TYPE_IDX (orig_parm); + targ = TREE_VEC_ELT (INNERMOST_TEMPLATE_ARGS (targs), idx); + targ = listify (targ); + TREE_VEC_ELT (INNERMOST_TEMPLATE_ARGS (targs), idx) = targ; + } return 0; } *************** make_auto (void) *** 16989,17014 **** return au; } ! /* Replace auto in TYPE with std::initializer_list. */ static tree ! listify_autos (tree type, tree auto_node) { tree std_init_list = namespace_binding (get_identifier ("initializer_list"), std_node); tree argvec; - tree init_auto; if (!std_init_list || !DECL_CLASS_TEMPLATE_P (std_init_list)) { ! error ("deducing auto from brace-enclosed initializer list requires " "#include "); return error_mark_node; } argvec = make_tree_vec (1); ! TREE_VEC_ELT (argvec, 0) = auto_node; ! init_auto = lookup_template_class (std_init_list, argvec, NULL_TREE, ! NULL_TREE, 0, tf_warning_or_error); TREE_VEC_ELT (argvec, 0) = init_auto; if (processing_template_decl) argvec = add_to_template_args (current_template_args (), argvec); --- 17062,17094 ---- return au; } ! /* Given type ARG, return std::initializer_list. */ static tree ! listify (tree arg) { tree std_init_list = namespace_binding (get_identifier ("initializer_list"), std_node); tree argvec; if (!std_init_list || !DECL_CLASS_TEMPLATE_P (std_init_list)) { ! error ("deducing from brace-enclosed initializer list requires " "#include "); return error_mark_node; } argvec = make_tree_vec (1); ! TREE_VEC_ELT (argvec, 0) = arg; ! return lookup_template_class (std_init_list, argvec, NULL_TREE, ! NULL_TREE, 0, tf_warning_or_error); ! } ! ! /* Replace auto in TYPE with std::initializer_list. */ + static tree + listify_autos (tree type, tree auto_node) + { + tree init_auto = listify (auto_node); + tree argvec = make_tree_vec (1); TREE_VEC_ELT (argvec, 0) = init_auto; if (processing_template_decl) argvec = add_to_template_args (current_template_args (), argvec); diff -Nrcpad gcc-4.4.1/gcc/cp/tree.c gcc-4.4.2/gcc/cp/tree.c *** gcc-4.4.1/gcc/cp/tree.c Mon Jul 13 06:06:27 2009 --- gcc-4.4.2/gcc/cp/tree.c Wed Oct 7 19:31:56 2009 *************** lvalue_p_1 (tree ref) *** 132,137 **** --- 132,143 ---- return clk_ordinary; case CONST_DECL: + /* CONST_DECL without TREE_STATIC are enumeration values and + thus not lvalues. With TREE_STATIC they are used by ObjC++ + in objc_build_string_object and need to be considered as + lvalues. */ + if (! TREE_STATIC (ref)) + return clk_none; case VAR_DECL: if (TREE_READONLY (ref) && ! TREE_STATIC (ref) && DECL_LANG_SPECIFIC (ref) *************** build_qualified_name (tree type, tree sc *** 1154,1159 **** --- 1160,1167 ---- return error_mark_node; t = build2 (SCOPE_REF, type, scope, name); QUALIFIED_NAME_IS_TEMPLATE (t) = template_p; + if (type) + t = convert_from_reference (t); return t; } diff -Nrcpad gcc-4.4.1/libstdc++-v3/ChangeLog gcc-4.4.2/libstdc++-v3/ChangeLog *** gcc-4.4.1/libstdc++-v3/ChangeLog Wed Jul 22 07:30:42 2009 --- gcc-4.4.2/libstdc++-v3/ChangeLog Thu Oct 15 07:40:31 2009 *************** *** 1,3 **** --- 1,30 ---- + 2009-10-15 Release Manager + + * GCC 4.4.2 released. + + 2009-09-11 Johannes Singler + + * include/parallel/multiway_merge.h + (multiway_merge_exact_splitting): Deallocate borders correctly. + (parallel_multiway_merge): Remove unnecessarily complicated + allocation, random access iterators are default-constructible; + deallocate ne_seqs correctly. + + 2009-08-26 Jonathan Wakely + + PR libstdc++/41005 + * configure.ac: Bump libtool_VERSION to 6:13:0. + * configure: Regenerate. + * src/Makefile.am: Compile fstream-inst.cc as C++0x. + * src/Makefile.in: Regenerate. + * config/abi/pre/gnu.ver: Add new symbols and disambiguate old ones. + * testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.13 version. + + 2009-07-22 Paolo Carlini + + * include/std/valarray (valarray<>::operator=(initializer_list<>)): + Return *this. + 2009-07-22 Release Manager * GCC 4.4.1 released. diff -Nrcpad gcc-4.4.1/libstdc++-v3/config/abi/pre/gnu.ver gcc-4.4.2/libstdc++-v3/config/abi/pre/gnu.ver *** gcc-4.4.1/libstdc++-v3/config/abi/pre/gnu.ver Tue May 5 21:44:27 2009 --- gcc-4.4.2/libstdc++-v3/config/abi/pre/gnu.ver Wed Aug 26 19:04:11 2009 *************** GLIBCXX_3.4 { *** 32,38 **** std::a[e-z]*; # std::ba[a-r]*; std::basic_[a-e]*; ! std::basic_f[a-r]*; # std::basic_fstream; std::basic_f[t-z]*; std::basic_[g-h]*; --- 32,40 ---- std::a[e-z]*; # std::ba[a-r]*; std::basic_[a-e]*; ! std::basic_f[a-h]*; ! # std::basic_filebuf; ! std::basic_f[j-r]*; # std::basic_fstream; std::basic_f[t-z]*; std::basic_[g-h]*; *************** GLIBCXX_3.4 { *** 273,300 **** _ZNSdC*; _ZNSdD*; # std::basic_fstream ! _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC*; _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EED*; _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE5closeEv; _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE7is_openEv; ! _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE4open*; _ZNKSt13basic_fstreamI[cw]St11char_traitsI[cw]EE5rdbufEv; # std::basic_ifstream ! _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EEC*; _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EED*; _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE5closeEv; _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE7is_openEv; ! _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE4open*; _ZNKSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE5rdbufEv; # std::basic_ofstream ! _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EEC*; _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EED*; _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE5closeEv; _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE7is_openEv; ! _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE4open*; _ZNKSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE5rdbufEv; # std::basic_istream --- 275,314 ---- _ZNSdC*; _ZNSdD*; + # std::basic_filebuf + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EEC*; + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EED*; + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE[0-3]*; + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE4openEPKc*; + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE4sync*; + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE[5-9]*; + _ZNKSt13basic_filebufI[cw]St11char_traitsI[cw]EE7is_openEv; + # std::basic_fstream ! _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC[12]Ev; ! _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC[12]EPKc*; _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EED*; _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE5closeEv; _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE7is_openEv; ! _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE4openEPKc*; _ZNKSt13basic_fstreamI[cw]St11char_traitsI[cw]EE5rdbufEv; # std::basic_ifstream ! _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EEC[12]Ev; ! _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EEC[12]EPKc*; _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EED*; _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE5closeEv; _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE7is_openEv; ! _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE4openEPKc*; _ZNKSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE5rdbufEv; # std::basic_ofstream ! _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EEC[12]Ev; ! _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EEC[12]EPKc*; _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EED*; _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE5closeEv; _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE7is_openEv; ! _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE4openEPKc*; _ZNKSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE5rdbufEv; # std::basic_istream *************** GLIBCXX_3.4.12 { *** 966,971 **** --- 980,998 ---- } GLIBCXX_3.4.11; + GLIBCXX_3.4.13 { + + # new fstream members + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE4openERKSsSt13_Ios_Openmode; + _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC[12]ERKSsSt13_Ios_Openmode; + _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE4openERKSsSt13_Ios_Openmode; + _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EEC[12]ERKSsSt13_Ios_Openmode; + _ZNSt14basic_ifstreamI[cw]St11char_traitsI[cw]EE4openERKSsSt13_Ios_Openmode; + _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EEC[12]ERKSsSt13_Ios_Openmode; + _ZNSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE4openERKSsSt13_Ios_Openmode; + + } GLIBCXX_3.4.12; + # Symbols in the support library (libsupc++) have their own tag. CXXABI_1.3 { diff -Nrcpad gcc-4.4.1/libstdc++-v3/configure gcc-4.4.2/libstdc++-v3/configure *** gcc-4.4.1/libstdc++-v3/configure Thu May 7 10:23:06 2009 --- gcc-4.4.2/libstdc++-v3/configure Wed Aug 26 19:04:11 2009 *************** ac_compiler_gnu=$ac_cv_c_compiler_gnu *** 1567,1573 **** ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD # For libtool versioning info, format is CURRENT:REVISION:AGE ! libtool_VERSION=6:12:0 # Find the rest of the source tree framework. --- 1567,1573 ---- ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD # For libtool versioning info, format is CURRENT:REVISION:AGE ! libtool_VERSION=6:13:0 # Find the rest of the source tree framework. diff -Nrcpad gcc-4.4.1/libstdc++-v3/configure.ac gcc-4.4.2/libstdc++-v3/configure.ac *** gcc-4.4.1/libstdc++-v3/configure.ac Thu May 7 10:23:06 2009 --- gcc-4.4.2/libstdc++-v3/configure.ac Wed Aug 26 19:04:11 2009 *************** AC_CONFIG_HEADER(config.h) *** 12,18 **** ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD # For libtool versioning info, format is CURRENT:REVISION:AGE ! libtool_VERSION=6:12:0 AC_SUBST(libtool_VERSION) # Find the rest of the source tree framework. --- 12,18 ---- ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD # For libtool versioning info, format is CURRENT:REVISION:AGE ! libtool_VERSION=6:13:0 AC_SUBST(libtool_VERSION) # Find the rest of the source tree framework. diff -Nrcpad gcc-4.4.1/libstdc++-v3/include/parallel/multiway_merge.h gcc-4.4.2/libstdc++-v3/include/parallel/multiway_merge.h *** gcc-4.4.1/libstdc++-v3/include/parallel/multiway_merge.h Thu Apr 9 23:23:07 2009 --- gcc-4.4.2/libstdc++-v3/include/parallel/multiway_merge.h Fri Sep 11 16:36:00 2009 *************** void multiway_merge_exact_splitting( *** 1224,1230 **** offsets[num_threads - 1].begin(), comp); } } ! for (int slab = 0; slab < num_threads; ++slab) { --- 1224,1230 ---- offsets[num_threads - 1].begin(), comp); } } ! delete[] borders; for (int slab = 0; slab < num_threads; ++slab) { *************** template< *** 1305,1315 **** std::iterator_traits::value_type value_type; // Leave only non-empty sequences. ! std::pair* ne_seqs = ! static_cast*>( ! ::operator new( ! sizeof(std::pair) ! * (seqs_end - seqs_begin))); int k = 0; difference_type total_length = 0; for (RandomAccessIteratorIterator raii = seqs_begin; --- 1305,1312 ---- std::iterator_traits::value_type value_type; // Leave only non-empty sequences. ! typedef std::pair seq_type; ! seq_type* ne_seqs = new seq_type[seqs_end - seqs_begin]; int k = 0; difference_type total_length = 0; for (RandomAccessIteratorIterator raii = seqs_begin; *************** template< *** 1319,1327 **** if(seq_length > 0) { total_length += seq_length; ! //ne_seqs[k] = *raii; ! new(&(ne_seqs[k++])) ! std::pair(*raii); } } --- 1316,1322 ---- if(seq_length > 0) { total_length += seq_length; ! ne_seqs[k++] = *raii; } } *************** template< *** 1331,1337 **** if (total_length == 0 || k == 0) { ! ::operator delete(ne_seqs); return target; } --- 1326,1332 ---- if (total_length == 0 || k == 0) { ! delete[] ne_seqs; return target; } *************** template< *** 1366,1373 **** for (int c = 0; c < k; ++c) target_position += pieces[iam][c].first; ! std::pair* chunks ! = new std::pair[k]; for (int s = 0; s < k; ++s) { --- 1361,1367 ---- for (int c = 0; c < k; ++c) target_position += pieces[iam][c].first; ! seq_type* chunks = new seq_type[k]; for (int s = 0; s < k; ++s) { *************** template< *** 1399,1404 **** --- 1393,1399 ---- } delete[] pieces; + delete[] ne_seqs; return target + length; } diff -Nrcpad gcc-4.4.1/libstdc++-v3/include/std/valarray gcc-4.4.2/libstdc++-v3/include/std/valarray *** gcc-4.4.1/libstdc++-v3/include/std/valarray Thu Apr 9 23:23:07 2009 --- gcc-4.4.2/libstdc++-v3/include/std/valarray Wed Jul 22 10:25:53 2009 *************** *** 1,7 **** // The template and inlines for the -*- C++ -*- valarray class. // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, ! // 2006, 2007, 2009 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free --- 1,7 ---- // The template and inlines for the -*- C++ -*- valarray class. // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, ! // 2006, 2007, 2008, 2009 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free *************** _GLIBCXX_BEGIN_NAMESPACE(std) *** 647,653 **** template inline valarray<_Tp>::valarray(initializer_list<_Tp> __l) ! : _M_size(__l.size()), _M_data(__valarray_get_storage<_Tp>(__l.size())) { std::__valarray_copy_construct (__l.begin(), __l.end(), _M_data); } #endif --- 647,653 ---- template inline valarray<_Tp>::valarray(initializer_list<_Tp> __l) ! : _M_size(__l.size()), _M_data(__valarray_get_storage<_Tp>(__l.size())) { std::__valarray_copy_construct (__l.begin(), __l.end(), _M_data); } #endif *************** _GLIBCXX_BEGIN_NAMESPACE(std) *** 681,686 **** --- 681,687 ---- { _GLIBCXX_DEBUG_ASSERT(_M_size == __l.size()); std::__valarray_copy(__l.begin(), __l.size(), _M_data); + return *this; } #endif diff -Nrcpad gcc-4.4.1/libstdc++-v3/src/Makefile.am gcc-4.4.2/libstdc++-v3/src/Makefile.am *** gcc-4.4.1/libstdc++-v3/src/Makefile.am Thu Apr 9 23:23:07 2009 --- gcc-4.4.2/libstdc++-v3/src/Makefile.am Wed Aug 26 19:04:11 2009 *************** atomic.lo: atomic.cc *** 277,282 **** --- 277,287 ---- atomic.o: atomic.cc $(CXXCOMPILE) -std=gnu++0x -c $< + fstream-inst.lo: fstream-inst.cc + $(LTCXXCOMPILE) -std=gnu++0x -c $< + fstream-inst.o: fstream-inst.cc + $(CXXCOMPILE) -std=gnu++0x -c $< + string-inst.lo: string-inst.cc $(LTCXXCOMPILE) -std=gnu++0x -c $< string-inst.o: string-inst.cc diff -Nrcpad gcc-4.4.1/libstdc++-v3/src/Makefile.in gcc-4.4.2/libstdc++-v3/src/Makefile.in *** gcc-4.4.1/libstdc++-v3/src/Makefile.in Sat Jan 17 02:03:25 2009 --- gcc-4.4.2/libstdc++-v3/src/Makefile.in Wed Aug 26 19:04:11 2009 *************** atomic.lo: atomic.cc *** 888,893 **** --- 888,898 ---- atomic.o: atomic.cc $(CXXCOMPILE) -std=gnu++0x -c $< + fstream-inst.lo: fstream-inst.cc + $(LTCXXCOMPILE) -std=gnu++0x -c $< + fstream-inst.o: fstream-inst.cc + $(CXXCOMPILE) -std=gnu++0x -c $< + string-inst.lo: string-inst.cc $(LTCXXCOMPILE) -std=gnu++0x -c $< string-inst.o: string-inst.cc diff -Nrcpad gcc-4.4.1/libstdc++-v3/testsuite/util/testsuite_abi.cc gcc-4.4.2/libstdc++-v3/testsuite/util/testsuite_abi.cc *** gcc-4.4.1/libstdc++-v3/testsuite/util/testsuite_abi.cc Tue May 5 21:44:27 2009 --- gcc-4.4.2/libstdc++-v3/testsuite/util/testsuite_abi.cc Wed Aug 26 19:04:11 2009 *************** check_version(symbol& test, bool added) *** 184,189 **** --- 184,190 ---- known_versions.push_back("GLIBCXX_3.4.10"); known_versions.push_back("GLIBCXX_3.4.11"); known_versions.push_back("GLIBCXX_3.4.12"); + known_versions.push_back("GLIBCXX_3.4.13"); known_versions.push_back("GLIBCXX_LDBL_3.4"); known_versions.push_back("GLIBCXX_LDBL_3.4.7"); known_versions.push_back("GLIBCXX_LDBL_3.4.10");