diff -Nrcpad gcc-4.6.0/gcc/cp/ChangeLog gcc-4.6.1/gcc/cp/ChangeLog *** gcc-4.6.0/gcc/cp/ChangeLog Fri Mar 25 16:54:28 2011 --- gcc-4.6.1/gcc/cp/ChangeLog Mon Jun 27 10:02:36 2011 *************** *** 1,3 **** --- 1,511 ---- + 2011-06-27 Release Manager + + * GCC 4.6.1 released. + + 2011-06-23 Jason Merrill + + PR c++/49507 + * decl2.c (mark_used): Don't call synthesize_method for + functions defaulted outside the class. + + 2011-06-21 Jason Merrill + + PR c++/49482 + * semantics.c (maybe_add_lambda_conv_op): Call mark_exp_read for + static fn parameters. + + 2011-06-16 Jason Merrill + + PR c++/49229 + * pt.c (tsubst_decl) [FUNCTION_DECL]: Handle substitution failure. + + PR c++/49251 + * semantics.c (finish_id_expression): Mark even dependent + variables as used. + + 2011-06-14 Jason Merrill + + * error.c (type_to_string): Print typedef-stripped version too. + + PR c++/49117 + * call.c (perform_implicit_conversion_flags): Print source type as + well as expression. + + PR c++/49369 + * class.c (build_base_path): Fix cv-quals in unevaluated context. + + PR c++/49290 + * semantics.c (cxx_eval_indirect_ref): Remove assert. + + 2011-06-09 Jason Merrill + + * semantics.c (finish_compound_literal): Set TREE_HAS_CONSTRUCTOR. + + 2011-06-08 Jason Merrill + + * semantics.c (potential_constant_expression_1): Handle destructor + call. + + 2011-06-07 Jason Merrill + + PR c++/48780 + * typeck.c (perform_integral_promotions): Don't promote scoped enums. + * call.c (convert_arg_to_ellipsis): Promote them here in old ABI. + + 2011-06-06 Jason Merrill + + PR c++/49298 + * semantics.c (potential_constant_expression_1): Handle FIELD_DECL. + + PR c++/49134 + * tree.c (build_target_expr): Deal with ARM ABI tweaks. + + 2011-06-03 Jakub Jelinek + + PR c++/49276 + * mangle.c (write_nested_name): Use CP_DECL_CONTEXT instead of + DECL_CONTEXT. + + 2011-05-30 Jakub Jelinek + + PR c++/49223 + * semantics.c (finish_omp_clauses): Call require_complete_type + even for copyin/copyprivate clauses. Only call + cxx_omp_create_clause_info if inner_type is COMPLETE_TYPE_P. + + 2011-05-27 Jason Merrill + + PR c++/47049 + * semantics.c (maybe_add_lambda_conv_op): Fix COMDAT sharing. + * decl.c (start_preparsed_function): Don't call comdat_linkage for + a template. + + PR c++/47277 + * parser.c (cp_parser_unqualified_id): Don't check + constructor_name_p for enums. + + PR c++/48284 + * error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot + with INDIRECT_REF of REFERENCE_TYPE. + + PR c++/48657 + PR c++/49176 + * decl.c (cp_finish_decl): Simplify template handling. + + 2011-05-26 Jason Merrill + + PR c++/48424 + * decl.c (grokparms): Function parameter packs don't need to + go at the end. + * pt.c (type_unification_real): But they aren't deduced otherwise. + + 2011-05-25 Jason Merrill + + PR c++/44994 + PR c++/49156 + * error.c (dump_template_bindings): Set processing_template_decl + for a partial instantiation. + + PR c++/45401 + * decl.c (grokdeclarator): Don't change type when adding rvalue ref + to another reference type. + + 2011-05-26 Fabien ChĂȘne + * init.c (diagnose_uninitialized_cst_or_ref_member_1): Use + permerror instead of error, adjust the error count. + + 2011-05-25 Jason Merrill + + PR c++/44311 + * decl.c (case_conversion): New. + (finish_case_label): Use it. + + PR c++/45698 + * pt.c (dependent_template_arg_p): See through ARGUMENT_PACK_SELECT. + + PR c++/46005 + * decl.c (grokdeclarator): Complain about auto typedef. + + PR c++/46245 + * decl.c (grokdeclarator): Complain later for auto parameter. + * pt.c (splice_late_return_type): Handle use in a template + type-parameter. + + PR c++/46696 + * typeck.c (cp_build_modify_expr): Check DECL_DEFAULTED_FN. + + PR c++/47184 + * parser.c (cp_parser_parameter_declaration): Recognize + list-initialization. + (cp_parser_direct_declarator): Check for the closing + paren before parsing definitely. + + PR c++/48935 + * parser.c (cp_parser_constructor_declarator_p): Don't check + constructor_name_p for enums. + (cp_parser_diagnose_invalid_type_name): Correct error message. + + 2011-05-25 Jason Merrill + + PR c++/45418 + * init.c (perform_member_init): Handle list-initialization + of array of non-trivial class type. + + PR c++/45080 + * pt.c (instantiate_class_template_1): Call maybe_add_lambda_conv_op. + * semantics.c (lambda_function): Check COMPLETE_OR_OPEN_TYPE_P. + + PR c++/48292 + * pt.c (tsubst_decl) [PARM_DECL]: Handle partial instantiation of + function parameter pack. + (tsubst_pack_expansion): Likewise. + + 2011-05-25 Jakub Jelinek + + PR c++/49136 + * semantics.c (cxx_eval_bit_field_ref): Handle the + case when BIT_FIELD_REF doesn't cover only a single field. + + 2011-05-24 Jason Merrill + + PR c++/49042 + * pt.c (get_mostly_instantiated_function_type): Use + push_deferring_access_checks rather than set flag_access_control. + + PR c++/48884 + * pt.c (fn_type_unification): Disable access control during + substitution. + + PR c++/49105 + * typeck.c (build_const_cast_1): Handle rvalue references. + + PR c++/47263 + * decl.c (use_eh_spec_block): Do use an EH spec block for a + lambda op(). + + PR c++/47336 + * error.c (dump_template_bindings): Suppress access control. + + PR c++/47544 + * pt.c (instantiate_decl): Handle =default. + + PR c++/48617 + * pt.c (invalid_nontype_parm_type_p): Allow DECLTYPE_TYPE. + + 2011-05-22 Jason Merrill + + PR c++/48647 + * typeck.c (composite_pointer_type_r): Return error_mark_node + on error in SFINAE context. + + 2011-05-20 Jason Merrill + + PR c++/48945 + * decl.c (revert_static_member_fn): Ignore const on constexpr fn. + + PR c++/48780 + * cvt.c (type_promotes_to): Warn about promoting scoped enums. + + PR c++/49066 + * decl.c (duplicate_decls): Preserve DECL_DELETED_FN. + + DR 1073 + PR c++/49082 + * typeck.c (comp_except_specs): noexcept(false) is not compatible + with throw(type-list). + * typeck2.c (merge_exception_specifiers): noexcept(false) + beats any more limited specification. + + PR c++/48948 + * class.c (finalize_literal_type_property): Only check + for constexpr member functions of non-literal class. + * decl.c (cp_finish_decl): Don't call validate_constexpr_fundecl. + * semantics.c (literal_type_p): Call complete_type. + + * semantics.c (validate_constexpr_fundecl): Check DECL_TEMPLATE_INFO + rather than DECL_TEMPLATE_INSTANTIATION. + (cxx_eval_call_expression): Likewise. + + * semantics.c (register_constexpr_fundef): Add to hash table here. + (validate_constexpr_fundecl): Not here. + + PR c++/48745 + * pt.c (value_dependent_expr_p): Handle CONSTRUCTOR. + + PR c++/48736 + * pt.c (tsubst_copy_and_build): Handle substitution of a pack + expansion producing another expansion. + + PR c++/48873 + * tree.c (stabilize_expr): Don't make gratuitous copies of classes. + + 2011-05-19 Jakub Jelinek + + PR c++/49043 + * decl.c (check_omp_return): Stop searching on sk_function_parms. + + PR c++/48869 + * method.c (get_dtor, get_copy_ctor): Add COMPLAIN argument, + pass it down to locate_fn_flags. + * cp-tree.h (get_dtor, get_copy_ctor): Adjust prototypes. + * semantics.c (cxx_omp_create_clause_info): Adjust callers. + * cp-gimplify.c: Include splay-tree.h. + (splay_tree_compare_decl_uid, omp_var_to_track, + omp_cxx_notice_variable): New functions. + (struct cp_genericize_omp_taskreg): New type. + (struct cp_genericize_data): Add omp_ctx field. + (cp_genericize_r): Attempt to determine implicitly determined + firstprivate class type variables. + (cp_genericize): Clear omp_ctx. + * Make-lang.in (cp/cp-gimplify.o): Depend on $(SPLAY_TREE_H). + + 2011-05-11 Jason Merrill + + * pt.c (build_non_dependent_expr): Don't check null_ptr_cst_p. + + 2011-05-11 Fabien ChĂȘne + + PR c++/48859 + * init.c (diagnose_uninitialized_cst_or_ref_member_1): stop the + recursion if there is user defined constructor. + + 2011-05-09 Dodji Seketeli + + PR c++/48574 + * class.c (fixed_type_or_null): Use type_dependent_p_push to test + if the instance has a dependent initializer. + + 2011-05-06 Jason Merrill + + PR c++/48909 + * semantics.c (cxx_eval_conditional_expression): Check + integer_zerop instead. + (potential_constant_expression_1): Likewise. + + PR c++/48911 + * semantics.c (cxx_eval_array_reference): Handle implicit + initializers. + + PR c++/48446 + * decl.c (stabilize_save_expr_r, stabilize_vla_size): New. + (grokdeclarator): Use stabilize_vla_size. + * init.c (get_temp_regvar): No longer static. + * cp-tree.h: Declare it. + + PR c++/48089 + * semantics.c (potential_constant_expression_1): Don't allow *this + in a constructor. + (register_constexpr_fundef): Use potential_rvalue_constant_expression. + + 2011-05-06 Dodji Seketeli + + PR c++/48838 + * cp-tree.h (non_static_member_function_p): Declare new function. + * tree.c (non_static_member_function_p): Define it. + * semantics.c (finish_call_expr): Use it. + + 2011-05-04 Jason Merrill + + PR c++/48749 + * class.c (resolves_to_fixed_type_p): Don't look closely + in templates. + + 2011-04-28 Dodji Seketeli + + PR c++/48656 + * semantics.c (finish_call_expr): Don't forget BASELINK nodes when + considering call expressions involving a member function. + + 2011-04-27 Jason Merrill + + PR c++/48046 + * parser.c (cp_parser_diagnose_invalid_type_name): Commit + to tentative parse sooner. + + 2011-04-26 Jason Merrill + + PR c++/42687 + * parser.c (cp_parser_primary_expression): Set *idk to + CP_ID_KIND_NONE for a parenthesized identifier. + + 2011-04-26 Jason Merrill + + PR c++/48726 + * call.c (convert_like_real): Correct TREE_CONSTANT on CONSTRUCTOR. + * decl.c (reshape_init_array_1): Likewise. + + 2011-04-25 Jason Merrill + + PR c++/48707 + * pt.c (value_dependent_expression_p): Handle type-dependent + expression. + + 2011-04-20 Jason Merrill + + * semantics.c (finish_compound_literal): Don't put an array + with a dtor in a static variable. + + 2011-04-20 Jason Merrill + + PR c++/48594 + * decl2.c (build_offset_ref_call_from_tree): Move + non-dependency of object outside condition. + + PR c++/48657 + * decl.c (cp_finish_decl): Handle non-member constant variables + in templates, too. + + 2011-04-19 Jason Merrill + + PR c++/46304 + * typeck.c (cp_build_binary_op): Fold COMPLEX_EXPR. + + 2011-04-18 Jason Merrill + + PR c++/48537 + * init.c (build_value_init): Handle UNION_TYPE the same. + + 2011-04-18 Jakub Jelinek + + PR c++/48632 + * parser.c (cp_parser_omp_for_loop): Don't use cp_parser_omp_for_incr + for type dependent pointers. + + 2011-04-13 Jason Merrill + + PR c++/48594 + * decl2.c (build_offset_ref_call_from_tree): Fix calling a functor + or pointer to (non-member) function. + + 2011-04-13 Jakub Jelinek + + PR c++/48570 + * semantics.c (cxx_eval_array_reference): Handle reading from + wchar_t, char16_t and char32_t STRING_CST. + + 2011-04-13 Dodji Seketeli + + PR c++/48574 + * class.c (fixed_type_or_null): We cannot determine the dynamic + type of a reference variable if its initializer is dependent. + + 2011-04-11 Jason Merrill + + PR c++/48534 + * cvt.c (ocp_convert): Use build_nop to convert to underlying type + of scoped enum. + + PR c++/48523 + * tree.c (maybe_dummy_object): Use build_x_indirect_ref rather + than cp_build_indirect_ref. + + 2011-04-07 Jason Merrill + + PR c++/48500 + * semantics.c (potential_constant_expression_1) [CALL_EXPR]: Check + arguments even if we don't know the function. + + PR c++/48468 + * except.c (build_noexcept_spec): Propagate error_mark_node. + (finish_noexcept_expr): Likewise. + + PR c++/48452 + * typeck.c (build_x_compound_expr_from_list): Return error_mark_node + in SFINAE context. + + * semantics.c (finish_decltype_type): Add complain parm. + * cp-tree.h: Adjust. + * parser.c (cp_parser_decltype): Adjust. + * pt.c (tsubst): Adjust. + + PR c++/48450 + * cvt.c (ocp_convert): Handle converting scoped enum to bool. + + 2011-03-31 Jason Merrill + + PR c++/48280 + * method.c (defaultable_fn_check): Templates are not defaultable. + + 2011-03-30 Jason Merrill + + PR c++/48212 + * semantics.c (non_const_var_error): Just return if DECL_INITIAL + is error_mark_node. + + PR c++/48369 + * semantics.c (potential_constant_expression_1): Handle + UNORDERED_EXPR and ORDERED_EXPR. + + PR c++/48281 + * semantics.c (finish_compound_literal): Do put static/constant + arrays in static variables. + + 2011-03-29 Jason Merrill + + PR c++/48265 + * pt.c (value_dependent_expression_p) [VAR_DECL]: Make sure + the variable is constant before looking at its initializer. + + PR c++/48319 + * pt.c (value_dependent_expression_p): Handle TEMPLATE_ID_EXPR. + + 2011-03-29 Jason Merrill + + PR c++/48166 + * decl.c (revert_static_member_fn): Strip function-cv-quals. + + PR c++/48296 + * decl.c (cp_finish_decl): Defer validation of constexpr member + functions. + * class.c (finalize_literal_type_property): Validate them here. + * semantics.c (is_valid_constexpr_fn): Don't check completeness. + + * semantics.c (is_valid_constexpr_fn): Specify input location. + + Core 1232 + * call.c (build_array_conv): New. + (implicit_conversion): Use it. + + * call.c (reference_binding): Allow direct binding to an array + rvalue. + + PR c++/48289 + * pt.c (build_non_dependent_expr): Keep dereferences outside the + NON_DEPENDENT_EXPR. + + PR c++/47999 + * semantics.c (finish_call_expr): Preserve reference semantics + in templates. + + PR c++/48313 + * pt.c (maybe_adjust_types_for_deduction): Handle T&& deduction + from overloaded function. + + Core 1148 + * typeck.c (check_return_expr): Fix conditions for setting + LOOKUP_PREFER_RVALUE. + + 2011-03-29 Rodrigo Rivas Costa + + * decl2.c (cp_check_const_attributes): New. + (cplus_decl_attributes): Call cp_check_const_attributes. + + 2011-03-29 Jason Merrill + + * semantics.c (push_cx_call_context): Return bool. + (cxx_eval_call_expression): Handle excess depth. + + * except.c (build_noexcept_spec): Call cxx_constant_value after + converting to bool. + + PR c++/47504 + * semantics.c (cxx_eval_constant_expression) [NOP_EXPR]: Don't let + the conversion set TREE_OVERFLOW. + + PR c++/47570 + * semantics.c (cxx_eval_constant_expression) [COMPOUND_EXPR]: Don't + use the generic binary expression handling. + 2011-03-25 Release Manager * GCC 4.6.0 released. diff -Nrcpad gcc-4.6.0/gcc/cp/Make-lang.in gcc-4.6.1/gcc/cp/Make-lang.in *** gcc-4.6.0/gcc/cp/Make-lang.in Sun Feb 13 19:57:30 2011 --- gcc-4.6.1/gcc/cp/Make-lang.in Thu May 19 08:00:50 2011 *************** *** 1,6 **** # Top level -*- makefile -*- fragment for GNU C++. # Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, ! # 2005, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. #This file is part of GCC. --- 1,6 ---- # Top level -*- makefile -*- fragment for GNU C++. # Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, ! # 2005, 2007, 2008, 2009, 2010, 2011 # Free Software Foundation, Inc. #This file is part of GCC. *************** cp/parser.o: cp/parser.c $(CXX_TREE_H) $ *** 318,324 **** gt-cp-parser.h output.h $(TARGET_H) $(PLUGIN_H) intl.h \ c-family/c-objc.h cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \ ! $(TM_H) coretypes.h pointer-set.h tree-iterator.h cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(CXX_TREE_H) $(TIMEVAR_H) gt-cp-name-lookup.h \ --- 318,324 ---- gt-cp-parser.h output.h $(TARGET_H) $(PLUGIN_H) intl.h \ c-family/c-objc.h cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \ ! $(TM_H) coretypes.h pointer-set.h tree-iterator.h $(SPLAY_TREE_H) cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(CXX_TREE_H) $(TIMEVAR_H) gt-cp-name-lookup.h \ diff -Nrcpad gcc-4.6.0/gcc/cp/call.c gcc-4.6.1/gcc/cp/call.c *** gcc-4.6.0/gcc/cp/call.c Wed Mar 16 20:03:01 2011 --- gcc-4.6.1/gcc/cp/call.c Tue Jun 14 22:13:36 2011 *************** build_aggr_conv (tree type, tree ctor, i *** 801,806 **** --- 801,853 ---- return c; } + /* Represent a conversion from CTOR, a braced-init-list, to TYPE, an + array type, if such a conversion is possible. */ + + static conversion * + build_array_conv (tree type, tree ctor, int flags) + { + conversion *c; + unsigned HOST_WIDE_INT len = CONSTRUCTOR_NELTS (ctor); + tree elttype = TREE_TYPE (type); + unsigned i; + tree val; + bool bad = false; + bool user = false; + enum conversion_rank rank = cr_exact; + + if (TYPE_DOMAIN (type)) + { + unsigned HOST_WIDE_INT alen = tree_low_cst (array_type_nelts_top (type), 1); + if (alen < len) + return NULL; + } + + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val) + { + conversion *sub + = implicit_conversion (elttype, TREE_TYPE (val), val, + false, flags); + if (sub == NULL) + return NULL; + + if (sub->rank > rank) + rank = sub->rank; + if (sub->user_conv_p) + user = true; + if (sub->bad_p) + bad = true; + } + + c = alloc_conversion (ck_aggr); + c->type = type; + c->rank = rank; + c->user_conv_p = user; + c->bad_p = bad; + c->u.next = NULL; + return c; + } + /* Build a representation of the identity conversion from EXPR to itself. The TYPE should match the type of EXPR, if EXPR is non-NULL. */ *************** reference_binding (tree rto, tree rfrom, *** 1429,1435 **** || (((CP_TYPE_CONST_NON_VOLATILE_P (to) && !(flags & LOOKUP_NO_TEMP_BIND)) || TYPE_REF_IS_RVALUE (rto)) ! && (CLASS_TYPE_P (from) || (expr && lvalue_p (expr)))))) { /* [dcl.init.ref] --- 1476,1484 ---- || (((CP_TYPE_CONST_NON_VOLATILE_P (to) && !(flags & LOOKUP_NO_TEMP_BIND)) || TYPE_REF_IS_RVALUE (rto)) ! && (CLASS_TYPE_P (from) ! || TREE_CODE (from) == ARRAY_TYPE ! || (expr && lvalue_p (expr)))))) { /* [dcl.init.ref] *************** implicit_conversion (tree to, tree from, *** 1621,1626 **** --- 1670,1677 ---- return conv; } } + else if (TREE_CODE (to) == ARRAY_TYPE) + return build_array_conv (to, expr, flags); } if (expr != NULL_TREE *************** convert_like_real (conversion *convs, tr *** 5430,5435 **** --- 5481,5488 ---- if (!BRACE_ENCLOSED_INITIALIZER_P (val)) check_narrowing (TREE_TYPE (sub), val); CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_ctor), NULL_TREE, sub); + if (!TREE_CONSTANT (sub)) + TREE_CONSTANT (new_ctor) = false; } /* Build up the array. */ elttype = cp_build_qualified_type *************** convert_arg_to_ellipsis (tree arg) *** 5671,5677 **** else if (NULLPTR_TYPE_P (arg_type)) arg = null_pointer_node; else if (INTEGRAL_OR_ENUMERATION_TYPE_P (arg_type)) ! arg = perform_integral_promotions (arg); arg = require_complete_type (arg); arg_type = TREE_TYPE (arg); --- 5724,5738 ---- else if (NULLPTR_TYPE_P (arg_type)) arg = null_pointer_node; else if (INTEGRAL_OR_ENUMERATION_TYPE_P (arg_type)) ! { ! if (SCOPED_ENUM_P (arg_type) && !abi_version_at_least (6)) ! { ! warning (OPT_Wabi, "scoped enum %qT will not promote to an " ! "integral type in a future version of GCC", arg_type); ! arg = cp_convert (ENUM_UNDERLYING_TYPE (arg_type), arg); ! } ! arg = perform_integral_promotions (arg); ! } arg = require_complete_type (arg); arg_type = TREE_TYPE (arg); *************** perform_implicit_conversion_flags (tree *** 8006,8012 **** else if (invalid_nonstatic_memfn_p (expr, complain)) /* We gave an error. */; else ! error ("could not convert %qE to %qT", expr, type); } expr = error_mark_node; } --- 8067,8074 ---- else if (invalid_nonstatic_memfn_p (expr, complain)) /* We gave an error. */; else ! error ("could not convert %qE from %qT to %qT", expr, ! TREE_TYPE (expr), type); } expr = error_mark_node; } diff -Nrcpad gcc-4.6.0/gcc/cp/class.c gcc-4.6.1/gcc/cp/class.c *** gcc-4.6.0/gcc/cp/class.c Mon Feb 28 21:41:21 2011 --- gcc-4.6.1/gcc/cp/class.c Tue Jun 14 22:13:29 2011 *************** build_base_path (enum tree_code code, *** 289,294 **** --- 289,300 ---- offset = BINFO_OFFSET (binfo); fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull); target_type = code == PLUS_EXPR ? BINFO_TYPE (binfo) : BINFO_TYPE (d_binfo); + /* TARGET_TYPE has been extracted from BINFO, and, is therefore always + cv-unqualified. Extract the cv-qualifiers from EXPR so that the + expression returned matches the input. */ + target_type = cp_build_qualified_type + (target_type, cp_type_quals (TREE_TYPE (TREE_TYPE (expr)))); + ptr_target_type = build_pointer_type (target_type); /* Do we need to look in the vtable for the real offset? */ virtual_access = (v_binfo && fixed_type_p <= 0); *************** build_base_path (enum tree_code code, *** 297,303 **** source type is incomplete and the pointer value doesn't matter. */ if (cp_unevaluated_operand != 0) { ! expr = build_nop (build_pointer_type (target_type), expr); if (!want_pointer) expr = build_indirect_ref (EXPR_LOCATION (expr), expr, RO_NULL); return expr; --- 303,309 ---- source type is incomplete and the pointer value doesn't matter. */ if (cp_unevaluated_operand != 0) { ! expr = build_nop (ptr_target_type, expr); if (!want_pointer) expr = build_indirect_ref (EXPR_LOCATION (expr), expr, RO_NULL); return expr; *************** build_base_path (enum tree_code code, *** 312,329 **** field, because other parts of the compiler know that such expressions are always non-NULL. */ if (!virtual_access && integer_zerop (offset)) ! { ! tree class_type; ! /* TARGET_TYPE has been extracted from BINFO, and, is ! therefore always cv-unqualified. Extract the ! cv-qualifiers from EXPR so that the expression returned ! matches the input. */ ! class_type = TREE_TYPE (TREE_TYPE (expr)); ! target_type ! = cp_build_qualified_type (target_type, ! cp_type_quals (class_type)); ! return build_nop (build_pointer_type (target_type), expr); ! } null_test = error_mark_node; } --- 318,324 ---- field, because other parts of the compiler know that such expressions are always non-NULL. */ if (!virtual_access && integer_zerop (offset)) ! return build_nop (ptr_target_type, expr); null_test = error_mark_node; } *************** build_base_path (enum tree_code code, *** 407,415 **** offset = v_offset; } - target_type = cp_build_qualified_type - (target_type, cp_type_quals (TREE_TYPE (TREE_TYPE (expr)))); - ptr_target_type = build_pointer_type (target_type); if (want_pointer) target_type = ptr_target_type; --- 402,407 ---- *************** type_requires_array_cookie (tree type) *** 4547,4552 **** --- 4539,4546 ---- static void finalize_literal_type_property (tree t) { + tree fn; + if (cxx_dialect < cxx0x || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) /* FIXME These constraints seem unnecessary; remove from standard. *************** finalize_literal_type_property (tree t) *** 4557,4574 **** && !TYPE_HAS_CONSTEXPR_CTOR (t)) CLASSTYPE_LITERAL_P (t) = false; ! if (!CLASSTYPE_LITERAL_P (t) && !CLASSTYPE_TEMPLATE_INSTANTIATION (t)) ! { ! tree fn; ! for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn)) ! if (DECL_DECLARED_CONSTEXPR_P (fn) ! && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) ! && !DECL_CONSTRUCTOR_P (fn)) ! { ! error ("enclosing class of %q+D is not a literal type", fn); ! DECL_DECLARED_CONSTEXPR_P (fn) = false; ! } ! } } /* Check the validity of the bases and members declared in T. Add any --- 4551,4567 ---- && !TYPE_HAS_CONSTEXPR_CTOR (t)) CLASSTYPE_LITERAL_P (t) = false; ! if (!CLASSTYPE_LITERAL_P (t)) ! for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn)) ! if (DECL_DECLARED_CONSTEXPR_P (fn) ! && TREE_CODE (fn) != TEMPLATE_DECL ! && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) ! && !DECL_CONSTRUCTOR_P (fn)) ! { ! DECL_DECLARED_CONSTEXPR_P (fn) = false; ! if (!DECL_TEMPLATE_INFO (fn)) ! error ("enclosing class of %q+#D is not a literal type", fn); ! } } /* Check the validity of the bases and members declared in T. Add any *************** fixed_type_or_null (tree instance, int * *** 5943,5948 **** --- 5936,5942 ---- itself. */ if (TREE_CODE (instance) == VAR_DECL && DECL_INITIAL (instance) + && !type_dependent_expression_p_push (DECL_INITIAL (instance)) && !htab_find (ht, instance)) { tree type; *************** resolves_to_fixed_type_p (tree instance, *** 5983,5989 **** { tree t = TREE_TYPE (instance); int cdtorp = 0; ! tree fixed = fixed_type_or_null (instance, nonnull, &cdtorp); if (fixed == NULL_TREE) return 0; if (POINTER_TYPE_P (t)) --- 5977,5993 ---- { tree t = TREE_TYPE (instance); int cdtorp = 0; ! tree fixed; ! ! if (processing_template_decl) ! { ! /* In a template we only care about the type of the result. */ ! if (nonnull) ! *nonnull = true; ! return true; ! } ! ! fixed = fixed_type_or_null (instance, nonnull, &cdtorp); if (fixed == NULL_TREE) return 0; if (POINTER_TYPE_P (t)) diff -Nrcpad gcc-4.6.0/gcc/cp/cp-gimplify.c gcc-4.6.1/gcc/cp/cp-gimplify.c *** gcc-4.6.0/gcc/cp/cp-gimplify.c Wed Dec 15 17:50:34 2010 --- gcc-4.6.1/gcc/cp/cp-gimplify.c Thu May 19 08:00:50 2011 *************** *** 1,6 **** /* C++-specific tree lowering bits; see also c-gimplify.c and tree-gimple.c. ! Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Jason Merrill --- 1,6 ---- /* C++-specific tree lowering bits; see also c-gimplify.c and tree-gimple.c. ! Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Jason Merrill *************** along with GCC; see the file COPYING3. *** 32,37 **** --- 32,38 ---- #include "hashtab.h" #include "pointer-set.h" #include "flags.h" + #include "splay-tree.h" /* Local declarations. */ *************** cxx_int_tree_map_hash (const void *item) *** 731,740 **** --- 732,836 ---- return ((const struct cxx_int_tree_map *)item)->uid; } + /* A stable comparison routine for use with splay trees and DECLs. */ + + static int + splay_tree_compare_decl_uid (splay_tree_key xa, splay_tree_key xb) + { + tree a = (tree) xa; + tree b = (tree) xb; + + return DECL_UID (a) - DECL_UID (b); + } + + /* OpenMP context during genericization. */ + + struct cp_genericize_omp_taskreg + { + bool is_parallel; + bool default_shared; + struct cp_genericize_omp_taskreg *outer; + splay_tree variables; + }; + + /* Return true if genericization should try to determine if + DECL is firstprivate or shared within task regions. */ + + static bool + omp_var_to_track (tree decl) + { + tree type = TREE_TYPE (decl); + if (is_invisiref_parm (decl)) + type = TREE_TYPE (type); + while (TREE_CODE (type) == ARRAY_TYPE) + type = TREE_TYPE (type); + if (type == error_mark_node || !CLASS_TYPE_P (type)) + return false; + if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl)) + return false; + if (cxx_omp_predetermined_sharing (decl) != OMP_CLAUSE_DEFAULT_UNSPECIFIED) + return false; + return true; + } + + /* Note DECL use in OpenMP region OMP_CTX during genericization. */ + + static void + omp_cxx_notice_variable (struct cp_genericize_omp_taskreg *omp_ctx, tree decl) + { + splay_tree_node n = splay_tree_lookup (omp_ctx->variables, + (splay_tree_key) decl); + if (n == NULL) + { + int flags = OMP_CLAUSE_DEFAULT_SHARED; + if (omp_ctx->outer) + omp_cxx_notice_variable (omp_ctx->outer, decl); + if (!omp_ctx->default_shared) + { + struct cp_genericize_omp_taskreg *octx; + + for (octx = omp_ctx->outer; octx; octx = octx->outer) + { + n = splay_tree_lookup (octx->variables, (splay_tree_key) decl); + if (n && n->value != OMP_CLAUSE_DEFAULT_SHARED) + { + flags = OMP_CLAUSE_DEFAULT_FIRSTPRIVATE; + break; + } + if (octx->is_parallel) + break; + } + if (octx == NULL + && (TREE_CODE (decl) == PARM_DECL + || (!(TREE_STATIC (decl) || DECL_EXTERNAL (decl)) + && DECL_CONTEXT (decl) == current_function_decl))) + flags = OMP_CLAUSE_DEFAULT_FIRSTPRIVATE; + if (flags == OMP_CLAUSE_DEFAULT_FIRSTPRIVATE) + { + /* DECL is implicitly determined firstprivate in + the current task construct. Ensure copy ctor and + dtor are instantiated, because during gimplification + it will be already too late. */ + tree type = TREE_TYPE (decl); + if (is_invisiref_parm (decl)) + type = TREE_TYPE (type); + while (TREE_CODE (type) == ARRAY_TYPE) + type = TREE_TYPE (type); + get_copy_ctor (type, tf_none); + get_dtor (type, tf_none); + } + } + splay_tree_insert (omp_ctx->variables, (splay_tree_key) decl, flags); + } + } + + /* Genericization context. */ + struct cp_genericize_data { struct pointer_set_t *p_set; VEC (tree, heap) *bind_expr_stack; + struct cp_genericize_omp_taskreg *omp_ctx; }; /* Perform any pre-gimplification lowering of C++ front end trees to *************** cp_genericize_r (tree *stmt_p, int *walk *** 747,752 **** --- 843,856 ---- struct cp_genericize_data *wtd = (struct cp_genericize_data *) data; struct pointer_set_t *p_set = wtd->p_set; + /* If in an OpenMP context, note var uses. */ + if (__builtin_expect (wtd->omp_ctx != NULL, 0) + && (TREE_CODE (stmt) == VAR_DECL + || TREE_CODE (stmt) == PARM_DECL + || TREE_CODE (stmt) == RESULT_DECL) + && omp_var_to_track (stmt)) + omp_cxx_notice_variable (wtd->omp_ctx, stmt); + if (is_invisiref_parm (stmt) /* Don't dereference parms in a thunk, pass the references through. */ && !(DECL_THUNK_P (current_function_decl) *************** cp_genericize_r (tree *stmt_p, int *walk *** 786,791 **** --- 890,899 ---- if (TREE_CODE (stmt) == ADDR_EXPR && is_invisiref_parm (TREE_OPERAND (stmt, 0))) { + /* If in an OpenMP context, note var uses. */ + if (__builtin_expect (wtd->omp_ctx != NULL, 0) + && omp_var_to_track (TREE_OPERAND (stmt, 0))) + omp_cxx_notice_variable (wtd->omp_ctx, TREE_OPERAND (stmt, 0)); *stmt_p = convert (TREE_TYPE (stmt), TREE_OPERAND (stmt, 0)); *walk_subtrees = 0; } *************** cp_genericize_r (tree *stmt_p, int *walk *** 808,813 **** --- 916,937 ---- } break; case OMP_CLAUSE_PRIVATE: + /* Don't dereference an invisiref in OpenMP clauses. */ + if (is_invisiref_parm (OMP_CLAUSE_DECL (stmt))) + *walk_subtrees = 0; + else if (wtd->omp_ctx != NULL) + { + /* Private clause doesn't cause any references to the + var in outer contexts, avoid calling + omp_cxx_notice_variable for it. */ + struct cp_genericize_omp_taskreg *old = wtd->omp_ctx; + wtd->omp_ctx = NULL; + cp_walk_tree (&OMP_CLAUSE_DECL (stmt), cp_genericize_r, + data, NULL); + wtd->omp_ctx = old; + *walk_subtrees = 0; + } + break; case OMP_CLAUSE_SHARED: case OMP_CLAUSE_FIRSTPRIVATE: case OMP_CLAUSE_COPYIN: *************** cp_genericize_r (tree *stmt_p, int *walk *** 876,881 **** --- 1000,1024 ---- else if (TREE_CODE (stmt) == BIND_EXPR) { + if (__builtin_expect (wtd->omp_ctx != NULL, 0)) + { + tree decl; + for (decl = BIND_EXPR_VARS (stmt); decl; decl = DECL_CHAIN (decl)) + if (TREE_CODE (decl) == VAR_DECL + && !DECL_EXTERNAL (decl) + && omp_var_to_track (decl)) + { + splay_tree_node n + = splay_tree_lookup (wtd->omp_ctx->variables, + (splay_tree_key) decl); + if (n == NULL) + splay_tree_insert (wtd->omp_ctx->variables, + (splay_tree_key) decl, + TREE_STATIC (decl) + ? OMP_CLAUSE_DEFAULT_SHARED + : OMP_CLAUSE_DEFAULT_PRIVATE); + } + } VEC_safe_push (tree, heap, wtd->bind_expr_stack, stmt); cp_walk_tree (&BIND_EXPR_BODY (stmt), cp_genericize_r, data, NULL); *************** cp_genericize_r (tree *stmt_p, int *walk *** 922,927 **** --- 1065,1114 ---- *stmt_p = build1 (NOP_EXPR, void_type_node, integer_zero_node); *walk_subtrees = 0; } + else if (TREE_CODE (stmt) == OMP_PARALLEL || TREE_CODE (stmt) == OMP_TASK) + { + struct cp_genericize_omp_taskreg omp_ctx; + tree c, decl; + splay_tree_node n; + + *walk_subtrees = 0; + cp_walk_tree (&OMP_CLAUSES (stmt), cp_genericize_r, data, NULL); + omp_ctx.is_parallel = TREE_CODE (stmt) == OMP_PARALLEL; + omp_ctx.default_shared = omp_ctx.is_parallel; + omp_ctx.outer = wtd->omp_ctx; + omp_ctx.variables = splay_tree_new (splay_tree_compare_decl_uid, 0, 0); + wtd->omp_ctx = &omp_ctx; + for (c = OMP_CLAUSES (stmt); c; c = OMP_CLAUSE_CHAIN (c)) + switch (OMP_CLAUSE_CODE (c)) + { + case OMP_CLAUSE_SHARED: + case OMP_CLAUSE_PRIVATE: + case OMP_CLAUSE_FIRSTPRIVATE: + case OMP_CLAUSE_LASTPRIVATE: + decl = OMP_CLAUSE_DECL (c); + if (decl == error_mark_node || !omp_var_to_track (decl)) + break; + n = splay_tree_lookup (omp_ctx.variables, (splay_tree_key) decl); + if (n != NULL) + break; + splay_tree_insert (omp_ctx.variables, (splay_tree_key) decl, + OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED + ? OMP_CLAUSE_DEFAULT_SHARED + : OMP_CLAUSE_DEFAULT_PRIVATE); + if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_PRIVATE + && omp_ctx.outer) + omp_cxx_notice_variable (omp_ctx.outer, decl); + break; + case OMP_CLAUSE_DEFAULT: + if (OMP_CLAUSE_DEFAULT_KIND (c) == OMP_CLAUSE_DEFAULT_SHARED) + omp_ctx.default_shared = true; + default: + break; + } + cp_walk_tree (&OMP_BODY (stmt), cp_genericize_r, data, NULL); + wtd->omp_ctx = omp_ctx.outer; + splay_tree_delete (omp_ctx.variables); + } pointer_set_insert (p_set, *stmt_p); *************** cp_genericize (tree fndecl) *** 985,990 **** --- 1172,1178 ---- walk_tree's hash functionality. */ wtd.p_set = pointer_set_create (); wtd.bind_expr_stack = NULL; + wtd.omp_ctx = NULL; cp_walk_tree (&DECL_SAVED_TREE (fndecl), cp_genericize_r, &wtd, NULL); pointer_set_destroy (wtd.p_set); VEC_free (tree, heap, wtd.bind_expr_stack); diff -Nrcpad gcc-4.6.0/gcc/cp/cp-tree.h gcc-4.6.1/gcc/cp/cp-tree.h *** gcc-4.6.0/gcc/cp/cp-tree.h Thu Mar 3 02:49:19 2011 --- gcc-4.6.1/gcc/cp/cp-tree.h Thu May 19 08:00:50 2011 *************** extern tree build_offset_ref (tree, tr *** 4958,4963 **** --- 4958,4964 ---- extern tree build_new (VEC(tree,gc) **, tree, tree, VEC(tree,gc) **, int, tsubst_flags_t); + extern tree get_temp_regvar (tree, tree); extern tree build_vec_init (tree, tree, tree, bool, int, tsubst_flags_t); extern tree build_delete (tree, tree, *************** extern tree lazily_declare_fn (special *** 5002,5011 **** extern tree skip_artificial_parms_for (const_tree, tree); extern int num_artificial_parms_for (const_tree); extern tree make_alias_for (tree, tree); ! extern tree get_copy_ctor (tree); extern tree get_copy_assign (tree); extern tree get_default_ctor (tree); ! extern tree get_dtor (tree); extern tree locate_ctor (tree); /* In optimize.c */ --- 5003,5012 ---- extern tree skip_artificial_parms_for (const_tree, tree); extern int num_artificial_parms_for (const_tree); extern tree make_alias_for (tree, tree); ! extern tree get_copy_ctor (tree, tsubst_flags_t); extern tree get_copy_assign (tree); extern tree get_default_ctor (tree); ! extern tree get_dtor (tree, tsubst_flags_t); extern tree locate_ctor (tree); /* In optimize.c */ *************** extern tree baselink_for_fns *** 5344,5350 **** extern void finish_static_assert (tree, tree, location_t, bool); extern tree describable_type (tree); ! extern tree finish_decltype_type (tree, bool); extern tree finish_trait_expr (enum cp_trait_kind, tree, tree); extern tree build_lambda_expr (void); extern tree build_lambda_object (tree); --- 5345,5351 ---- extern void finish_static_assert (tree, tree, location_t, bool); extern tree describable_type (tree); ! extern tree finish_decltype_type (tree, bool, tsubst_flags_t); extern tree finish_trait_expr (enum cp_trait_kind, tree, tree); extern tree build_lambda_expr (void); extern tree build_lambda_object (tree); *************** extern tree get_fns (tree); *** 5409,5414 **** --- 5410,5416 ---- extern tree get_first_fn (tree); extern tree ovl_cons (tree, tree); extern tree build_overload (tree, tree); + extern bool non_static_member_function_p (tree); extern const char *cxx_printable_name (tree, int); extern const char *cxx_printable_name_translate (tree, int); extern tree build_exception_variant (tree, tree); diff -Nrcpad gcc-4.6.0/gcc/cp/cvt.c gcc-4.6.1/gcc/cp/cvt.c *** gcc-4.6.0/gcc/cp/cvt.c Thu Feb 17 20:44:14 2011 --- gcc-4.6.1/gcc/cp/cvt.c Sun May 22 00:28:44 2011 *************** ocp_convert (tree type, tree expr, int c *** 727,733 **** return error_mark_node; } if (code == BOOLEAN_TYPE) ! return cp_truthvalue_conversion (e); converted = fold_if_not_in_template (convert_to_integer (type, e)); --- 727,739 ---- return error_mark_node; } if (code == BOOLEAN_TYPE) ! { ! /* We can't implicitly convert a scoped enum to bool, so convert ! to the underlying type first. */ ! if (SCOPED_ENUM_P (intype) && (convtype & CONV_STATIC)) ! e = build_nop (ENUM_UNDERLYING_TYPE (intype), e); ! return cp_truthvalue_conversion (e); ! } converted = fold_if_not_in_template (convert_to_integer (type, e)); *************** type_promotes_to (tree type) *** 1615,1620 **** --- 1621,1629 ---- int precision = MAX (TYPE_PRECISION (type), TYPE_PRECISION (integer_type_node)); tree totype = c_common_type_for_size (precision, 0); + if (SCOPED_ENUM_P (type)) + warning (OPT_Wabi, "scoped enum %qT will not promote to an integral " + "type in a future version of GCC", type); if (TREE_CODE (type) == ENUMERAL_TYPE) type = ENUM_UNDERLYING_TYPE (type); if (TYPE_UNSIGNED (type) diff -Nrcpad gcc-4.6.0/gcc/cp/decl.c gcc-4.6.1/gcc/cp/decl.c *** gcc-4.6.0/gcc/cp/decl.c Wed Mar 16 20:03:12 2011 --- gcc-4.6.1/gcc/cp/decl.c Sat May 28 03:22:31 2011 *************** duplicate_decls (tree newdecl, tree oldd *** 1686,1691 **** --- 1686,1692 ---- error ("deleted definition of %qD", newdecl); error ("after previous declaration %q+D", olddecl); } + DECL_DELETED_FN (newdecl) |= DECL_DELETED_FN (olddecl); } /* Deal with C++: must preserve virtual function table size. */ *************** check_omp_return (void) *** 2807,2812 **** --- 2808,2815 ---- error ("invalid exit from OpenMP structured block"); return false; } + else if (b->kind == sk_function_parms) + break; return true; } *************** pop_switch (void) *** 2917,2922 **** --- 2920,2947 ---- free (cs); } + /* Convert a case constant VALUE in a switch to the type TYPE of the switch + condition. Note that if TYPE and VALUE are already integral we don't + really do the conversion because the language-independent + warning/optimization code will work better that way. */ + + static tree + case_conversion (tree type, tree value) + { + if (value == NULL_TREE) + return value; + + if (cxx_dialect >= cxx0x + && (SCOPED_ENUM_P (type) + || !INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (value)))) + { + if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type)) + type = type_promotes_to (type); + value = perform_implicit_conversion (type, value, tf_warning_or_error); + } + return cxx_constant_value (value); + } + /* Note that we've seen a definition of a case label, and complain if this is a bad place for one. */ *************** finish_case_label (location_t loc, tree *** 2925,2930 **** --- 2950,2956 ---- { tree cond, r; struct cp_binding_level *p; + tree type; if (processing_template_decl) { *************** finish_case_label (location_t loc, tree *** 2944,2956 **** if (!check_switch_goto (switch_stack->level)) return error_mark_node; ! if (low_value) ! low_value = cxx_constant_value (low_value); ! if (high_value) ! high_value = cxx_constant_value (high_value); ! r = c_add_case_label (loc, switch_stack->cases, cond, ! SWITCH_STMT_TYPE (switch_stack->switch_stmt), low_value, high_value); /* After labels, make any new cleanups in the function go into their --- 2970,2981 ---- if (!check_switch_goto (switch_stack->level)) return error_mark_node; ! type = SWITCH_STMT_TYPE (switch_stack->switch_stmt); ! low_value = case_conversion (type, low_value); ! high_value = case_conversion (type, high_value); ! ! r = c_add_case_label (loc, switch_stack->cases, cond, type, low_value, high_value); /* After labels, make any new cleanups in the function go into their *************** reshape_init_array_1 (tree elt_type, tre *** 4904,4909 **** --- 4929,4936 ---- return error_mark_node; CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_init), size_int (index), elt_init); + if (!TREE_CONSTANT (elt_init)) + TREE_CONSTANT (new_init) = false; } return new_init; *************** cp_finish_decl (tree decl, tree init, bo *** 5733,5739 **** const char *asmspec = NULL; int was_readonly = 0; bool var_definition_p = false; - int saved_processing_template_decl; tree auto_node; if (decl == error_mark_node) --- 5760,5765 ---- *************** cp_finish_decl (tree decl, tree init, bo *** 5755,5761 **** /* Assume no cleanup is required. */ cleanup = NULL_TREE; - saved_processing_template_decl = processing_template_decl; /* If a name was specified, get the string. */ if (global_scope_p (current_binding_level)) --- 5781,5786 ---- *************** cp_finish_decl (tree decl, tree init, bo *** 5793,5802 **** } } ! if (TREE_CODE (decl) == FUNCTION_DECL) ! validate_constexpr_fundecl (decl); ! ! else if (!ensure_literal_type_for_constexpr_object (decl)) DECL_DECLARED_CONSTEXPR_P (decl) = 0; if (init && TREE_CODE (decl) == FUNCTION_DECL) --- 5818,5824 ---- } } ! if (!ensure_literal_type_for_constexpr_object (decl)) DECL_DECLARED_CONSTEXPR_P (decl) = 0; if (init && TREE_CODE (decl) == FUNCTION_DECL) *************** cp_finish_decl (tree decl, tree init, bo *** 5858,5896 **** template is instantiated. But, if DECL is a variable constant then it can be used in future constant expressions, so its value must be available. */ ! if (!(init ! && DECL_CLASS_SCOPE_P (decl) ! /* We just set TREE_CONSTANT appropriately; see above. */ ! && TREE_CONSTANT (decl) ! && !type_dependent_p ! /* FIXME non-value-dependent constant expression */ ! && !value_dependent_init_p (init))) { ! if (init) ! DECL_INITIAL (decl) = init; ! if (TREE_CODE (decl) == VAR_DECL ! && !DECL_PRETTY_FUNCTION_P (decl) ! && !type_dependent_p) ! maybe_deduce_size_from_array_init (decl, init); ! goto finish_end; } ! if (TREE_CODE (init) == TREE_LIST) ! { ! /* If the parenthesized-initializer form was used (e.g., ! "int A::i(X)"), then INIT will be a TREE_LIST of initializer ! arguments. (There is generally only one.) We convert them ! individually. */ ! tree list = init; ! for (; list; list = TREE_CHAIN (list)) ! { ! tree elt = TREE_VALUE (list); ! TREE_VALUE (list) = fold_non_dependent_expr (elt); ! } ! } ! else ! init = fold_non_dependent_expr (init); ! processing_template_decl = 0; } /* Take care of TYPE_DECLs up front. */ --- 5880,5903 ---- template is instantiated. But, if DECL is a variable constant then it can be used in future constant expressions, so its value must be available. */ ! if (init ! && init_const_expr_p ! && !type_dependent_p ! && decl_maybe_constant_var_p (decl) ! && !value_dependent_init_p (init)) { ! tree init_code = check_initializer (decl, init, flags, &cleanup); ! if (init_code == NULL_TREE) ! init = NULL_TREE; } + else if (TREE_CODE (decl) == VAR_DECL + && !DECL_PRETTY_FUNCTION_P (decl) + && !type_dependent_p) + maybe_deduce_size_from_array_init (decl, init); ! if (init) ! DECL_INITIAL (decl) = init; ! return; } /* Take care of TYPE_DECLs up front. */ *************** cp_finish_decl (tree decl, tree init, bo *** 5913,5919 **** rest_of_decl_compilation (decl, DECL_FILE_SCOPE_P (decl), at_eof); ! goto finish_end; } /* A reference will be modified here, as it is initialized. */ --- 5920,5926 ---- rest_of_decl_compilation (decl, DECL_FILE_SCOPE_P (decl), at_eof); ! return; } /* A reference will be modified here, as it is initialized. */ *************** cp_finish_decl (tree decl, tree init, bo *** 6037,6044 **** 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 --- 6044,6050 ---- else if (TREE_CODE (type) == ARRAY_TYPE) layout_type (type); ! if (TREE_STATIC (decl) && !at_function_scope_p () && current_function_decl == NULL) /* So decl is a global variable or a static member of a *************** cp_finish_decl (tree decl, tree init, bo *** 6058,6066 **** /* Let the middle end know about variables and functions -- but not static data members in uninstantiated class templates. */ ! if (!saved_processing_template_decl ! && (TREE_CODE (decl) == VAR_DECL ! || TREE_CODE (decl) == FUNCTION_DECL)) { if (TREE_CODE (decl) == VAR_DECL) { --- 6064,6071 ---- /* Let the middle end know about variables and functions -- but not static data members in uninstantiated class templates. */ ! if (TREE_CODE (decl) == VAR_DECL ! || TREE_CODE (decl) == FUNCTION_DECL) { if (TREE_CODE (decl) == VAR_DECL) { *************** cp_finish_decl (tree decl, tree init, bo *** 6147,6155 **** if (cleanup) push_cleanup (decl, cleanup, false); - finish_end: - processing_template_decl = saved_processing_template_decl; - if (was_readonly) TREE_READONLY (decl) = 1; } --- 6152,6157 ---- *************** check_static_variable_definition (tree d *** 7488,7493 **** --- 7490,7528 ---- return 0; } + /* *expr_p is part of the TYPE_SIZE of a variably-sized array. If any + SAVE_EXPRs in *expr_p wrap expressions with side-effects, break those + expressions out into temporary variables so that walk_tree doesn't + step into them (c++/15764). */ + + static tree + stabilize_save_expr_r (tree *expr_p, int *walk_subtrees, void *data) + { + struct pointer_set_t *pset = (struct pointer_set_t *)data; + tree expr = *expr_p; + if (TREE_CODE (expr) == SAVE_EXPR) + { + tree op = TREE_OPERAND (expr, 0); + cp_walk_tree (&op, stabilize_save_expr_r, data, pset); + if (TREE_SIDE_EFFECTS (op)) + TREE_OPERAND (expr, 0) = get_temp_regvar (TREE_TYPE (op), op); + *walk_subtrees = 0; + } + else if (!EXPR_P (expr) || !TREE_SIDE_EFFECTS (expr)) + *walk_subtrees = 0; + return NULL; + } + + /* Entry point for the above. */ + + static void + stabilize_vla_size (tree size) + { + struct pointer_set_t *pset = pointer_set_create (); + /* Break out any function calls into temporary variables. */ + cp_walk_tree (&size, stabilize_save_expr_r, pset, pset); + } + /* Given the SIZE (i.e., number of elements) in an array, compute an appropriate index type for the array. If non-NULL, NAME is the name of the thing being declared. */ *************** grokdeclarator (const cp_declarator *dec *** 8518,8529 **** || thread_p) error ("storage class specifiers invalid in parameter declarations"); - if (type_uses_auto (type)) - { - error ("parameter declared %"); - type = error_mark_node; - } - /* Function parameters cannot be constexpr. If we saw one, moan and pretend it wasn't there. */ if (constexpr_p) --- 8553,8558 ---- *************** grokdeclarator (const cp_declarator *dec *** 8940,8946 **** && (decl_context == NORMAL || decl_context == FIELD) && at_function_scope_p () && variably_modified_type_p (type, NULL_TREE)) ! finish_expr_stmt (TYPE_SIZE (type)); if (declarator->kind == cdk_reference) { --- 8969,8980 ---- && (decl_context == NORMAL || decl_context == FIELD) && at_function_scope_p () && variably_modified_type_p (type, NULL_TREE)) ! { ! /* First break out any side-effects. */ ! stabilize_vla_size (TYPE_SIZE (type)); ! /* And then force evaluation of the SAVE_EXPR. */ ! finish_expr_stmt (TYPE_SIZE (type)); ! } if (declarator->kind == cdk_reference) { *************** grokdeclarator (const cp_declarator *dec *** 8955,8967 **** to create the type "rvalue reference to cv TD' creates the type TD." */ ! if (!VOID_TYPE_P (type)) type = cp_build_reference_type ! ((TREE_CODE (type) == REFERENCE_TYPE ! ? TREE_TYPE (type) : type), ! (declarator->u.reference.rvalue_ref ! && (TREE_CODE(type) != REFERENCE_TYPE ! || TYPE_REF_IS_RVALUE (type)))); /* In C++0x, we need this check for direct reference to reference declarations, which are forbidden by --- 8989,9006 ---- to create the type "rvalue reference to cv TD' creates the type TD." */ ! if (VOID_TYPE_P (type)) ! /* We already gave an error. */; ! else if (TREE_CODE (type) == REFERENCE_TYPE) ! { ! if (declarator->u.reference.rvalue_ref) ! /* Leave type alone. */; ! else ! type = cp_build_reference_type (TREE_TYPE (type), false); ! } ! else type = cp_build_reference_type ! (type, declarator->u.reference.rvalue_ref); /* In C++0x, we need this check for direct reference to reference declarations, which are forbidden by *************** grokdeclarator (const cp_declarator *dec *** 9015,9020 **** --- 9054,9067 ---- } } + /* We need to stabilize side-effects in VLA sizes for regular array + declarations too, not just pointers to arrays. */ + if (type != error_mark_node && !TYPE_NAME (type) + && (decl_context == NORMAL || decl_context == FIELD) + && at_function_scope_p () + && variably_modified_type_p (type, NULL_TREE)) + stabilize_vla_size (TYPE_SIZE (type)); + /* A `constexpr' specifier used in an object declaration declares the object as `const'. */ if (constexpr_p && innermost_code != cdk_function) *************** grokdeclarator (const cp_declarator *dec *** 9256,9261 **** --- 9303,9314 ---- memfn_quals = TYPE_UNQUALIFIED; } + if (type_uses_auto (type)) + { + error ("typedef declared %"); + type = error_mark_node; + } + if (decl_context == FIELD) decl = build_lang_decl (TYPE_DECL, unqualified_id, type); else *************** grokdeclarator (const cp_declarator *dec *** 9496,9501 **** --- 9549,9560 ---- if (ctype || in_namespace) error ("cannot use %<::%> in parameter declaration"); + if (type_uses_auto (type)) + { + error ("parameter declared %"); + type = error_mark_node; + } + /* A parameter declared as an array of T is really a pointer to T. One declared as a function is really a pointer to a function. One declared as a member is really a pointer to member. */ *************** grokparms (tree parmlist, tree *parms) *** 10271,10282 **** init = check_default_argument (decl, init); } - if (TREE_CODE (decl) == PARM_DECL - && FUNCTION_PARAMETER_PACK_P (decl) - && TREE_CHAIN (parm) - && TREE_CHAIN (parm) != void_list_node) - error ("parameter packs must be at the end of the parameter list"); - DECL_CHAIN (decl) = decls; decls = decl; result = tree_cons (init, type, result); --- 10330,10335 ---- *************** start_preparsed_function (tree decl1, tr *** 12372,12377 **** --- 12425,12431 ---- DECL_EXTERNAL (decl1) = 0; if (ctx != NULL_TREE && DECL_DECLARED_INLINE_P (ctx) + && !processing_template_decl && TREE_PUBLIC (ctx)) /* This is a function in a local class in an extern inline function. */ *************** use_eh_spec_block (tree fn) *** 12516,12522 **** not creating the EH_SPEC_BLOCK we save a little memory, and we avoid spurious warnings about unreachable code. */ ! && !DECL_ARTIFICIAL (fn)); } /* Store the parameter declarations into the current function declaration. --- 12570,12576 ---- not creating the EH_SPEC_BLOCK we save a little memory, and we avoid spurious warnings about unreachable code. */ ! && !DECL_DEFAULTED_FN (fn)); } /* Store the parameter declarations into the current function declaration. *************** static_fn_type (tree memfntype) *** 13339,13348 **** void revert_static_member_fn (tree decl) { ! TREE_TYPE (decl) = static_fn_type (decl); ! if (cp_type_quals (TREE_TYPE (decl)) != TYPE_UNQUALIFIED) ! error ("static member function %q#D declared with type qualifiers", decl); if (DECL_ARGUMENTS (decl)) DECL_ARGUMENTS (decl) = DECL_CHAIN (DECL_ARGUMENTS (decl)); --- 13393,13411 ---- void revert_static_member_fn (tree decl) { ! tree stype = static_fn_type (decl); ! cp_cv_quals quals = type_memfn_quals (stype); ! if (quals != TYPE_UNQUALIFIED) ! { ! if (quals == TYPE_QUAL_CONST && DECL_DECLARED_CONSTEXPR_P (decl)) ! /* The const was implicit, don't complain. */; ! else ! error ("static member function %q#D declared with type qualifiers", ! decl); ! stype = apply_memfn_quals (stype, TYPE_UNQUALIFIED); ! } ! TREE_TYPE (decl) = stype; if (DECL_ARGUMENTS (decl)) DECL_ARGUMENTS (decl) = DECL_CHAIN (DECL_ARGUMENTS (decl)); diff -Nrcpad gcc-4.6.0/gcc/cp/decl2.c gcc-4.6.1/gcc/cp/decl2.c *** gcc-4.6.0/gcc/cp/decl2.c Tue Mar 1 22:44:26 2011 --- gcc-4.6.1/gcc/cp/decl2.c Thu Jun 23 16:56:27 2011 *************** cp_reconstruct_complex_type (tree type, *** 1264,1269 **** --- 1264,1288 ---- return cp_build_qualified_type (outer, cp_type_quals (type)); } + /* Replaces any constexpr expression that may be into the attributes + arguments with their reduced value. */ + + static void + cp_check_const_attributes (tree attributes) + { + tree attr; + for (attr = attributes; attr; attr = TREE_CHAIN (attr)) + { + tree arg; + for (arg = TREE_VALUE (attr); arg; arg = TREE_CHAIN (arg)) + { + tree expr = TREE_VALUE (arg); + if (EXPR_P (expr)) + TREE_VALUE (arg) = maybe_constant_value (expr); + } + } + } + /* Like decl_attributes, but handle C++ complexity. */ void *************** cplus_decl_attributes (tree *decl, tree *** 1284,1289 **** --- 1303,1310 ---- return; } + cp_check_const_attributes (attributes); + if (TREE_CODE (*decl) == TEMPLATE_DECL) decl = &DECL_TEMPLATE_RESULT (*decl); *************** build_offset_ref_call_from_tree (tree fn *** 4059,4067 **** because we depend on the form of FN. */ make_args_non_dependent (*args); object = build_non_dependent_expr (object); ! if (TREE_CODE (fn) == DOTSTAR_EXPR) ! object = cp_build_addr_expr (object, tf_warning_or_error); ! VEC_safe_insert (tree, gc, *args, 0, object); /* Now that the arguments are done, transform FN. */ fn = build_non_dependent_expr (fn); } --- 4080,4091 ---- because we depend on the form of FN. */ make_args_non_dependent (*args); object = build_non_dependent_expr (object); ! if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE) ! { ! if (TREE_CODE (fn) == DOTSTAR_EXPR) ! object = cp_build_addr_expr (object, tf_warning_or_error); ! VEC_safe_insert (tree, gc, *args, 0, object); ! } /* Now that the arguments are done, transform FN. */ fn = build_non_dependent_expr (fn); } *************** build_offset_ref_call_from_tree (tree fn *** 4080,4086 **** VEC_safe_insert (tree, gc, *args, 0, object_addr); } ! expr = cp_build_function_call_vec (fn, args, tf_warning_or_error); if (processing_template_decl && expr != error_mark_node) expr = build_min_non_dep_call_vec (expr, orig_fn, orig_args); --- 4104,4113 ---- VEC_safe_insert (tree, gc, *args, 0, object_addr); } ! if (CLASS_TYPE_P (TREE_TYPE (fn))) ! expr = build_op_call (fn, args, tf_warning_or_error); ! else ! expr = cp_build_function_call_vec (fn, args, tf_warning_or_error); if (processing_template_decl && expr != error_mark_node) expr = build_min_non_dep_call_vec (expr, orig_fn, orig_args); *************** mark_used (tree decl) *** 4258,4263 **** --- 4285,4293 ---- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) && DECL_DEFAULTED_FN (decl) + /* A function defaulted outside the class is synthesized either by + cp_finish_decl or instantiate_decl. */ + && !DECL_DEFAULTED_OUTSIDE_CLASS_P (decl) && ! DECL_INITIAL (decl)) { /* Remember the current location for a function we will end up diff -Nrcpad gcc-4.6.0/gcc/cp/error.c gcc-4.6.1/gcc/cp/error.c *** gcc-4.6.0/gcc/cp/error.c Sun Feb 20 23:18:11 2011 --- gcc-4.6.1/gcc/cp/error.c Tue Jun 14 22:13:45 2011 *************** dump_template_bindings (tree parms, tree *** 306,318 **** --- 306,325 ---- FOR_EACH_VEC_ELT (tree, typenames, i, t) { + bool dependent = uses_template_parms (args); if (need_comma) pp_separate_with_comma (cxx_pp); dump_type (t, TFF_PLAIN_IDENTIFIER); pp_cxx_whitespace (cxx_pp); pp_equal (cxx_pp); pp_cxx_whitespace (cxx_pp); + push_deferring_access_checks (dk_no_check); + if (dependent) + ++processing_template_decl; t = tsubst (t, args, tf_none, NULL_TREE); + if (dependent) + --processing_template_decl; + pop_deferring_access_checks (); /* Strip typedefs. We can't just use TFF_CHASE_TYPEDEF because pp_simple_type_specifier doesn't know about it. */ t = strip_typedefs (t); *************** dump_expr (tree t, int flags) *** 1872,1878 **** && strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))) { dump_expr (ob, flags | TFF_EXPR_IN_PARENS); ! pp_cxx_arrow (cxx_pp); } } else --- 1879,1888 ---- && strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))) { dump_expr (ob, flags | TFF_EXPR_IN_PARENS); ! if (TREE_CODE (TREE_TYPE (ob)) == REFERENCE_TYPE) ! pp_cxx_dot (cxx_pp); ! else ! pp_cxx_arrow (cxx_pp); } } else *************** type_to_string (tree typ, int verbose) *** 2608,2613 **** --- 2618,2632 ---- reinit_cxx_pp (); dump_type (typ, flags); + if (typ && TYPE_P (typ) && typ != TYPE_CANONICAL (typ) + && !uses_template_parms (typ)) + { + tree aka = strip_typedefs (typ); + pp_string (cxx_pp, " {aka"); + pp_cxx_whitespace (cxx_pp); + dump_type (aka, flags); + pp_character (cxx_pp, '}'); + } return pp_formatted_text (cxx_pp); } diff -Nrcpad gcc-4.6.0/gcc/cp/except.c gcc-4.6.1/gcc/cp/except.c *** gcc-4.6.0/gcc/cp/except.c Tue Nov 30 11:41:24 2010 --- gcc-4.6.1/gcc/cp/except.c Fri Apr 8 15:02:16 2011 *************** finish_noexcept_expr (tree expr, tsubst_ *** 1125,1130 **** --- 1125,1133 ---- { tree fn; + if (expr == error_mark_node) + return error_mark_node; + if (processing_template_decl) return build_min (NOEXCEPT_EXPR, boolean_type_node, expr); *************** build_noexcept_spec (tree expr, int comp *** 1203,1217 **** it until instantiation. */ if (!processing_template_decl) { - expr = cxx_constant_value (expr); expr = perform_implicit_conversion_flags (boolean_type_node, expr, complain, LOOKUP_NORMAL); } if (expr == boolean_true_node) return noexcept_true_spec; else if (expr == boolean_false_node) return noexcept_false_spec; else { gcc_assert (processing_template_decl || expr == error_mark_node); --- 1206,1222 ---- it until instantiation. */ if (!processing_template_decl) { expr = perform_implicit_conversion_flags (boolean_type_node, expr, complain, LOOKUP_NORMAL); + expr = cxx_constant_value (expr); } if (expr == boolean_true_node) return noexcept_true_spec; else if (expr == boolean_false_node) return noexcept_false_spec; + else if (expr == error_mark_node) + return error_mark_node; else { gcc_assert (processing_template_decl || expr == error_mark_node); diff -Nrcpad gcc-4.6.0/gcc/cp/init.c gcc-4.6.1/gcc/cp/init.c *** gcc-4.6.0/gcc/cp/init.c Fri Mar 11 15:43:37 2011 --- gcc-4.6.1/gcc/cp/init.c Wed May 25 20:52:15 2011 *************** static void expand_virtual_init (tree, t *** 45,51 **** static tree sort_mem_initializers (tree, tree); static tree initializing_context (tree); static void expand_cleanup_for_base (tree, tree); - static tree get_temp_regvar (tree, tree); static tree dfs_initialize_vtbl_ptrs (tree, void *); static tree build_dtor_call (tree, special_function_kind, int); static tree build_field_list (tree, tree, int *); --- 45,50 ---- *************** build_value_init (tree type, tsubst_flag *** 343,349 **** build_special_member_call (NULL_TREE, complete_ctor_identifier, NULL, type, LOOKUP_NORMAL, complain)); ! else if (TREE_CODE (type) != UNION_TYPE && TYPE_NEEDS_CONSTRUCTING (type)) { /* This is a class that needs constructing, but doesn't have a user-provided constructor. So we need to zero-initialize --- 342,348 ---- build_special_member_call (NULL_TREE, complete_ctor_identifier, NULL, type, LOOKUP_NORMAL, complain)); ! else if (TYPE_NEEDS_CONSTRUCTING (type)) { /* This is a class that needs constructing, but doesn't have a user-provided constructor. So we need to zero-initialize *************** perform_member_init (tree member, tree i *** 529,534 **** --- 528,535 ---- { gcc_assert (TREE_CHAIN (init) == NULL_TREE); init = TREE_VALUE (init); + if (BRACE_ENCLOSED_INITIALIZER_P (init)) + init = digest_init (type, init); } if (init == NULL_TREE || same_type_ignoring_top_level_qualifiers_p (type, *************** diagnose_uninitialized_cst_or_ref_member *** 1892,1897 **** --- 1893,1899 ---- { tree field; int error_count = 0; + bool permissive = global_dc->permissive; if (type_has_user_provided_constructor (type)) return 0; *************** diagnose_uninitialized_cst_or_ref_member *** 1905,1938 **** field_type = strip_array_types (TREE_TYPE (field)); if (TREE_CODE (field_type) == REFERENCE_TYPE) { - ++ error_count; if (complain) { if (using_new) ! error ("uninitialized reference member in %q#T " ! "using % without new-initializer", origin); else ! error ("uninitialized reference member in %q#T", origin); inform (DECL_SOURCE_LOCATION (field), "%qD should be initialized", field); } } if (CP_TYPE_CONST_P (field_type)) { - ++ error_count; if (complain) { if (using_new) ! error ("uninitialized const member in %q#T " ! "using % without new-initializer", origin); ! else ! error ("uninitialized const member in %q#T", origin); inform (DECL_SOURCE_LOCATION (field), "%qD should be initialized", field); } } if (CLASS_TYPE_P (field_type)) --- 1907,1956 ---- field_type = strip_array_types (TREE_TYPE (field)); + if (type_has_user_provided_constructor (field_type)) + continue; + if (TREE_CODE (field_type) == REFERENCE_TYPE) { if (complain) { + if (!permissive || !using_new) + ++ error_count; + if (using_new) ! permerror (input_location, ! "uninitialized reference member in %q#T " ! "using % without new-initializer", origin); else ! error ("uninitialized reference member in %q#T", origin); ! inform (DECL_SOURCE_LOCATION (field), "%qD should be initialized", field); } + else + ++ error_count; } if (CP_TYPE_CONST_P (field_type)) { if (complain) { + if (!permissive) + ++ error_count; + if (using_new) ! permerror (input_location, ! "uninitialized const member in %q#T " ! "using % without new-initializer", origin); ! else ! permerror (input_location, ! "uninitialized const member in %q#T", origin); ! inform (DECL_SOURCE_LOCATION (field), "%qD should be initialized", field); } + else + ++ error_count; } if (CLASS_TYPE_P (field_type)) *************** create_temporary_var (tree type) *** 2871,2877 **** things when it comes time to do final cleanups (which take place "outside" the binding contour of the function). */ ! static tree get_temp_regvar (tree type, tree init) { tree decl; --- 2889,2895 ---- things when it comes time to do final cleanups (which take place "outside" the binding contour of the function). */ ! tree get_temp_regvar (tree type, tree init) { tree decl; diff -Nrcpad gcc-4.6.0/gcc/cp/mangle.c gcc-4.6.1/gcc/cp/mangle.c *** gcc-4.6.0/gcc/cp/mangle.c Tue Mar 8 17:30:46 2011 --- gcc-4.6.1/gcc/cp/mangle.c Fri Jun 3 20:21:38 2011 *************** *** 1,6 **** /* Name mangling for the 3.0 C++ ABI. ! Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 ! Free Software Foundation, Inc. Written by Alex Samuel This file is part of GCC. --- 1,6 ---- /* Name mangling for the 3.0 C++ ABI. ! Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, ! 2011 Free Software Foundation, Inc. Written by Alex Samuel This file is part of GCC. *************** write_nested_name (const tree decl) *** 943,949 **** else { /* No, just use */ ! write_prefix (DECL_CONTEXT (decl)); write_unqualified_name (decl); } write_char ('E'); --- 943,949 ---- else { /* No, just use */ ! write_prefix (CP_DECL_CONTEXT (decl)); write_unqualified_name (decl); } write_char ('E'); diff -Nrcpad gcc-4.6.0/gcc/cp/method.c gcc-4.6.1/gcc/cp/method.c *** gcc-4.6.0/gcc/cp/method.c Wed Mar 9 16:59:55 2011 --- gcc-4.6.1/gcc/cp/method.c Thu May 19 08:00:50 2011 *************** *** 1,7 **** /* Handle the hair of processing (but not expanding) inline functions. Also manage function and variable name overloading. Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, ! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) --- 1,7 ---- /* Handle the hair of processing (but not expanding) inline functions. Also manage function and variable name overloading. Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, ! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) *************** locate_fn_flags (tree type, tree name, t *** 838,847 **** /* Locate the dtor of TYPE. */ tree ! get_dtor (tree type) { tree fn = locate_fn_flags (type, complete_dtor_identifier, NULL_TREE, ! LOOKUP_NORMAL, tf_warning_or_error); if (fn == error_mark_node) return NULL_TREE; return fn; --- 838,847 ---- /* Locate the dtor of TYPE. */ tree ! get_dtor (tree type, tsubst_flags_t complain) { tree fn = locate_fn_flags (type, complete_dtor_identifier, NULL_TREE, ! LOOKUP_NORMAL, complain); if (fn == error_mark_node) return NULL_TREE; return fn; *************** get_default_ctor (tree type) *** 878,890 **** /* Locate the copy ctor of TYPE. */ tree ! get_copy_ctor (tree type) { int quals = (TYPE_HAS_CONST_COPY_CTOR (type) ? TYPE_QUAL_CONST : TYPE_UNQUALIFIED); tree argtype = build_stub_type (type, quals, false); tree fn = locate_fn_flags (type, complete_ctor_identifier, argtype, ! LOOKUP_NORMAL, tf_warning_or_error); if (fn == error_mark_node) return NULL_TREE; return fn; --- 878,890 ---- /* Locate the copy ctor of TYPE. */ tree ! get_copy_ctor (tree type, tsubst_flags_t complain) { int quals = (TYPE_HAS_CONST_COPY_CTOR (type) ? TYPE_QUAL_CONST : TYPE_UNQUALIFIED); tree argtype = build_stub_type (type, quals, false); tree fn = locate_fn_flags (type, complete_ctor_identifier, argtype, ! LOOKUP_NORMAL, complain); if (fn == error_mark_node) return NULL_TREE; return fn; *************** defaultable_fn_check (tree fn) *** 1594,1599 **** --- 1594,1605 ---- { special_function_kind kind = sfk_none; + if (template_parm_scope_p ()) + { + error ("a template cannot be defaulted"); + return false; + } + if (DECL_CONSTRUCTOR_P (fn)) { if (FUNCTION_FIRST_USER_PARMTYPE (fn) == void_list_node) diff -Nrcpad gcc-4.6.0/gcc/cp/parser.c gcc-4.6.1/gcc/cp/parser.c *** gcc-4.6.0/gcc/cp/parser.c Fri Mar 11 22:47:59 2011 --- gcc-4.6.1/gcc/cp/parser.c Fri May 27 20:48:24 2011 *************** cp_parser_diagnose_invalid_type_name (cp *** 2699,2704 **** --- 2699,2705 ---- location_t location) { tree decl, old_scope; + cp_parser_commit_to_tentative_parse (parser); /* Try to lookup the identifier. */ old_scope = parser->scope; parser->scope = scope; *************** cp_parser_diagnose_invalid_type_name (cp *** 2787,2798 **** "%qT is a dependent scope", parser->scope, id, parser->scope); else if (TYPE_P (parser->scope)) ! error_at (location, "%qE in class %qT does not name a type", id, parser->scope); else gcc_unreachable (); } - cp_parser_commit_to_tentative_parse (parser); } /* Check for a common situation where a type-name should be present, --- 2788,2798 ---- "%qT is a dependent scope", parser->scope, id, parser->scope); else if (TYPE_P (parser->scope)) ! error_at (location, "%qE in %q#T does not name a type", id, parser->scope); else gcc_unreachable (); } } /* Check for a common situation where a type-name should be present, *************** cp_parser_primary_expression (cp_parser *** 3696,3701 **** --- 3696,3707 ---- `&A::B' might be a pointer-to-member, but `&(A::B)' is not. */ finish_parenthesized_expr (expr); + /* DR 705: Wrapping an unqualified name in parentheses + suppresses arg-dependent lookup. We want to pass back + CP_ID_KIND_QUALIFIED for suppressing vtable lookup + (c++/37862), but none of the others. */ + if (*idk != CP_ID_KIND_QUALIFIED) + *idk = CP_ID_KIND_NONE; } /* The `>' token might be the end of a template-id or template-parameter-list now. */ *************** cp_parser_unqualified_id (cp_parser* par *** 4314,4320 **** && (cp_lexer_peek_nth_token (parser->lexer, 2)->type != CPP_LESS) && (token->u.value == TYPE_IDENTIFIER (scope) ! || constructor_name_p (token->u.value, scope))) { cp_lexer_consume_token (parser->lexer); return build_nt (BIT_NOT_EXPR, scope); --- 4320,4327 ---- && (cp_lexer_peek_nth_token (parser->lexer, 2)->type != CPP_LESS) && (token->u.value == TYPE_IDENTIFIER (scope) ! || (CLASS_TYPE_P (scope) ! && constructor_name_p (token->u.value, scope)))) { cp_lexer_consume_token (parser->lexer); return build_nt (BIT_NOT_EXPR, scope); *************** cp_parser_decltype (cp_parser *parser) *** 10457,10463 **** return error_mark_node; } ! return finish_decltype_type (expr, id_expression_or_member_access_p); } /* Special member functions [gram.special] */ --- 10464,10471 ---- return error_mark_node; } ! return finish_decltype_type (expr, id_expression_or_member_access_p, ! tf_warning_or_error); } /* Special member functions [gram.special] */ *************** cp_parser_direct_declarator (cp_parser* *** 15024,15029 **** --- 15032,15040 ---- parser->num_template_parameter_lists = saved_num_template_parameter_lists; + /* Consume the `)'. */ + cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN); + /* If all went well, parse the cv-qualifier-seq and the exception-specification. */ if (member_p || cp_parser_parse_definitely (parser)) *************** cp_parser_direct_declarator (cp_parser* *** 15037,15044 **** if (ctor_dtor_or_conv_p) *ctor_dtor_or_conv_p = *ctor_dtor_or_conv_p < 0; first = false; - /* Consume the `)'. */ - cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN); /* Parse the cv-qualifier-seq. */ cv_quals = cp_parser_cv_qualifier_seq_opt (parser); --- 15048,15053 ---- *************** cp_parser_parameter_declaration (cp_pars *** 16125,16130 **** --- 16134,16140 ---- of some object of type "char" to "int". */ && !parser->in_type_id_in_expr_p && cp_parser_uncommitted_to_tentative_parse_p (parser) + && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE) && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN)) cp_parser_commit_to_tentative_parse (parser); /* Parse the declarator. */ *************** cp_parser_constructor_declarator_p (cp_p *** 19635,19641 **** /* If we have a class scope, this is easy; DR 147 says that S::S always names the constructor, and no other qualified name could. */ if (constructor_p && nested_name_specifier ! && TYPE_P (nested_name_specifier)) { tree id = cp_parser_unqualified_id (parser, /*template_keyword_p=*/false, --- 19645,19651 ---- /* If we have a class scope, this is easy; DR 147 says that S::S always names the constructor, and no other qualified name could. */ if (constructor_p && nested_name_specifier ! && CLASS_TYPE_P (nested_name_specifier)) { tree id = cp_parser_unqualified_id (parser, /*template_keyword_p=*/false, *************** cp_parser_omp_for_loop (cp_parser *parse *** 24631,24637 **** /* If decl is an iterator, preserve the operator on decl until finish_omp_for. */ if (decl ! && (type_dependent_expression_p (decl) || CLASS_TYPE_P (TREE_TYPE (decl)))) incr = cp_parser_omp_for_incr (parser, decl); else --- 24641,24648 ---- /* If decl is an iterator, preserve the operator on decl until finish_omp_for. */ if (decl ! && ((type_dependent_expression_p (decl) ! && !POINTER_TYPE_P (TREE_TYPE (decl))) || CLASS_TYPE_P (TREE_TYPE (decl)))) incr = cp_parser_omp_for_incr (parser, decl); else diff -Nrcpad gcc-4.6.0/gcc/cp/pt.c gcc-4.6.1/gcc/cp/pt.c *** gcc-4.6.0/gcc/cp/pt.c Sat Mar 12 06:48:57 2011 --- gcc-4.6.1/gcc/cp/pt.c Fri Jun 17 01:06:50 2011 *************** instantiate_class_template (tree type) *** 8557,8562 **** --- 8557,8565 ---- } } + if (CLASSTYPE_LAMBDA_EXPR (type)) + maybe_add_lambda_conv_op (type); + /* Set the file and line number information to whatever is given for the class itself. This puts error messages involving generated implicit functions at a predictable point, and the same point *************** tsubst_pack_expansion (tree t, tree args *** 8690,8696 **** have the wrong value for a recursive call. Just make a dummy decl, since it's only used for its type. */ arg_pack = tsubst_decl (parm_pack, args, complain); ! arg_pack = make_fnparm_pack (arg_pack); } } else --- 8693,8704 ---- have the wrong value for a recursive call. Just make a dummy decl, since it's only used for its type. */ arg_pack = tsubst_decl (parm_pack, args, complain); ! if (arg_pack && FUNCTION_PARAMETER_PACK_P (arg_pack)) ! /* Partial instantiation of the parm_pack, we can't build ! up an argument pack yet. */ ! arg_pack = NULL_TREE; ! else ! arg_pack = make_fnparm_pack (arg_pack); } } else *************** tsubst_decl (tree t, tree args, tsubst_f *** 9515,9520 **** --- 9523,9530 ---- (DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (t))), args, complain, in_decl); + if (argvec == error_mark_node) + RETURN (error_mark_node); /* Check to see if we already have this specialization. */ hash = hash_tmpl_and_args (gen_tmpl, argvec); *************** tsubst_decl (tree t, tree args, tsubst_f *** 9780,9793 **** if (DECL_TEMPLATE_PARM_P (t)) SET_DECL_TEMPLATE_PARM_P (r); - /* An argument of a function parameter pack is not a parameter - pack. */ - FUNCTION_PARAMETER_PACK_P (r) = false; - if (expanded_types) /* We're on the Ith parameter of the function parameter pack. */ { /* Get the Ith type. */ type = TREE_VEC_ELT (expanded_types, i); --- 9790,9803 ---- if (DECL_TEMPLATE_PARM_P (t)) SET_DECL_TEMPLATE_PARM_P (r); if (expanded_types) /* We're on the Ith parameter of the function parameter pack. */ { + /* An argument of a function parameter pack is not a parameter + pack. */ + FUNCTION_PARAMETER_PACK_P (r) = false; + /* Get the Ith type. */ type = TREE_VEC_ELT (expanded_types, i); *************** tsubst (tree t, tree args, tsubst_flags_ *** 11025,11031 **** type = lambda_return_type (type); else type = finish_decltype_type ! (type, DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t)); return cp_build_qualified_type_real (type, cp_type_quals (t) | cp_type_quals (type), --- 11035,11041 ---- type = lambda_return_type (type); else type = finish_decltype_type ! (type, DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t), complain); return cp_build_qualified_type_real (type, cp_type_quals (t) | cp_type_quals (type), *************** tsubst_copy_and_build (tree t, *** 13221,13227 **** ce->value = tsubst_pack_expansion (ce->value, args, complain, in_decl); ! if (ce->value == error_mark_node) ; else if (TREE_VEC_LENGTH (ce->value) == 1) /* Just move the argument into place. */ --- 13231,13238 ---- ce->value = tsubst_pack_expansion (ce->value, args, complain, in_decl); ! if (ce->value == error_mark_node ! || PACK_EXPANSION_P (ce->value)) ; else if (TREE_VEC_LENGTH (ce->value) == 1) /* Just move the argument into place. */ *************** fn_type_unification (tree fn, *** 13742,13748 **** --- 13753,13761 ---- incomplete = NUM_TMPL_ARGS (explicit_targs) != NUM_TMPL_ARGS (targs); processing_template_decl += incomplete; + push_deferring_access_checks (dk_no_check); fntype = tsubst (fntype, converted_args, tf_none, NULL_TREE); + pop_deferring_access_checks (); processing_template_decl -= incomplete; if (fntype == error_mark_node) *************** fn_type_unification (tree fn, *** 13829,13835 **** substitution results in an invalid type, as described above, type deduction fails. */ { ! tree substed = tsubst (TREE_TYPE (fn), targs, tf_none, NULL_TREE); if (substed == error_mark_node) return 1; --- 13842,13851 ---- substitution results in an invalid type, as described above, type deduction fails. */ { ! tree substed; ! push_deferring_access_checks (dk_no_check); ! substed = tsubst (TREE_TYPE (fn), targs, tf_none, NULL_TREE); ! pop_deferring_access_checks (); if (substed == error_mark_node) return 1; *************** maybe_adjust_types_for_deduction (unific *** 13936,13942 **** && TYPE_REF_IS_RVALUE (*parm) && TREE_CODE (TREE_TYPE (*parm)) == TEMPLATE_TYPE_PARM && cp_type_quals (TREE_TYPE (*parm)) == TYPE_UNQUALIFIED ! && arg_expr && real_lvalue_p (arg_expr)) *arg = build_reference_type (*arg); /* [temp.deduct.call] --- 13952,13961 ---- && TYPE_REF_IS_RVALUE (*parm) && TREE_CODE (TREE_TYPE (*parm)) == TEMPLATE_TYPE_PARM && cp_type_quals (TREE_TYPE (*parm)) == TYPE_UNQUALIFIED ! && (arg_expr ? real_lvalue_p (arg_expr) ! /* try_one_overload doesn't provide an arg_expr, but ! functions are always lvalues. */ ! : TREE_CODE (*arg) == FUNCTION_TYPE)) *arg = build_reference_type (*arg); /* [temp.deduct.call] *************** type_unification_real (tree tparms, *** 14022,14032 **** while (parms && parms != void_list_node && ia < nargs) { - if (TREE_CODE (TREE_VALUE (parms)) == TYPE_PACK_EXPANSION) - break; - parm = TREE_VALUE (parms); parms = TREE_CHAIN (parms); arg = args[ia]; ++ia; arg_expr = NULL; --- 14041,14064 ---- while (parms && parms != void_list_node && ia < nargs) { parm = TREE_VALUE (parms); + + if (TREE_CODE (parm) == TYPE_PACK_EXPANSION + && (!TREE_CHAIN (parms) || TREE_CHAIN (parms) == void_list_node)) + /* For a function parameter pack that occurs at the end of the + parameter-declaration-list, the type A of each remaining + argument of the call is compared with the type P of the + declarator-id of the function parameter pack. */ + break; + parms = TREE_CHAIN (parms); + + if (TREE_CODE (parm) == TYPE_PACK_EXPANSION) + /* For a function parameter pack that does not occur at the + end of the parameter-declaration-list, the type of the + parameter pack is a non-deduced context. */ + continue; + arg = args[ia]; ++ia; arg_expr = NULL; *************** instantiate_decl (tree d, int defer_ok, *** 17206,17212 **** args = gen_args; if (TREE_CODE (d) == FUNCTION_DECL) ! pattern_defined = (DECL_SAVED_TREE (code_pattern) != NULL_TREE); else pattern_defined = ! DECL_IN_AGGR_P (code_pattern); --- 17238,17245 ---- args = gen_args; if (TREE_CODE (d) == FUNCTION_DECL) ! pattern_defined = (DECL_SAVED_TREE (code_pattern) != NULL_TREE ! || DECL_DEFAULTED_OUTSIDE_CLASS_P (code_pattern)); else pattern_defined = ! DECL_IN_AGGR_P (code_pattern); *************** instantiate_decl (tree d, int defer_ok, *** 17401,17406 **** --- 17434,17441 ---- cp_finish_decl (d, init, const_init, NULL_TREE, 0); pop_nested_class (); } + else if (TREE_CODE (d) == FUNCTION_DECL && DECL_DEFAULTED_FN (code_pattern)) + synthesize_method (d); else if (TREE_CODE (d) == FUNCTION_DECL) { htab_t saved_local_specializations; *************** get_mostly_instantiated_function_type (t *** 17788,17794 **** ; else { ! int i, save_access_control; tree partial_args; /* Replace the innermost level of the TARGS with NULL_TREEs to --- 17823,17829 ---- ; else { ! int i; tree partial_args; /* Replace the innermost level of the TARGS with NULL_TREEs to *************** get_mostly_instantiated_function_type (t *** 17803,17810 **** /* Disable access control as this function is used only during name-mangling. */ ! save_access_control = flag_access_control; ! flag_access_control = 0; ++processing_template_decl; /* Now, do the (partial) substitution to figure out the --- 17838,17844 ---- /* Disable access control as this function is used only during name-mangling. */ ! push_deferring_access_checks (dk_no_check); ++processing_template_decl; /* Now, do the (partial) substitution to figure out the *************** get_mostly_instantiated_function_type (t *** 17819,17825 **** TREE_VEC_LENGTH (partial_args)--; tparms = tsubst_template_parms (tparms, partial_args, tf_error); ! flag_access_control = save_access_control; } return fn_type; --- 17853,17859 ---- TREE_VEC_LENGTH (partial_args)--; tparms = tsubst_template_parms (tparms, partial_args, tf_error); ! pop_deferring_access_checks (); } return fn_type; *************** invalid_nontype_parm_type_p (tree type, *** 17863,17868 **** --- 17897,17904 ---- return 0; else if (TREE_CODE (type) == TYPENAME_TYPE) return 0; + else if (TREE_CODE (type) == DECLTYPE_TYPE) + return 0; if (complain & tf_error) error ("%q#T is not a valid type for a template constant parameter", type); *************** value_dependent_expression_p (tree expre *** 18065,18070 **** --- 18101,18111 ---- if (DECL_P (expression) && type_dependent_expression_p (expression)) return true; + /* We shouldn't have gotten here for a type-dependent expression, but + let's handle it properly anyway. */ + if (TREE_TYPE (expression) == NULL_TREE) + return true; + switch (TREE_CODE (expression)) { case IDENTIFIER_NODE: *************** value_dependent_expression_p (tree expre *** 18082,18091 **** return value_dependent_expression_p (DECL_INITIAL (expression)); case VAR_DECL: ! /* A constant with integral or enumeration type and is initialized with an expression that is value-dependent. */ if (DECL_INITIAL (expression) ! && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (expression)) && value_dependent_expression_p (DECL_INITIAL (expression))) return true; return false; --- 18123,18132 ---- return value_dependent_expression_p (DECL_INITIAL (expression)); case VAR_DECL: ! /* A constant with literal type and is initialized with an expression that is value-dependent. */ if (DECL_INITIAL (expression) ! && decl_constant_var_p (expression) && value_dependent_expression_p (DECL_INITIAL (expression))) return true; return false; *************** value_dependent_expression_p (tree expre *** 18217,18222 **** --- 18258,18278 ---- return false; } + case TEMPLATE_ID_EXPR: + /* If a TEMPLATE_ID_EXPR involves a dependent name, it will be + type-dependent. */ + return type_dependent_expression_p (expression); + + case CONSTRUCTOR: + { + unsigned ix; + tree val; + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (expression), ix, val) + if (value_dependent_expression_p (val)) + return true; + return false; + } + default: /* A constant expression is value-dependent if any subexpression is value-dependent. */ *************** dependent_template_arg_p (tree arg) *** 18471,18476 **** --- 18527,18535 ---- if (arg == error_mark_node) return true; + if (TREE_CODE (arg) == ARGUMENT_PACK_SELECT) + arg = ARGUMENT_PACK_SELECT_ARG (arg); + if (TREE_CODE (arg) == TEMPLATE_DECL || TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM) return dependent_template_p (arg); *************** build_non_dependent_expr (tree expr) *** 18797,18806 **** { tree inner_expr; - /* Preserve null pointer constants so that the type of things like - "p == 0" where "p" is a pointer can be determined. */ - if (null_ptr_cst_p (expr)) - return expr; /* Preserve OVERLOADs; the functions must be available to resolve types. */ inner_expr = expr; --- 18856,18861 ---- *************** build_non_dependent_expr (tree expr) *** 18848,18871 **** TREE_OPERAND (expr, 0), build_non_dependent_expr (TREE_OPERAND (expr, 1))); /* If the type is unknown, it can't really be non-dependent */ gcc_assert (TREE_TYPE (expr) != unknown_type_node); ! /* Otherwise, build a NON_DEPENDENT_EXPR. ! ! REFERENCE_TYPEs are not stripped for expressions in templates ! because doing so would play havoc with mangling. Consider, for ! example: ! ! template void f() { g(); } ! ! In the body of "f", the expression for "g" will have ! REFERENCE_TYPE, even though the standard says that it should ! not. The reason is that we must preserve the syntactic form of ! the expression so that mangling (say) "f" inside the body of ! "f" works out correctly. Therefore, the REFERENCE_TYPE is ! stripped here. */ ! return build1 (NON_DEPENDENT_EXPR, non_reference (TREE_TYPE (expr)), expr); } /* ARGS is a vector of expressions as arguments to a function call. --- 18903,18919 ---- TREE_OPERAND (expr, 0), build_non_dependent_expr (TREE_OPERAND (expr, 1))); + /* Keep dereferences outside the NON_DEPENDENT_EXPR so lvalue_kind + doesn't need to look inside. */ + if (TREE_CODE (expr) == INDIRECT_REF && REFERENCE_REF_P (expr)) + return convert_from_reference (build_non_dependent_expr + (TREE_OPERAND (expr, 0))); + /* If the type is unknown, it can't really be non-dependent */ gcc_assert (TREE_TYPE (expr) != unknown_type_node); ! /* Otherwise, build a NON_DEPENDENT_EXPR. */ ! return build1 (NON_DEPENDENT_EXPR, TREE_TYPE (expr), expr); } /* ARGS is a vector of expressions as arguments to a function call. *************** splice_late_return_type (tree type, tree *** 19031,19037 **** return type; argvec = make_tree_vec (1); TREE_VEC_ELT (argvec, 0) = late_return_type; ! if (processing_template_decl) argvec = add_to_template_args (current_template_args (), argvec); return tsubst (type, argvec, tf_warning_or_error, NULL_TREE); } --- 19079,19090 ---- return type; argvec = make_tree_vec (1); TREE_VEC_ELT (argvec, 0) = late_return_type; ! if (processing_template_parmlist) ! /* For a late-specified return type in a template type-parameter, we ! need to add a dummy argument level for its parmlist. */ ! argvec = add_to_template_args ! (make_tree_vec (processing_template_parmlist), argvec); ! if (current_template_parms) argvec = add_to_template_args (current_template_args (), argvec); return tsubst (type, argvec, tf_warning_or_error, NULL_TREE); } diff -Nrcpad gcc-4.6.0/gcc/cp/semantics.c gcc-4.6.1/gcc/cp/semantics.c *** gcc-4.6.0/gcc/cp/semantics.c Tue Mar 8 05:28:13 2011 --- gcc-4.6.1/gcc/cp/semantics.c Tue Jun 21 20:08:01 2011 *************** finish_call_expr (tree fn, VEC(tree,gc) *** 2041,2047 **** is not included in *ARGS even though it is considered to be part of the list of arguments. Note that this is related to CWG issues 515 and 1005. */ ! || ((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE) && current_class_ref && type_dependent_expression_p (current_class_ref))) { --- 2041,2047 ---- is not included in *ARGS even though it is considered to be part of the list of arguments. Note that this is related to CWG issues 515 and 1005. */ ! || (non_static_member_function_p (fn) && current_class_ref && type_dependent_expression_p (current_class_ref))) { *************** finish_call_expr (tree fn, VEC(tree,gc) *** 2150,2160 **** /* A call where the function is unknown. */ result = cp_build_function_call_vec (fn, args, complain); ! if (processing_template_decl) { result = build_call_vec (TREE_TYPE (result), orig_fn, orig_args); KOENIG_LOOKUP_P (result) = koenig_p; release_tree_vector (orig_args); } return result; --- 2150,2163 ---- /* A call where the function is unknown. */ result = cp_build_function_call_vec (fn, args, complain); ! if (processing_template_decl && result != error_mark_node) { + if (TREE_CODE (result) == INDIRECT_REF) + result = TREE_OPERAND (result, 0); result = build_call_vec (TREE_TYPE (result), orig_fn, orig_args); KOENIG_LOOKUP_P (result) = koenig_p; release_tree_vector (orig_args); + result = convert_from_reference (result); } return result; *************** finish_compound_literal (tree type, tree *** 2326,2332 **** if (TREE_CODE (type) == ARRAY_TYPE) cp_complete_array_type (&type, compound_literal, false); compound_literal = digest_init (type, compound_literal); ! return get_target_expr (compound_literal); } /* Return the declaration for the function-name variable indicated by --- 2329,2365 ---- if (TREE_CODE (type) == ARRAY_TYPE) cp_complete_array_type (&type, compound_literal, false); compound_literal = digest_init (type, compound_literal); ! if (TREE_CODE (compound_literal) == CONSTRUCTOR) ! TREE_HAS_CONSTRUCTOR (compound_literal) = true; ! /* Put static/constant array temporaries in static variables, but always ! represent class temporaries with TARGET_EXPR so we elide copies. */ ! if ((!at_function_scope_p () || CP_TYPE_CONST_P (type)) ! && TREE_CODE (type) == ARRAY_TYPE ! && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type) ! && initializer_constant_valid_p (compound_literal, type)) ! { ! tree decl = create_temporary_var (type); ! DECL_INITIAL (decl) = compound_literal; ! TREE_STATIC (decl) = 1; ! if (literal_type_p (type) && CP_TYPE_CONST_NON_VOLATILE_P (type)) ! { ! /* 5.19 says that a constant expression can include an ! lvalue-rvalue conversion applied to "a glvalue of literal type ! that refers to a non-volatile temporary object initialized ! with a constant expression". Rather than try to communicate ! that this VAR_DECL is a temporary, just mark it constexpr. */ ! DECL_DECLARED_CONSTEXPR_P (decl) = true; ! DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = true; ! TREE_CONSTANT (decl) = true; ! } ! cp_apply_type_quals_to_decl (cp_type_quals (type), decl); ! decl = pushdecl_top_level (decl); ! DECL_NAME (decl) = make_anon_name (); ! SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl)); ! return decl; ! } ! else ! return get_target_expr (compound_literal); } /* Return the declaration for the function-name variable indicated by *************** finish_id_expression (tree id_expression *** 3104,3110 **** (or an instantiation thereof). */ if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL) ! return convert_from_reference (decl); /* The same is true for FIELD_DECL, but we also need to make sure that the syntax is correct. */ else if (TREE_CODE (decl) == FIELD_DECL) --- 3137,3146 ---- (or an instantiation thereof). */ if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL) ! { ! mark_used (decl); ! return convert_from_reference (decl); ! } /* The same is true for FIELD_DECL, but we also need to make sure that the syntax is correct. */ else if (TREE_CODE (decl) == FIELD_DECL) *************** cxx_omp_create_clause_info (tree c, tree *** 3636,3642 **** if (need_default_ctor) t = get_default_ctor (type); else ! t = get_copy_ctor (type); if (t && !trivial_fn_p (t)) TREE_VEC_ELT (info, 0) = t; --- 3672,3678 ---- if (need_default_ctor) t = get_default_ctor (type); else ! t = get_copy_ctor (type, tf_warning_or_error); if (t && !trivial_fn_p (t)) TREE_VEC_ELT (info, 0) = t; *************** cxx_omp_create_clause_info (tree c, tree *** 3644,3650 **** if ((need_default_ctor || need_copy_ctor) && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) ! TREE_VEC_ELT (info, 1) = get_dtor (type); if (need_copy_assignment) { --- 3680,3686 ---- if ((need_default_ctor || need_copy_ctor) && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) ! TREE_VEC_ELT (info, 1) = get_dtor (type, tf_warning_or_error); if (need_copy_assignment) { *************** finish_omp_clauses (tree clauses) *** 3914,3925 **** break; } ! if (need_complete_non_reference) { t = require_complete_type (t); if (t == error_mark_node) remove = true; ! else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE) { error ("%qE has reference type for %qs", t, name); remove = true; --- 3950,3962 ---- break; } ! if (need_complete_non_reference || need_copy_assignment) { t = require_complete_type (t); if (t == error_mark_node) remove = true; ! else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE ! && need_complete_non_reference) { error ("%qE has reference type for %qs", t, name); remove = true; *************** finish_omp_clauses (tree clauses) *** 3961,3966 **** --- 3998,4004 ---- Save the results, because later we won't be in the right context for making these queries. */ if (CLASS_TYPE_P (inner_type) + && COMPLETE_TYPE_P (inner_type) && (need_default_ctor || need_copy_ctor || need_copy_assignment) && !type_dependent_expression_p (t) && cxx_omp_create_clause_info (c, inner_type, need_default_ctor, *************** describable_type (tree expr) *** 4755,4761 **** a full expression. */ tree ! finish_decltype_type (tree expr, bool id_expression_or_member_access_p) { tree orig_expr = expr; tree type = NULL_TREE; --- 4793,4800 ---- a full expression. */ tree ! finish_decltype_type (tree expr, bool id_expression_or_member_access_p, ! tsubst_flags_t complain) { tree orig_expr = expr; tree type = NULL_TREE; *************** finish_decltype_type (tree expr, bool id *** 4768,4774 **** || (TREE_CODE (expr) == BIT_NOT_EXPR && TYPE_P (TREE_OPERAND (expr, 0)))) { ! error ("argument to decltype must be an expression"); return error_mark_node; } --- 4807,4814 ---- || (TREE_CODE (expr) == BIT_NOT_EXPR && TYPE_P (TREE_OPERAND (expr, 0)))) { ! if (complain & tf_error) ! error ("argument to decltype must be an expression"); return error_mark_node; } *************** finish_decltype_type (tree expr, bool id *** 4835,4841 **** if (OVL_CHAIN (expr) || TREE_CODE (OVL_FUNCTION (expr)) == TEMPLATE_DECL) { ! error ("%qE refers to a set of overloaded functions", orig_expr); return error_mark_node; } else --- 4875,4883 ---- if (OVL_CHAIN (expr) || TREE_CODE (OVL_FUNCTION (expr)) == TEMPLATE_DECL) { ! if (complain & tf_error) ! error ("%qE refers to a set of overloaded functions", ! orig_expr); return error_mark_node; } else *************** finish_decltype_type (tree expr, bool id *** 4887,4893 **** default: gcc_assert (TYPE_P (expr) || DECL_P (expr) || TREE_CODE (expr) == SCOPE_REF); ! error ("argument to decltype must be an expression"); return error_mark_node; } } --- 4929,4936 ---- default: gcc_assert (TYPE_P (expr) || DECL_P (expr) || TREE_CODE (expr) == SCOPE_REF); ! if (complain & tf_error) ! error ("argument to decltype must be an expression"); return error_mark_node; } } *************** finish_decltype_type (tree expr, bool id *** 4982,4988 **** if (!type || type == unknown_type_node) { ! error ("type of %qE is unknown", expr); return error_mark_node; } --- 5025,5032 ---- if (!type || type == unknown_type_node) { ! if (complain & tf_error) ! error ("type of %qE is unknown", expr); return error_mark_node; } *************** literal_type_p (tree t) *** 5290,5296 **** if (SCALAR_TYPE_P (t)) return true; if (CLASS_TYPE_P (t)) ! return CLASSTYPE_LITERAL_P (t); if (TREE_CODE (t) == ARRAY_TYPE) return literal_type_p (strip_array_types (t)); return false; --- 5334,5340 ---- if (SCALAR_TYPE_P (t)) return true; if (CLASS_TYPE_P (t)) ! return CLASSTYPE_LITERAL_P (complete_type (t)); if (TREE_CODE (t) == ARRAY_TYPE) return literal_type_p (strip_array_types (t)); return false; *************** is_valid_constexpr_fn (tree fun, bool co *** 5387,5394 **** { ret = false; if (complain) ! error ("invalid type for parameter %q#D of constexpr function", ! parm); } if (!DECL_CONSTRUCTOR_P (fun)) --- 5431,5438 ---- { ret = false; if (complain) ! error ("invalid type for parameter %d of constexpr " ! "function %q+#D", DECL_PARM_INDEX (parm), fun); } if (!DECL_CONSTRUCTOR_P (fun)) *************** is_valid_constexpr_fn (tree fun, bool co *** 5398,5414 **** { ret = false; if (complain) ! error ("invalid return type %qT of constexpr function %qD", rettype, fun); } if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) ! && COMPLETE_TYPE_P (DECL_CONTEXT (fun)) ! && !valid_type_in_constexpr_fundecl_p (DECL_CONTEXT (fun))) { ret = false; if (complain) ! error ("enclosing class of %q#D is not a literal type", fun); } } --- 5442,5458 ---- { ret = false; if (complain) ! error ("invalid return type %qT of constexpr function %q+D", rettype, fun); } + /* Check this again here for cxx_eval_call_expression. */ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) ! && !CLASSTYPE_LITERAL_P (DECL_CONTEXT (fun))) { ret = false; if (complain) ! error ("enclosing class of %q+#D is not a literal type", fun); } } *************** is_valid_constexpr_fn (tree fun, bool co *** 5423,5458 **** tree validate_constexpr_fundecl (tree fun) { - constexpr_fundef entry; - constexpr_fundef **slot; - if (processing_template_decl || !DECL_DECLARED_CONSTEXPR_P (fun)) return NULL; else if (DECL_CLONED_FUNCTION_P (fun)) /* We already checked the original function. */ return fun; ! if (!is_valid_constexpr_fn (fun, !DECL_TEMPLATE_INSTANTIATION (fun))) { DECL_DECLARED_CONSTEXPR_P (fun) = false; return NULL; } - /* Create the constexpr function table if necessary. */ - if (constexpr_fundef_table == NULL) - constexpr_fundef_table = htab_create_ggc (101, - constexpr_fundef_hash, - constexpr_fundef_equal, - ggc_free); - entry.decl = fun; - entry.body = NULL; - slot = (constexpr_fundef **) - htab_find_slot (constexpr_fundef_table, &entry, INSERT); - if (*slot == NULL) - { - *slot = ggc_alloc_constexpr_fundef (); - **slot = entry; - } return fun; } --- 5467,5484 ---- tree validate_constexpr_fundecl (tree fun) { if (processing_template_decl || !DECL_DECLARED_CONSTEXPR_P (fun)) return NULL; else if (DECL_CLONED_FUNCTION_P (fun)) /* We already checked the original function. */ return fun; ! if (!is_valid_constexpr_fn (fun, !DECL_TEMPLATE_INFO (fun))) { DECL_DECLARED_CONSTEXPR_P (fun) = false; return NULL; } return fun; } *************** build_constexpr_constructor_member_initi *** 5643,5650 **** tree register_constexpr_fundef (tree fun, tree body) { ! constexpr_fundef *fundef = retrieve_constexpr_fundef (fun); ! gcc_assert (fundef != NULL && fundef->body == NULL); if (DECL_CONSTRUCTOR_P (fun)) body = build_constexpr_constructor_member_initializers --- 5669,5676 ---- tree register_constexpr_fundef (tree fun, tree body) { ! constexpr_fundef entry; ! constexpr_fundef **slot; if (DECL_CONSTRUCTOR_P (fun)) body = build_constexpr_constructor_member_initializers *************** register_constexpr_fundef (tree fun, tre *** 5668,5681 **** body = unshare_expr (TREE_OPERAND (body, 0)); } ! if (!potential_constant_expression (body)) { DECL_DECLARED_CONSTEXPR_P (fun) = false; ! if (!DECL_TEMPLATE_INSTANTIATION (fun)) ! require_potential_constant_expression (body); return NULL; } ! fundef->body = body; return fun; } --- 5694,5722 ---- body = unshare_expr (TREE_OPERAND (body, 0)); } ! if (!potential_rvalue_constant_expression (body)) { DECL_DECLARED_CONSTEXPR_P (fun) = false; ! if (!DECL_TEMPLATE_INFO (fun)) ! require_potential_rvalue_constant_expression (body); return NULL; } ! ! /* Create the constexpr function table if necessary. */ ! if (constexpr_fundef_table == NULL) ! constexpr_fundef_table = htab_create_ggc (101, ! constexpr_fundef_hash, ! constexpr_fundef_equal, ! ggc_free); ! entry.decl = fun; ! entry.body = body; ! slot = (constexpr_fundef **) ! htab_find_slot (constexpr_fundef_table, &entry, INSERT); ! ! gcc_assert (*slot == NULL); ! *slot = ggc_alloc_constexpr_fundef (); ! **slot = entry; ! return fun; } *************** cxx_bind_parameters_in_call (const const *** 5922,5938 **** /* Variables and functions to manage constexpr call expansion context. These do not need to be marked for PCH or GC. */ static VEC(tree,heap) *call_stack = NULL; static int call_stack_tick; static int last_cx_error_tick; ! static void push_cx_call_context (tree call) { ++call_stack_tick; if (!EXPR_HAS_LOCATION (call)) SET_EXPR_LOCATION (call, input_location); VEC_safe_push (tree, heap, call_stack, call); } static void --- 5963,5983 ---- /* Variables and functions to manage constexpr call expansion context. These do not need to be marked for PCH or GC. */ + /* FIXME remember and print actual constant arguments. */ static VEC(tree,heap) *call_stack = NULL; static int call_stack_tick; static int last_cx_error_tick; ! static bool push_cx_call_context (tree call) { ++call_stack_tick; if (!EXPR_HAS_LOCATION (call)) SET_EXPR_LOCATION (call, input_location); VEC_safe_push (tree, heap, call_stack, call); + if (VEC_length (tree, call_stack) > (unsigned) max_constexpr_depth) + return false; + return true; } static void *************** cxx_eval_call_expression (const constexp *** 5967,5972 **** --- 6012,6020 ---- tree result; constexpr_call new_call = { NULL, NULL, NULL, 0 }; constexpr_call **slot; + constexpr_call *entry; + bool depth_ok; + if (TREE_CODE (fun) != FUNCTION_DECL) { /* Might be a constexpr function pointer. */ *************** cxx_eval_call_expression (const constexp *** 5993,5999 **** if (!allow_non_constant) { error_at (loc, "%qD is not a constexpr function", fun); ! if (DECL_TEMPLATE_INSTANTIATION (fun) && DECL_DECLARED_CONSTEXPR_P (DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (fun)))) is_valid_constexpr_fn (fun, true); --- 6041,6047 ---- if (!allow_non_constant) { error_at (loc, "%qD is not a constexpr function", fun); ! if (DECL_TEMPLATE_INFO (fun) && DECL_DECLARED_CONSTEXPR_P (DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (fun)))) is_valid_constexpr_fn (fun, true); *************** cxx_eval_call_expression (const constexp *** 6029,6035 **** if (*non_constant_p) return t; ! push_cx_call_context (t); new_call.hash = iterative_hash_template_arg (new_call.bindings, --- 6077,6083 ---- if (*non_constant_p) return t; ! depth_ok = push_cx_call_context (t); new_call.hash = iterative_hash_template_arg (new_call.bindings, *************** cxx_eval_call_expression (const constexp *** 6039,6075 **** maybe_initialize_constexpr_call_table (); slot = (constexpr_call **) htab_find_slot (constexpr_call_table, &new_call, INSERT); ! if (*slot != NULL) ! { ! /* Calls which are in progress have their result set to NULL ! so that we can detect circular dependencies. */ ! if ((*slot)->result == NULL) ! { ! if (!allow_non_constant) ! error ("call has circular dependency"); ! (*slot)->result = result = error_mark_node; ! } ! else ! { ! result = (*slot)->result; ! if (result == error_mark_node && !allow_non_constant) ! /* Re-evaluate to get the error. */ ! cxx_eval_constant_expression (&new_call, new_call.fundef->body, ! allow_non_constant, addr, ! non_constant_p); ! } ! } ! else { /* We need to keep a pointer to the entry, not just the slot, as the slot can move in the call to cxx_eval_builtin_function_call. */ ! constexpr_call *entry = ggc_alloc_constexpr_call (); *entry = new_call; ! *slot = entry; ! result ! = cxx_eval_constant_expression (&new_call, new_call.fundef->body, ! allow_non_constant, addr, ! non_constant_p); if (*non_constant_p) entry->result = result = error_mark_node; else --- 6087,6129 ---- maybe_initialize_constexpr_call_table (); slot = (constexpr_call **) htab_find_slot (constexpr_call_table, &new_call, INSERT); ! entry = *slot; ! if (entry == NULL) { /* We need to keep a pointer to the entry, not just the slot, as the slot can move in the call to cxx_eval_builtin_function_call. */ ! *slot = entry = ggc_alloc_constexpr_call (); *entry = new_call; ! } ! /* Calls which are in progress have their result set to NULL ! so that we can detect circular dependencies. */ ! else if (entry->result == NULL) ! { ! if (!allow_non_constant) ! error ("call has circular dependency"); ! *non_constant_p = true; ! entry->result = result = error_mark_node; ! } ! ! if (!depth_ok) ! { ! if (!allow_non_constant) ! error ("constexpr evaluation depth exceeds maximum of %d (use " ! "-fconstexpr-depth= to increase the maximum)", ! max_constexpr_depth); ! *non_constant_p = true; ! entry->result = result = error_mark_node; ! } ! else ! { ! result = entry->result; ! if (!result || (result == error_mark_node && !allow_non_constant)) ! result = (cxx_eval_constant_expression ! (&new_call, new_call.fundef->body, ! allow_non_constant, addr, ! non_constant_p)); ! if (result == error_mark_node) ! *non_constant_p = true; if (*non_constant_p) entry->result = result = error_mark_node; else *************** cxx_eval_conditional_expression (const c *** 6206,6218 **** allow_non_constant, addr, non_constant_p); VERIFY_CONSTANT (val); ! if (val == boolean_true_node) ! return cxx_eval_constant_expression (call, TREE_OPERAND (t, 1), allow_non_constant, addr, non_constant_p); ! gcc_assert (val == boolean_false_node); ! /* Don't VERIFY_CONSTANT here. */ ! return cxx_eval_constant_expression (call, TREE_OPERAND (t, 2), allow_non_constant, addr, non_constant_p); } --- 6260,6271 ---- allow_non_constant, addr, non_constant_p); VERIFY_CONSTANT (val); ! /* Don't VERIFY_CONSTANT the other operands. */ ! if (integer_zerop (val)) ! return cxx_eval_constant_expression (call, TREE_OPERAND (t, 2), allow_non_constant, addr, non_constant_p); ! return cxx_eval_constant_expression (call, TREE_OPERAND (t, 1), allow_non_constant, addr, non_constant_p); } *************** cxx_eval_array_reference (const constexp *** 6231,6237 **** non_constant_p); tree index, oldidx; HOST_WIDE_INT i; ! unsigned len; if (*non_constant_p) return t; oldidx = TREE_OPERAND (t, 1); --- 6284,6291 ---- non_constant_p); tree index, oldidx; HOST_WIDE_INT i; ! tree elem_type; ! unsigned len, elem_nchars = 1; if (*non_constant_p) return t; oldidx = TREE_OPERAND (t, 1); *************** cxx_eval_array_reference (const constexp *** 6243,6253 **** return t; else if (addr) return build4 (ARRAY_REF, TREE_TYPE (t), ary, index, NULL, NULL); ! len = (TREE_CODE (ary) == CONSTRUCTOR ! ? CONSTRUCTOR_NELTS (ary) ! : (unsigned)TREE_STRING_LENGTH (ary)); if (compare_tree_int (index, len) >= 0) { if (!allow_non_constant) error ("array subscript out of bound"); *non_constant_p = true; --- 6297,6323 ---- return t; else if (addr) return build4 (ARRAY_REF, TREE_TYPE (t), ary, index, NULL, NULL); ! elem_type = TREE_TYPE (TREE_TYPE (ary)); ! if (TREE_CODE (ary) == CONSTRUCTOR) ! len = CONSTRUCTOR_NELTS (ary); ! else ! { ! elem_nchars = (TYPE_PRECISION (elem_type) ! / TYPE_PRECISION (char_type_node)); ! len = (unsigned) TREE_STRING_LENGTH (ary) / elem_nchars; ! } if (compare_tree_int (index, len) >= 0) { + if (tree_int_cst_lt (index, array_type_nelts_top (TREE_TYPE (ary)))) + { + /* If it's within the array bounds but doesn't have an explicit + initializer, it's value-initialized. */ + tree val = build_value_init (elem_type, tf_warning_or_error); + return cxx_eval_constant_expression (call, val, + allow_non_constant, addr, + non_constant_p); + } + if (!allow_non_constant) error ("array subscript out of bound"); *non_constant_p = true; *************** cxx_eval_array_reference (const constexp *** 6256,6264 **** i = tree_low_cst (index, 0); if (TREE_CODE (ary) == CONSTRUCTOR) return VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ary), i)->value; ! else return build_int_cst (cv_unqualified (TREE_TYPE (TREE_TYPE (ary))), TREE_STRING_POINTER (ary)[i]); /* Don't VERIFY_CONSTANT here. */ } --- 6326,6341 ---- i = tree_low_cst (index, 0); if (TREE_CODE (ary) == CONSTRUCTOR) return VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ary), i)->value; ! else if (elem_nchars == 1) return build_int_cst (cv_unqualified (TREE_TYPE (TREE_TYPE (ary))), TREE_STRING_POINTER (ary)[i]); + else + { + tree type = cv_unqualified (TREE_TYPE (TREE_TYPE (ary))); + return native_interpret_expr (type, (const unsigned char *) + TREE_STRING_POINTER (ary) + + i * elem_nchars, elem_nchars); + } /* Don't VERIFY_CONSTANT here. */ } *************** cxx_eval_bit_field_ref (const constexpr_ *** 6321,6326 **** --- 6398,6406 ---- bool *non_constant_p) { tree orig_whole = TREE_OPERAND (t, 0); + tree retval, fldval, utype, mask; + bool fld_seen = false; + HOST_WIDE_INT istart, isize; tree whole = cxx_eval_constant_expression (call, orig_whole, allow_non_constant, addr, non_constant_p); *************** cxx_eval_bit_field_ref (const constexpr_ *** 6341,6352 **** return t; start = TREE_OPERAND (t, 2); FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (whole), i, field, value) { ! if (bit_position (field) == start) return value; } ! gcc_unreachable(); return error_mark_node; } --- 6421,6467 ---- return t; start = TREE_OPERAND (t, 2); + istart = tree_low_cst (start, 0); + isize = tree_low_cst (TREE_OPERAND (t, 1), 0); + utype = TREE_TYPE (t); + if (!TYPE_UNSIGNED (utype)) + utype = build_nonstandard_integer_type (TYPE_PRECISION (utype), 1); + retval = build_int_cst (utype, 0); FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (whole), i, field, value) { ! tree bitpos = bit_position (field); ! if (bitpos == start && DECL_SIZE (field) == TREE_OPERAND (t, 1)) return value; + if (TREE_CODE (TREE_TYPE (field)) == INTEGER_TYPE + && TREE_CODE (value) == INTEGER_CST + && host_integerp (bitpos, 0) + && host_integerp (DECL_SIZE (field), 0)) + { + HOST_WIDE_INT bit = tree_low_cst (bitpos, 0); + HOST_WIDE_INT sz = tree_low_cst (DECL_SIZE (field), 0); + HOST_WIDE_INT shift; + if (bit >= istart && bit + sz <= istart + isize) + { + fldval = fold_convert (utype, value); + mask = build_int_cst_type (utype, -1); + mask = fold_build2 (LSHIFT_EXPR, utype, mask, + size_int (TYPE_PRECISION (utype) - sz)); + mask = fold_build2 (RSHIFT_EXPR, utype, mask, + size_int (TYPE_PRECISION (utype) - sz)); + fldval = fold_build2 (BIT_AND_EXPR, utype, fldval, mask); + shift = bit - istart; + if (BYTES_BIG_ENDIAN) + shift = TYPE_PRECISION (utype) - shift - sz; + fldval = fold_build2 (LSHIFT_EXPR, utype, fldval, + size_int (shift)); + retval = fold_build2 (BIT_IOR_EXPR, utype, retval, fldval); + fld_seen = true; + } + } } ! if (fld_seen) ! return fold_convert (TREE_TYPE (t), retval); ! gcc_unreachable (); return error_mark_node; } *************** cxx_eval_indirect_ref (const constexpr_c *** 6681,6688 **** else if (TREE_CODE (sub) == ADDR_EXPR || TREE_CODE (sub) == POINTER_PLUS_EXPR) { - gcc_assert (!same_type_ignoring_top_level_qualifiers_p - (TREE_TYPE (TREE_TYPE (sub)), TREE_TYPE (t))); /* FIXME Mike Miller wants this to be OK. */ if (!allow_non_constant) error ("accessing value of %qE through a %qT glvalue in a " --- 6796,6801 ---- *************** non_const_var_error (tree r) *** 6717,6722 **** --- 6830,6838 ---- tree type = TREE_TYPE (r); error ("the value of %qD is not usable in a constant " "expression", r); + /* Avoid error cascade. */ + if (DECL_INITIAL (r) == error_mark_node) + return; if (DECL_DECLARED_CONSTEXPR_P (r)) inform (DECL_SOURCE_LOCATION (r), "%qD used in its own initializer", r); *************** cxx_eval_constant_expression (const cons *** 6896,6902 **** r = cxx_eval_constant_expression (call, op0, allow_non_constant, addr, non_constant_p); else ! goto binary; } break; --- 7012,7024 ---- r = cxx_eval_constant_expression (call, op0, allow_non_constant, addr, non_constant_p); else ! { ! /* Check that the LHS is constant and then discard it. */ ! cxx_eval_constant_expression (call, op0, allow_non_constant, ! false, non_constant_p); ! r = cxx_eval_constant_expression (call, op1, allow_non_constant, ! addr, non_constant_p); ! } } break; *************** cxx_eval_constant_expression (const cons *** 6938,6944 **** case UNEQ_EXPR: case RANGE_EXPR: case COMPLEX_EXPR: - binary: r = cxx_eval_binary_expression (call, t, allow_non_constant, addr, non_constant_p); break; --- 7060,7065 ---- *************** cxx_eval_constant_expression (const cons *** 7025,7030 **** --- 7146,7156 ---- conversion. */ return fold (t); r = fold_build1 (TREE_CODE (t), to, op); + /* Conversion of an out-of-range value has implementation-defined + behavior; the language considers it different from arithmetic + overflow, which is undefined. */ + if (TREE_OVERFLOW_P (r) && !TREE_OVERFLOW_P (op)) + TREE_OVERFLOW (r) = false; } break; *************** potential_constant_expression_1 (tree t, *** 7306,7311 **** --- 7432,7439 ---- case TEMPLATE_PARM_INDEX: case TRAIT_EXPR: case IDENTIFIER_NODE: + /* We can see a FIELD_DECL in a pointer-to-member expression. */ + case FIELD_DECL: return true; case PARM_DECL: *************** potential_constant_expression_1 (tree t, *** 7313,7318 **** --- 7441,7448 ---- class member access expression, including the result of the implicit transformation in the body of the non-static member function (9.3.1); */ + /* FIXME this restriction seems pointless since the standard dropped + "potential constant expression". */ if (is_this_parameter (t)) { if (flags & tf_error) *************** potential_constant_expression_1 (tree t, *** 7328,7378 **** { tree fun = get_function_named_in_call (t); const int nargs = call_expr_nargs (t); ! if (TREE_CODE (fun) != FUNCTION_DECL) ! { ! if (potential_constant_expression_1 (fun, rval, flags)) ! /* Might end up being a constant function pointer. */ ! return true; ! if (flags & tf_error) ! error ("%qE is not a function name", fun); ! return false; ! } ! /* Skip initial arguments to base constructors. */ ! if (DECL_BASE_CONSTRUCTOR_P (fun)) ! i = num_artificial_parms_for (fun); else - i = 0; - fun = DECL_ORIGIN (fun); - if (builtin_valid_in_constant_expr_p (fun)) - return true; - if (!DECL_DECLARED_CONSTEXPR_P (fun) - && !morally_constexpr_builtin_function_p (fun)) { ! if (flags & tf_error) ! error ("%qD is not %", fun); ! return false; } for (; i < nargs; ++i) { tree x = get_nth_callarg (t, i); ! /* A call to a non-static member function takes the ! address of the object as the first argument. ! But in a constant expression the address will be folded ! away, so look through it now. */ ! if (i == 0 && DECL_NONSTATIC_MEMBER_P (fun) ! && !DECL_CONSTRUCTOR_P (fun)) ! { ! if (is_this_parameter (x)) ! /* OK. */; ! else if (!potential_constant_expression_1 (x, rval, flags)) ! { ! if (flags & tf_error) ! error ("object argument is not a potential constant " ! "expression"); ! return false; ! } ! } ! else if (!potential_constant_expression_1 (x, rval, flags)) { if (flags & tf_error) error ("argument in position %qP is not a " --- 7458,7520 ---- { tree fun = get_function_named_in_call (t); const int nargs = call_expr_nargs (t); ! i = 0; ! ! if (is_overloaded_fn (fun)) ! { ! if (TREE_CODE (fun) == FUNCTION_DECL) ! { ! if (builtin_valid_in_constant_expr_p (fun)) ! return true; ! if (!DECL_DECLARED_CONSTEXPR_P (fun) ! && !morally_constexpr_builtin_function_p (fun)) ! { ! if (flags & tf_error) ! error ("%qD is not %", fun); ! return false; ! } ! /* A call to a non-static member function takes the address ! of the object as the first argument. But in a constant ! expression the address will be folded away, so look ! through it now. */ ! if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) ! && !DECL_CONSTRUCTOR_P (fun)) ! { ! tree x = get_nth_callarg (t, 0); ! if (is_this_parameter (x)) ! /* OK. */; ! else if (!potential_constant_expression_1 (x, rval, flags)) ! { ! if (flags & tf_error) ! error ("object argument is not a potential " ! "constant expression"); ! return false; ! } ! i = 1; ! } ! } ! else ! fun = get_first_fn (fun); ! /* Skip initial arguments to base constructors. */ ! if (DECL_BASE_CONSTRUCTOR_P (fun)) ! i = num_artificial_parms_for (fun); ! fun = DECL_ORIGIN (fun); ! } else { ! if (potential_constant_expression_1 (fun, rval, flags)) ! /* Might end up being a constant function pointer. */; ! else ! { ! if (flags & tf_error) ! error ("%qE is not a function name", fun); ! return false; ! } } for (; i < nargs; ++i) { tree x = get_nth_callarg (t, i); ! if (!potential_constant_expression_1 (x, rval, flags)) { if (flags & tf_error) error ("argument in position %qP is not a " *************** potential_constant_expression_1 (tree t, *** 7472,7478 **** tree x = TREE_OPERAND (t, 0); STRIP_NOPS (x); if (is_this_parameter (x)) ! return true; return potential_constant_expression_1 (x, rval, flags); } --- 7614,7629 ---- tree x = TREE_OPERAND (t, 0); STRIP_NOPS (x); if (is_this_parameter (x)) ! { ! if (DECL_CONSTRUCTOR_P (DECL_CONTEXT (x)) && want_rval) ! { ! if (flags & tf_error) ! sorry ("use of the value of the object being constructed " ! "in a constant expression"); ! return false; ! } ! return true; ! } return potential_constant_expression_1 (x, rval, flags); } *************** potential_constant_expression_1 (tree t, *** 7555,7560 **** --- 7706,7717 ---- want_rval = true; goto binary; + case BIT_NOT_EXPR: + /* A destructor. */ + if (TYPE_P (TREE_OPERAND (t, 0))) + return true; + /* else fall through. */ + case REALPART_EXPR: case IMAGPART_EXPR: case CONJ_EXPR: *************** potential_constant_expression_1 (tree t, *** 7563,7569 **** case FLOAT_EXPR: case NEGATE_EXPR: case ABS_EXPR: - case BIT_NOT_EXPR: case TRUTH_NOT_EXPR: case FIXED_CONVERT_EXPR: case UNARY_PLUS_EXPR: --- 7720,7725 ---- *************** potential_constant_expression_1 (tree t, *** 7689,7694 **** --- 7845,7852 ---- case BIT_XOR_EXPR: case BIT_AND_EXPR: case TRUTH_XOR_EXPR: + case UNORDERED_EXPR: + case ORDERED_EXPR: case UNLT_EXPR: case UNLE_EXPR: case UNGT_EXPR: *************** potential_constant_expression_1 (tree t, *** 7717,7728 **** tmp = TREE_OPERAND (t, 0); if (!potential_constant_expression_1 (tmp, rval, flags)) return false; ! else if (tmp == boolean_true_node) ! return potential_constant_expression_1 (TREE_OPERAND (t, 1), ! want_rval, flags); ! else if (tmp == boolean_false_node) return potential_constant_expression_1 (TREE_OPERAND (t, 2), want_rval, flags); for (i = 1; i < 3; ++i) if (potential_constant_expression_1 (TREE_OPERAND (t, i), want_rval, tf_none)) --- 7875,7886 ---- tmp = TREE_OPERAND (t, 0); if (!potential_constant_expression_1 (tmp, rval, flags)) return false; ! else if (integer_zerop (tmp)) return potential_constant_expression_1 (TREE_OPERAND (t, 2), want_rval, flags); + else if (TREE_CODE (tmp) == INTEGER_CST) + return potential_constant_expression_1 (TREE_OPERAND (t, 1), + want_rval, flags); for (i = 1; i < 3; ++i) if (potential_constant_expression_1 (TREE_OPERAND (t, i), want_rval, tf_none)) *************** lambda_function (tree lambda) *** 7940,7946 **** type = lambda; gcc_assert (LAMBDA_TYPE_P (type)); /* Don't let debug_tree cause instantiation. */ ! if (CLASSTYPE_TEMPLATE_INSTANTIATION (type) && !COMPLETE_TYPE_P (type)) return NULL_TREE; lambda = lookup_member (type, ansi_opname (CALL_EXPR), /*protect=*/0, /*want_type=*/false); --- 8098,8105 ---- type = lambda; gcc_assert (LAMBDA_TYPE_P (type)); /* Don't let debug_tree cause instantiation. */ ! if (CLASSTYPE_TEMPLATE_INSTANTIATION (type) ! && !COMPLETE_OR_OPEN_TYPE_P (type)) return NULL_TREE; lambda = lookup_member (type, ansi_opname (CALL_EXPR), /*protect=*/0, /*want_type=*/false); *************** maybe_add_lambda_conv_op (tree type) *** 8371,8377 **** { /* Put the thunk in the same comdat group as the call op. */ struct cgraph_node *callop_node, *thunk_node; ! DECL_COMDAT_GROUP (statfn) = DECL_COMDAT_GROUP (callop); callop_node = cgraph_node (callop); thunk_node = cgraph_node (statfn); gcc_assert (callop_node->same_comdat_group == NULL); --- 8530,8536 ---- { /* Put the thunk in the same comdat group as the call op. */ struct cgraph_node *callop_node, *thunk_node; ! DECL_COMDAT_GROUP (statfn) = cxx_comdat_group (callop); callop_node = cgraph_node (callop); thunk_node = cgraph_node (statfn); gcc_assert (callop_node->same_comdat_group == NULL); *************** maybe_add_lambda_conv_op (tree type) *** 8387,8393 **** argvec = make_tree_vector (); VEC_quick_push (tree, argvec, arg); for (arg = DECL_ARGUMENTS (statfn); arg; arg = DECL_CHAIN (arg)) ! VEC_safe_push (tree, gc, argvec, arg); call = build_call_a (callop, VEC_length (tree, argvec), VEC_address (tree, argvec)); CALL_FROM_THUNK_P (call) = 1; --- 8546,8555 ---- argvec = make_tree_vector (); VEC_quick_push (tree, argvec, arg); for (arg = DECL_ARGUMENTS (statfn); arg; arg = DECL_CHAIN (arg)) ! { ! mark_exp_read (arg); ! VEC_safe_push (tree, gc, argvec, arg); ! } call = build_call_a (callop, VEC_length (tree, argvec), VEC_address (tree, argvec)); CALL_FROM_THUNK_P (call) = 1; diff -Nrcpad gcc-4.6.0/gcc/cp/tree.c gcc-4.6.1/gcc/cp/tree.c *** gcc-4.6.0/gcc/cp/tree.c Thu Mar 3 02:49:19 2011 --- gcc-4.6.1/gcc/cp/tree.c Mon Jun 6 04:31:24 2011 *************** build_target_expr (tree decl, tree value *** 286,291 **** --- 286,294 ---- #ifdef ENABLE_CHECKING gcc_assert (VOID_TYPE_P (TREE_TYPE (value)) || TREE_TYPE (decl) == TREE_TYPE (value) + /* On ARM ctors return 'this'. */ + || (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE + && TREE_CODE (value) == CALL_EXPR) || useless_type_conversion_p (TREE_TYPE (decl), TREE_TYPE (value))); #endif *************** build_overload (tree decl, tree chain) *** 1465,1470 **** --- 1468,1501 ---- return ovl_cons (decl, chain); } + /* Return TRUE if FN is a non-static member function, FALSE otherwise. + This function looks into BASELINK and OVERLOAD nodes. */ + + bool + non_static_member_function_p (tree fn) + { + if (fn == NULL_TREE) + return false; + + if (BASELINK_P (fn)) + { + tree type = TREE_TYPE (fn); + + if (type && TREE_CODE (type) == METHOD_TYPE) + return true; + else if (type && TREE_CODE (type) == FUNCTION_TYPE) + return false; + /* This is an overload. Lets look into its current value. */ + fn = get_fns (BASELINK_FUNCTIONS (fn)); + } + + if (TREE_CODE (fn) == OVERLOAD) + fn = OVL_CURRENT (fn); + + return (DECL_P (fn) + && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)); + } + #define PRINT_RING_SIZE 4 *************** maybe_dummy_object (tree type, tree* bin *** 2421,2427 **** else if (current != current_class_type && context == nonlambda_method_basetype ()) /* In a lambda, need to go through 'this' capture. */ ! decl = (cp_build_indirect_ref ((lambda_expr_this_capture (CLASSTYPE_LAMBDA_EXPR (current_class_type))), RO_NULL, tf_warning_or_error)); --- 2452,2458 ---- else if (current != current_class_type && context == nonlambda_method_basetype ()) /* In a lambda, need to go through 'this' capture. */ ! decl = (build_x_indirect_ref ((lambda_expr_this_capture (CLASSTYPE_LAMBDA_EXPR (current_class_type))), RO_NULL, tf_warning_or_error)); *************** stabilize_expr (tree exp, tree* initp) *** 3096,3102 **** if (!TREE_SIDE_EFFECTS (exp)) init_expr = NULL_TREE; ! else if (!TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp)) || !lvalue_or_rvalue_with_address_p (exp)) { init_expr = get_target_expr (exp); --- 3127,3134 ---- if (!TREE_SIDE_EFFECTS (exp)) init_expr = NULL_TREE; ! else if ((!TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp)) ! && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (exp))) || !lvalue_or_rvalue_with_address_p (exp)) { init_expr = get_target_expr (exp); diff -Nrcpad gcc-4.6.0/gcc/cp/typeck.c gcc-4.6.1/gcc/cp/typeck.c *** gcc-4.6.0/gcc/cp/typeck.c Wed Mar 16 20:03:01 2011 --- gcc-4.6.1/gcc/cp/typeck.c Tue Jun 7 15:12:15 2011 *************** composite_pointer_type_r (tree t1, tree *** 516,522 **** { if (complain & tf_error) composite_pointer_error (DK_PERMERROR, t1, t2, operation); ! result_type = void_type_node; } result_type = cp_build_qualified_type (result_type, --- 516,523 ---- { if (complain & tf_error) composite_pointer_error (DK_PERMERROR, t1, t2, operation); ! else ! return error_mark_node; result_type = void_type_node; } result_type = cp_build_qualified_type (result_type, *************** composite_pointer_type_r (tree t1, tree *** 527,535 **** if (TYPE_PTR_TO_MEMBER_P (t1)) { if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1), ! TYPE_PTRMEM_CLASS_TYPE (t2)) ! && (complain & tf_error)) ! composite_pointer_error (DK_PERMERROR, t1, t2, operation); result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1), result_type); } --- 528,540 ---- if (TYPE_PTR_TO_MEMBER_P (t1)) { if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1), ! TYPE_PTRMEM_CLASS_TYPE (t2))) ! { ! if (complain & tf_error) ! composite_pointer_error (DK_PERMERROR, t1, t2, operation); ! else ! return error_mark_node; ! } result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1), result_type); } *************** comp_except_specs (const_tree t1, const_ *** 986,999 **** /* First handle noexcept. */ if (exact < ce_exact) { ! /* noexcept(false) is compatible with any throwing dynamic-exc-spec and stricter than any spec. */ if (t1 == noexcept_false_spec) ! return !nothrow_spec_p (t2) || exact == ce_derived; ! /* Even a derived noexcept(false) is compatible with a throwing ! dynamic spec. */ if (t2 == noexcept_false_spec) ! return !nothrow_spec_p (t1); /* Otherwise, if we aren't looking for an exact match, noexcept is equivalent to throw(). */ --- 991,1004 ---- /* First handle noexcept. */ if (exact < ce_exact) { ! /* noexcept(false) is compatible with no exception-specification, and stricter than any spec. */ if (t1 == noexcept_false_spec) ! return t2 == NULL_TREE || exact == ce_derived; ! /* Even a derived noexcept(false) is compatible with no ! exception-specification. */ if (t2 == noexcept_false_spec) ! return t1 == NULL_TREE; /* Otherwise, if we aren't looking for an exact match, noexcept is equivalent to throw(). */ *************** perform_integral_promotions (tree expr) *** 1941,1946 **** --- 1946,1954 ---- if (!type || TREE_CODE (type) != ENUMERAL_TYPE) type = TREE_TYPE (expr); gcc_assert (INTEGRAL_OR_ENUMERATION_TYPE_P (type)); + /* Scoped enums don't promote. */ + if (SCOPED_ENUM_P (type)) + return expr; promoted_type = type_promotes_to (type); if (type != promoted_type) expr = cp_convert (promoted_type, expr); *************** cp_build_binary_op (location_t location, *** 4354,4360 **** gcc_unreachable(); } } ! return build2 (COMPLEX_EXPR, result_type, real, imag); } /* For certain operations (which identify themselves by shorten != 0) --- 4362,4372 ---- gcc_unreachable(); } } ! real = fold_if_not_in_template (real); ! imag = fold_if_not_in_template (imag); ! result = build2 (COMPLEX_EXPR, result_type, real, imag); ! result = fold_if_not_in_template (result); ! return result; } /* For certain operations (which identify themselves by shorten != 0) *************** build_x_compound_expr_from_list (tree li *** 5469,5474 **** --- 5481,5488 ---- default: gcc_unreachable (); } + else + return error_mark_node; for (list = TREE_CHAIN (list); list; list = TREE_CHAIN (list)) expr = build_x_compound_expr (expr, TREE_VALUE (list), *************** build_const_cast_1 (tree dst_type, tree *** 6209,6222 **** /* [expr.const.cast] ! An lvalue of type T1 can be explicitly converted to an lvalue of ! type T2 using the cast const_cast (where T1 and T2 are object ! types) if a pointer to T1 can be explicitly converted to the type ! pointer to T2 using a const_cast. */ if (TREE_CODE (dst_type) == REFERENCE_TYPE) { reference_type = dst_type; ! if (! real_lvalue_p (expr)) { if (complain) error ("invalid const_cast of an rvalue of type %qT to type %qT", --- 6223,6251 ---- /* [expr.const.cast] ! For two object types T1 and T2, if a pointer to T1 can be explicitly ! converted to the type "pointer to T2" using a const_cast, then the ! following conversions can also be made: ! ! -- an lvalue of type T1 can be explicitly converted to an lvalue of ! type T2 using the cast const_cast; ! ! -- a glvalue of type T1 can be explicitly converted to an xvalue of ! type T2 using the cast const_cast; and ! ! -- if T1 is a class type, a prvalue of type T1 can be explicitly ! converted to an xvalue of type T2 using the cast const_cast. */ ! if (TREE_CODE (dst_type) == REFERENCE_TYPE) { reference_type = dst_type; ! if (!TYPE_REF_IS_RVALUE (dst_type) ! ? real_lvalue_p (expr) ! : (CLASS_TYPE_P (TREE_TYPE (dst_type)) ! ? lvalue_p (expr) ! : lvalue_or_rvalue_with_address_p (expr))) ! /* OK. */; ! else { if (complain) error ("invalid const_cast of an rvalue of type %qT to type %qT", *************** cp_build_modify_expr (tree lhs, enum tre *** 6701,6707 **** /* Allow array assignment in compiler-generated code. */ else if (!current_function_decl ! || !DECL_ARTIFICIAL (current_function_decl)) { /* This routine is used for both initialization and assignment. Make sure the diagnostic message differentiates the context. */ --- 6730,6736 ---- /* Allow array assignment in compiler-generated code. */ else if (!current_function_decl ! || !DECL_DEFAULTED_FN (current_function_decl)) { /* This routine is used for both initialization and assignment. Make sure the diagnostic message differentiates the context. */ *************** check_return_expr (tree retval, bool *no *** 7760,7771 **** /* Under C++0x [12.8/16 class.copy], a returned lvalue is sometimes treated as an rvalue for the purposes of overload resolution to ! favor move constructors over copy constructors. */ ! if ((cxx_dialect != cxx98) ! && named_return_value_okay_p ! /* The variable must not have the `volatile' qualifier. */ ! && !CP_TYPE_VOLATILE_P (TREE_TYPE (retval)) ! /* The return type must be a class type. */ && CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))) flags = flags | LOOKUP_PREFER_RVALUE; --- 7789,7807 ---- /* Under C++0x [12.8/16 class.copy], a returned lvalue is sometimes treated as an rvalue for the purposes of overload resolution to ! favor move constructors over copy constructors. ! ! Note that these conditions are similar to, but not as strict as, ! the conditions for the named return value optimization. */ ! if ((cxx_dialect != cxx98) ! && (TREE_CODE (retval) == VAR_DECL ! || TREE_CODE (retval) == PARM_DECL) ! && DECL_CONTEXT (retval) == current_function_decl ! && !TREE_STATIC (retval) ! && same_type_p ((TYPE_MAIN_VARIANT (TREE_TYPE (retval))), ! (TYPE_MAIN_VARIANT ! (TREE_TYPE (TREE_TYPE (current_function_decl))))) ! /* This is only interesting for class type. */ && CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))) flags = flags | LOOKUP_PREFER_RVALUE; diff -Nrcpad gcc-4.6.0/gcc/cp/typeck2.c gcc-4.6.1/gcc/cp/typeck2.c *** gcc-4.6.0/gcc/cp/typeck2.c Fri Jan 14 13:08:11 2011 --- gcc-4.6.1/gcc/cp/typeck2.c Fri May 20 21:29:14 2011 *************** add_exception_specifier (tree list, tree *** 1672,1681 **** tree merge_exception_specifiers (tree list, tree add) { ! if (!list || !add) ! return NULL_TREE; /* For merging noexcept(true) and throw(), take the more recent one (LIST). - A throw(type-list) spec takes precedence over a noexcept(false) spec. Any other noexcept-spec should only be merged with an equivalent one. So the !TREE_VALUE code below is correct for all cases. */ else if (!TREE_VALUE (add)) --- 1672,1684 ---- tree merge_exception_specifiers (tree list, tree add) { ! /* No exception-specifier or noexcept(false) are less strict than ! anything else. Prefer the newer variant (LIST). */ ! if (!list || list == noexcept_false_spec) ! return list; ! else if (!add || add == noexcept_false_spec) ! return add; /* For merging noexcept(true) and throw(), take the more recent one (LIST). Any other noexcept-spec should only be merged with an equivalent one. So the !TREE_VALUE code below is correct for all cases. */ else if (!TREE_VALUE (add)) diff -Nrcpad gcc-4.6.0/libstdc++-v3/ChangeLog gcc-4.6.1/libstdc++-v3/ChangeLog *** gcc-4.6.0/libstdc++-v3/ChangeLog Fri Mar 25 16:56:00 2011 --- gcc-4.6.1/libstdc++-v3/ChangeLog Mon Jun 27 10:04:10 2011 *************** *** 1,3 **** --- 1,247 ---- + 2011-06-27 Release Manager + + * GCC 4.6.1 released. + + 2011-05-25 Paolo Carlini + + * config/abi/pre/gnu.ver: Correct last change, export instead + at the existing @3.4.16. + * configure.ac: Revert last change. + * testsuite/util/testsuite_abi.cc: Likewise. + * configure: Regenerate. + + 2011-05-25 Paolo Carlini + + * config/abi/pre/gnu.ver: Export recently added basic_streambuf + and basic_stringbuf symbols @3.4.17. + * configure.ac: Update. + * testsuite/util/testsuite_abi.cc: Likewise. + * configure: Regenerate. + + 2011-05-24 Paolo Carlini + + PR libstdc++/49141 + * testsuite/26_numerics/complex/cons/48760.cc: Use dg-require-c-std. + * testsuite/26_numerics/headers/cmath/19322.cc: Likewise. + + 2011-05-22 Jonathan Wakely + + * testsuite/20_util/bind/cv_quals_2.cc: New. + + 2011-05-22 Paolo Carlini + + PR libstdc++/49058 + * include/std/functional (_Bind<_Functor(_Bound_args...)>:: + operator()(_Args&&...)): Don't cv qualify _Functor directly + in the default template argument, SFINAE doesn't apply when + the functor has no arguments. + * testsuite/20_util/bind/49058_1.cc: New. + * testsuite/20_util/bind/49058_2.cc: Likewise. + + 2011-05-06 Jonathan Wakely + + * doc/xml/manual/status_cxx200x.xml: Update to reflect current status + and FDIS content. + * doc/xml/manual/documentation_hacking.xml: Fix typo. + * doc/html/*: Regenerate. + + 2011-05-03 Ollie Wild + + * include/ext/sso_string_base.h (__sso_string_base<>::_M_construct): + Fix unqualified lookup. + (__sso_string_base<>::_M_construct): Likewise. + (__sso_string_base<>::_M_construct): Likewise. + (__sso_string_base<>::_M_assign): Likewise. + (__sso_string_base<>::_M_reserve): Likewise. + (__sso_string_base<>::_M_mutate): Likewise. + (__sso_string_base<>::_M_erase): Likewise. + * include/ext/vstring.h (__versa_string<>::replace): Likewise. + (__versa_string<>::compare): Likewise. + * include/ext/vstring.tcc (__versa_string<>::compare): Likewise. + (__versa_string<>::compare): Likewise. + (__versa_string<>::compare): Likewise. + (__versa_string<>::compare): Likewise. + (__versa_string<>::compare): Likewise. + + 2011-05-03 Paolo Carlini + + PR libstdc++/48750 + * include/parallel/multiway_merge.h: Run _ValueType destructors. + * include/parallel/multiway_mergesort.h: Likewise. + * include/parallel/quicksort.h: Likewise. + * include/parallel/random_shuffle.h: Likewise. + * include/parallel/partial_sum.h: Likewise. + * include/parallel/losertree.h: Run destructors; minor tweaks. + * include/parallel/par_loop.h: Run destructors, fix memory + allocations and deallocations. + * testsuite/26_numerics/accumulate/48750.cc: New. + + * testsuite/ext/profile/mutex_extensions_neg.cc: Do not run in + parallel-mode to avoid spurious multiple errors. + + 2011-04-30 Doug Kwan + + * include/Makefile.am (install-freestanding-headers): Also install + cxxabi_tweaks.h. + * include/Makefile.in: Regenerate. + + 2011-04-29 Paolo Carlini + + PR libstdc++/48760 + * include/std/complex (complex::complex(float, float), + complex::complex(double, double), + complex::complex(long double, long double)): Initialize + in the body in C++03 mode (no fix in C++0x mode). + * testsuite/26_numerics/complex/cons/48760.cc: New. + + 2011-04-23 Jonathan Wakely + + PR libstdc++/48521 + * include/std/type_traits (result_of): Handle pointer to member. + * include/std/functional (__invoke): Likewise. + (_Function_to_function_pointer): Remove. + (_Reference_wrapper_base): Provide nested types independent of + unary_function and binary_function. + (reference_wrapper::operator()): DR 2017. + (ref(const A&&), cref(const A&&): Define as deleted. + * include/std/future (async): Simplify SFINAE and use result_of to + support pointer to member. + * testsuite/20_util/reference_wrapper/invoke.cc: Test pointer to + member. + * testsuite/20_util/reference_wrapper/24803.cc: Likewise. + * testsuite/20_util/reference_wrapper/typedefs.cc: Test for types + instead of derivation from unary_function and binary_function. + * testsuite/20_util/reference_wrapper/invoke-2.cc: New. + * testsuite/20_util/reference_wrapper/ref_neg.c: New. + * testsuite/20_util/reference_wrapper/typedefs-3.c: New. + + 2011-04-19 Hans-Peter Nilsson + + PR testsuite/48675 + * testsuite/20_util/hash/chi2_quality.cc (test_document_words): Stub + this part if SAMPLES < 100000. + + 2011-04-17 Daniel Krugler + Paolo Carlini + + PR libstdc++/48635 (again) + * include/bits/unique_ptr.h (unique_ptr<>::unique_ptr(unique_ptr<>&&), + unique_ptr<_Tp[]>::unique_ptr(unique_ptr<>&&), + unique_ptr<>::operator=(unique_ptr<>&&), + unique_ptr<_Tp[]>::operator=(unique_ptr<>&&)): Use forward<_Ep>, not + forward<_Dp>, to forward the deleter. + * testsuite/20_util/unique_ptr/assign/48635_neg.cc: New. + + 2011-04-15 Daniel Krugler + Paolo Carlini + + PR libstdc++/48631 + * include/bits/unique_ptr.h (default_delete<_Tp[]>): Add deleted + function call operator. + * testsuite/20_util/default_delete/48631_neg.cc: New. + * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-error + line numbers. + + 2011-04-15 Daniel Krugler + Paolo Carlini + + PR libstdc++/48635 + * include/bits/unique_ptr.h (unique_ptr<>::operator=(unique_ptr&&), + unique_ptr<>::operator=(unique_ptr<>&&), + unique_ptr<_Tp[],>::operator=(unique_ptr&&), + unique_ptr<_Tp[],>::operator=(unique_ptr<>&&)): Forward the deleter + instead of moving it. + * testsuite/20_util/unique_ptr/assign/48635.cc: New. + + 2011-04-15 Paolo Carlini + + * include/std/istream: Fix comments in the light of DR60 + N3168. + + 2011-04-15 Takaya Saito + + PR libstdc++/48476 + * include/std/tuple (_Tuple_impl<>::_Tuple_impl(_Tuple_impl<>&&), + _Tuple_impl<>::operator=(_Tuple_impl&&), _Tuple_impl<>::operator= + (_Tuple_impl<>&&), tuple_cat): Use std::forward where appropriate. + * testsuite/20_util/tuple/cons/48476.cc: New. + * testsuite/20_util/tuple/48476.cc: Likewise. + * testsuite/20_util/tuple/creation_functions/48476.cc: Likewise. + + 2011-04-12 Allan McRae + + PR libstdc++/48566 + * testsuite/tr1/6_containers/unordered_map/requirements/ + iterator_null_neg.cc: Include . + * testsuite/tr1/6_containers/unordered_set/requirements/ + iterator_null_neg.cc: Likewise. + * testsuite/27_io/basic_filebuf/seekoff/wchar_t/4.cc: Include + . + * testsuite/util/testsuite_common_types.h: Include . + * testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: + Adjust dg-error line numbers. + * testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Likewise. + * testsuite/29_atomics/atomic_integral/operators/increment_neg.cc: + Likewise. + * testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: + Likewise. + * testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc: + Likewise. + * testsuite/29_atomics/atomic/cons/assign_neg.cc: Likewise. + * testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise. + + 2011-04-10 Jonathan Wakely + + * testsuite/20_util/function/48451.cc: Rename to... + * testsuite/20_util/function/48541.cc: This. + + 2011-04-10 Jonathan Wakely + + PR libstdc++/48541 + * include/std/functional (_Base_manager::_M_get_pointer): Use + addressof. + * testsuite/20_util/function/48451.cc: New. + + 2011-04-10 Jonathan Wakely + + PR libstdc++/48465 + * configure.ac (libtool_VERSION): Bump library version to 6:16:0. + * configure: Regenerate. + * config/abi/pre/gnu.ver (GLIBCXX_3.4.16): Export missing symbols. + * testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.16. + + 2011-04-06 Jeffrey Yasskin + + * include/ext/algorithm (is_sorted): In C++0x mode import from + namespace std. + * include/ext/numeric (iota): In C++0x mode import from + namespace std. + * testsuite/ext/is_sorted/cxx0x.cc: New. + * testsuite/ext/iota/cxx0x.cc: New. + + 2011-04-02 Jonathan Wakely + + PR libstdc++/48398 + * include/bits/unique_ptr.h (__tuple_type): Store pointer type. + * testsuite/20_util/unique_ptr/modifiers/48398.cc: New. + * testsuite/20_util/unique_ptr/requirements/pointer_type.cc: Remove + unused parameter name. + + 2011-03-31 Jeffrey Yasskin + + * libsupc++/exception_ptr.h: Forward-declare std::type_info. + * libsupc++/nested_exception.h (__throw_with_nested): Remove a + redundant default argument from std::__throw_with_nested. + + 2011-03-26 Paolo Carlini + + * include/bits/random.h (negative_binomial_distribution<>:: + negative_binomial_distribution(_IntType, double), + negative_binomial_distribution<>:: + negative_binomial_distribution(const param_type&)): Fix thinko + p / (1 - p) for (1 - p) / p. + * include/bits/random.tcc (negative_binomial_distribution<>:: + operator()): Fix. + 2011-03-25 Release Manager * GCC 4.6.0 released. diff -Nrcpad gcc-4.6.0/libstdc++-v3/config/abi/pre/gnu.ver gcc-4.6.1/libstdc++-v3/config/abi/pre/gnu.ver *** gcc-4.6.0/libstdc++-v3/config/abi/pre/gnu.ver Tue Mar 22 15:06:58 2011 --- gcc-4.6.1/libstdc++-v3/config/abi/pre/gnu.ver Thu May 26 00:15:58 2011 *************** GLIBCXX_3.4.15 { *** 1264,1269 **** --- 1264,1284 ---- } GLIBCXX_3.4.14; + GLIBCXX_3.4.16 { + + # libstdc++/48465 + _ZNSs10_S_compareE[jmy][jmy]; + _ZNSbIwSt11char_traitsIwESaIwEE10_S_compareE[jmy][jmy]; + + # basic_streambuf<>::__safe_gbump, __safe_pbump + _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE12__safe_gbumpE*; + _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE12__safe_pbumpE*; + + # basic_stringbuf<>::_M_pbump + _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE8_M_pbumpE*; + + } GLIBCXX_3.4.15; + # Symbols in the support library (libsupc++) have their own tag. CXXABI_1.3 { diff -Nrcpad gcc-4.6.0/libstdc++-v3/configure gcc-4.6.1/libstdc++-v3/configure *** gcc-4.6.0/libstdc++-v3/configure Tue Mar 8 00:04:05 2011 --- gcc-4.6.1/libstdc++-v3/configure Thu May 26 00:15:58 2011 *************** ac_config_headers="$ac_config_headers co *** 2825,2831 **** ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD # For libtool versioning info, format is CURRENT:REVISION:AGE ! libtool_VERSION=6:15:0 # Find the rest of the source tree framework. --- 2825,2831 ---- ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD # For libtool versioning info, format is CURRENT:REVISION:AGE ! libtool_VERSION=6:16:0 # Find the rest of the source tree framework. diff -Nrcpad gcc-4.6.0/libstdc++-v3/configure.ac gcc-4.6.1/libstdc++-v3/configure.ac *** gcc-4.6.0/libstdc++-v3/configure.ac Tue Mar 8 00:04:05 2011 --- gcc-4.6.1/libstdc++-v3/configure.ac Thu May 26 00:15:58 2011 *************** 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:15: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:16:0 AC_SUBST(libtool_VERSION) # Find the rest of the source tree framework. diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/api.html gcc-4.6.1/libstdc++-v3/doc/html/api.html *** gcc-4.6.0/libstdc++-v3/doc/html/api.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/api.html Thu May 5 23:39:58 2011 *************** *** 1,13 **** ! The GNU C++ Library API Reference

--- 1,13 ---- ! The GNU C++ Library API Reference

*************** *** 21,45 ****

The API documentation, rendered into HTML, can be viewed online:

--- 21,45 ----

The API documentation, rendered into HTML, can be viewed online:

*************** *** 47,53 **** gcc.org site in a directory located at <URL:ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/>. You will almost certainly need to use one of the ! mirror sites to download the tarball. After unpacking, simply load libstdc++-html-*/index.html into a browser.

--- 47,53 ---- gcc.org site in a directory located at <URL:ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/>. You will almost certainly need to use one of the ! mirror sites to download the tarball. After unpacking, simply load libstdc++-html-*/index.html into a browser.

diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/bk02.html gcc-4.6.1/libstdc++-v3/doc/html/bk02.html *** gcc-4.6.0/libstdc++-v3/doc/html/bk02.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/bk02.html Thu May 5 23:39:58 2011 *************** *** 1,3 **** ! <meta name="generator" content="DocBook XSL-NS Stylesheets V1.75.2"/><link rel="home" href="spine.html" title="The GNU C++ Library"/><link rel="up" href="spine.html" title="The GNU C++ Library"/><link rel="prev" href="manual/backwards.html" title="Backwards Compatibility"/><link rel="next" href="api.html" title="The GNU C++ Library API Reference"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"/></tr><tr><td align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><th width="60%" align="center"> </th><td align="right"> <a accesskey="n" href="api.html">Next</a></td></tr></table><hr/></div><div class="book"><div class="titlepage"><hr/></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="article"><a href="api.html">The GNU C++ Library API Reference</a></span></dt></dl></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><td align="center"> </td><td align="right"> <a accesskey="n" href="api.html">Next</a></td></tr><tr><td align="left" valign="top">Backwards Compatibility </td><td align="center"><a accesskey="h" href="spine.html">Home</a></td><td align="right" valign="top"> The GNU C++ Library API Reference</td></tr></table></div></body></html> --- 1,3 ---- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> ! <html xmlns="http://www.w3.org/1999/xhtml"><head><title/><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><link rel="home" href="spine.html" title="The GNU C++ Library"/><link rel="up" href="spine.html" title="The GNU C++ Library"/><link rel="prev" href="manual/backwards.html" title="Backwards Compatibility"/><link rel="next" href="api.html" title="The GNU C++ Library API Reference"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"/></tr><tr><td align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><th width="60%" align="center"> </th><td align="right"> <a accesskey="n" href="api.html">Next</a></td></tr></table><hr/></div><div class="book"><div class="titlepage"><hr/></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="article"><a href="api.html">The GNU C++ Library API Reference</a></span></dt></dl></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><td align="center"> </td><td align="right"> <a accesskey="n" href="api.html">Next</a></td></tr><tr><td align="left" valign="top">Backwards Compatibility </td><td align="center"><a accesskey="h" href="spine.html">Home</a></td><td align="right" valign="top"> The GNU C++ Library API Reference</td></tr></table></div></body></html> diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/bk03.html gcc-4.6.1/libstdc++-v3/doc/html/bk03.html *** gcc-4.6.0/libstdc++-v3/doc/html/bk03.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/bk03.html Thu May 5 23:39:58 2011 *************** *** 1,3 **** <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> ! <html xmlns="http://www.w3.org/1999/xhtml"><head><title/><meta name="generator" content="DocBook XSL-NS Stylesheets V1.75.2"/><link rel="home" href="spine.html" title="The GNU C++ Library"/><link rel="up" href="spine.html" title="The GNU C++ Library"/><link rel="prev" href="api.html" title="The GNU C++ Library API Reference"/><link rel="next" href="faq.html" title="Frequently Asked Questions"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"/></tr><tr><td align="left"><a accesskey="p" href="api.html">Prev</a> </td><th width="60%" align="center"> </th><td align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr></table><hr/></div><div class="book"><div class="titlepage"><hr/></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="article"><a href="faq.html">Frequently Asked Questions</a></span></dt></dl></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="api.html">Prev</a> </td><td align="center"> </td><td align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr><tr><td align="left" valign="top">The GNU C++ Library API Reference </td><td align="center"><a accesskey="h" href="spine.html">Home</a></td><td align="right" valign="top"> Frequently Asked Questions</td></tr></table></div></body></html> --- 1,3 ---- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> ! <html xmlns="http://www.w3.org/1999/xhtml"><head><title/><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><link rel="home" href="spine.html" title="The GNU C++ Library"/><link rel="up" href="spine.html" title="The GNU C++ Library"/><link rel="prev" href="api.html" title="The GNU C++ Library API Reference"/><link rel="next" href="faq.html" title="Frequently Asked Questions"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"/></tr><tr><td align="left"><a accesskey="p" href="api.html">Prev</a> </td><th width="60%" align="center"> </th><td align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr></table><hr/></div><div class="book"><div class="titlepage"><hr/></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="article"><a href="faq.html">Frequently Asked Questions</a></span></dt></dl></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="api.html">Prev</a> </td><td align="center"> </td><td align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr><tr><td align="left" valign="top">The GNU C++ Library API Reference </td><td align="center"><a accesskey="h" href="spine.html">Home</a></td><td align="right" valign="top"> Frequently Asked Questions</td></tr></table></div></body></html> diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/faq.html gcc-4.6.1/libstdc++-v3/doc/html/faq.html *** gcc-4.6.0/libstdc++-v3/doc/html/faq.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/faq.html Thu May 5 23:39:58 2011 *************** *** 1,10 **** <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> ! <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Frequently Asked Questions

1.1. What is libstdc++?
1.2. Why should I use libstdc++? --- 1,10 ---- ! Frequently Asked Questions
1.7. What if I have more questions? !

1.1.

What is libstdc++?

The GNU Standard C++ Library v3 is an ongoing project to *************** *** 114,121 **** exactly how far the project has come, or just want the latest bleeding-edge code, the up-to-date source is available over anonymous SVN, and can even be browsed over ! the web. !

1.2.

Why should I use libstdc++?

The completion of the ISO C++ standardization gave the C++ --- 114,121 ---- exactly how far the project has come, or just want the latest bleeding-edge code, the up-to-date source is available over anonymous SVN, and can even be browsed over ! the web. !

1.2.

Why should I use libstdc++?

The completion of the ISO C++ standardization gave the C++ *************** *** 129,137 **** (gcc, g++, etc) is widely considered to be one of the leading compilers in the world. Its development is overseen by the ! GCC team. All of the rapid development and near-legendary ! portability that are the hallmarks of an open-source project are being applied to libstdc++.

--- 129,137 ---- (gcc, g++, etc) is widely considered to be one of the leading compilers in the world. Its development is overseen by the ! GCC team. All of the rapid development and near-legendary ! portability that are the hallmarks of an open-source project are being applied to libstdc++.

*************** *** 141,147 **** vector<>, iostreams, and algorithms.) Programmers will no longer need to “roll their own” nor be worried about platform-specific incompatibilities. !

1.3.

Who's in charge of it?

The libstdc++ project is contributed to by several developers --- 141,147 ---- vector<>, iostreams, and algorithms.) Programmers will no longer need to “roll their own” nor be worried about platform-specific incompatibilities. !

1.3.

Who's in charge of it?

The libstdc++ project is contributed to by several developers *************** *** 153,167 **** Development and discussion is held on the libstdc++ mailing list. Subscribing to the list, or searching the list archives, is open to everyone. You can read instructions for ! doing so on the homepage. If you have questions, ideas, code, or are just curious, sign up! !

1.4.

When is libstdc++ going to be finished?

Nathan Myers gave the best of all possible answers, responding to a Usenet article asking this question: Sooner, if you help. !

1.5.

How do I contribute to the effort?

Here is a page devoted to --- 153,167 ---- Development and discussion is held on the libstdc++ mailing list. Subscribing to the list, or searching the list archives, is open to everyone. You can read instructions for ! doing so on the homepage. If you have questions, ideas, code, or are just curious, sign up! !

1.4.

When is libstdc++ going to be finished?

Nathan Myers gave the best of all possible answers, responding to a Usenet article asking this question: Sooner, if you help. !

1.5.

How do I contribute to the effort?

Here is a page devoted to *************** *** 172,178 **** anybody who is willing to help write documentation, for example, or has found a bug in code that we all thought was working and is willing to provide details, is more than welcome! !

1.6.

What happened to the older libg++? I need that!

The most recent libg++ README states that libg++ is no longer --- 172,178 ---- anybody who is willing to help write documentation, for example, or has found a bug in code that we all thought was working and is willing to provide details, is more than welcome! !

1.6.

What happened to the older libg++? I need that!

The most recent libg++ README states that libg++ is no longer *************** *** 180,186 **** projects, and is only being kicked along to support older code.

More information in the backwards compatibility documentation !

1.7.

What if I have more questions?

If you have read the README file, and your question remains --- 180,186 ---- projects, and is only being kicked along to support older code.

More information in the backwards compatibility documentation !

1.7.

What if I have more questions?

If you have read the README file, and your question remains *************** *** 201,217 **** How is that different from the GNU {Lesser,Library} GPL?

2.4. I see. So, what restrictions are there on programs that use the library? !

2.1.

What are the license terms for libstdc++?

See our license description for these and related questions. !

2.2.

So any program which uses libstdc++ falls under the GPL?

No. The special exception permits use of the library in proprietary applications. !

2.3.

How is that different from the GNU {Lesser,Library} GPL?

The LGPL requires that users be able to replace the LGPL code with a --- 201,217 ---- How is that different from the GNU {Lesser,Library} GPL?

2.4. I see. So, what restrictions are there on programs that use the library? !

2.1.

What are the license terms for libstdc++?

See our license description for these and related questions. !

2.2.

So any program which uses libstdc++ falls under the GPL?

No. The special exception permits use of the library in proprietary applications. !

2.3.

How is that different from the GNU {Lesser,Library} GPL?

The LGPL requires that users be able to replace the LGPL code with a *************** *** 221,227 **** are expanded inside the code that uses the library. So to allow people to replace the library code, someone using the library would have to distribute their own source, rendering the LGPL equivalent to the GPL. !

2.4.

I see. So, what restrictions are there on programs that use the library?

None. We encourage such programs to be released as open source, --- 221,227 ---- are expanded inside the code that uses the library. So to allow people to replace the library code, someone using the library would have to distribute their own source, rendering the LGPL equivalent to the GPL. !

2.4.

I see. So, what restrictions are there on programs that use the library?

None. We encourage such programs to be released as open source, *************** *** 234,240 **** What's libsupc++?

3.6. This library is HUGE! !

3.1.

How do I install libstdc++?

Often libstdc++ comes pre-installed as an integral part of many existing Linux and Unix systems, as well as many embedded --- 234,240 ---- What's libsupc++?

3.6. This library is HUGE! !

3.1.

How do I install libstdc++?

Often libstdc++ comes pre-installed as an integral part of many existing Linux and Unix systems, as well as many embedded *************** *** 247,257 **** documentation for detailed instructions. You may wish to browse those files ahead of time to get a feel for what's required. !

3.2.

How does one get current libstdc++ sources?

Libstdc++ sources for all official releases can be obtained as part of the GCC sources, available from various sites and ! mirrors. A full list of download sites is provided on the main GCC site.

Current libstdc++ sources can always be checked out of the main --- 247,257 ---- documentation for detailed instructions. You may wish to browse those files ahead of time to get a feel for what's required. !

3.2.

How does one get current libstdc++ sources?

Libstdc++ sources for all official releases can be obtained as part of the GCC sources, available from various sites and ! mirrors. A full list of download sites is provided on the main GCC site.

Current libstdc++ sources can always be checked out of the main *************** *** 262,268 **** Subversion, or SVN, is one of several revision control packages. It was selected for GNU projects because it's free (speech), free (beer), and very high ! quality. The Subversion home page has a better description.

The “anonymous client checkout” feature of SVN is --- 262,268 ---- Subversion, or SVN, is one of several revision control packages. It was selected for GNU projects because it's free (speech), free (beer), and very high ! quality. The Subversion home page has a better description.

The “anonymous client checkout” feature of SVN is *************** *** 270,289 **** the latest libstdc++ sources.

For more information ! see SVN details. !

3.3.

How do I know if it works?

Libstdc++ comes with its own validation testsuite, which includes conformance testing, regression testing, ABI testing, and performance testing. Please consult the ! testing documentation for more details.

If you find bugs in the testsuite programs themselves, or if you think of a new test program that should be added to the suite, please write up your idea and send it to the list! !

3.4.

How do I insure that the dynamically linked library will be found?

Depending on your platform and library version, the error message might be similar to one of the following: --- 270,289 ---- the latest libstdc++ sources.

For more information ! see SVN details. !

3.3.

How do I know if it works?

Libstdc++ comes with its own validation testsuite, which includes conformance testing, regression testing, ABI testing, and performance testing. Please consult the ! testing documentation for more details.

If you find bugs in the testsuite programs themselves, or if you think of a new test program that should be added to the suite, please write up your idea and send it to the list! !

3.4.

How do I insure that the dynamically linked library will be found?

Depending on your platform and library version, the error message might be similar to one of the following: *************** *** 318,324 ****

Using LD_LIBRARY_PATH is not always the best solution, Finding Dynamic or Shared Libraries in the manual gives some alternatives. !

3.5.

What's libsupc++?

If the only functions from libstdc++.a --- 318,324 ----

Using LD_LIBRARY_PATH is not always the best solution, Finding Dynamic or Shared Libraries in the manual gives some alternatives. !

3.5.

What's libsupc++?

If the only functions from libstdc++.a *************** *** 335,341 **** using anything from the rest of the library, such as IOStreams or vectors, then you'll still need pieces from libstdc++.a. !

3.6.

This library is HUGE!

Usually the size of libraries on disk isn't noticeable. When a --- 335,341 ---- using anything from the rest of the library, such as IOStreams or vectors, then you'll still need pieces from libstdc++.a. !

3.6.

This library is HUGE!

Usually the size of libraries on disk isn't noticeable. When a *************** *** 382,388 **** Recent GNU/Linux glibc required?

4.8. Can't use wchar_t/wstring on FreeBSD !

4.1.

Can libstdc++ be used with non-GNU compilers?

Perhaps. --- 382,388 ---- Recent GNU/Linux glibc required?

4.8. Can't use wchar_t/wstring on FreeBSD !

4.1.

Can libstdc++ be used with non-GNU compilers?

Perhaps. *************** *** 402,408 **** been known to work with versions of the EDG C++ compiler, and vendor-specific proprietary C++ compilers such as the Intel ICC C++ compiler. !

4.2.

No 'long long' type on Solaris?

By default we try to support the C99 long long type. --- 402,408 ---- been known to work with versions of the EDG C++ compiler, and vendor-specific proprietary C++ compilers such as the Intel ICC C++ compiler. !

4.2.

No 'long long' type on Solaris?

By default we try to support the C99 long long type. *************** *** 414,420 **** commonly reported platform affected was Solaris.

This has been fixed for libstdc++ releases greater than 3.0.3. !

4.3.

_XOPEN_SOURCE and _GNU_SOURCE are always defined?

On Solaris, g++ (but not gcc) always defines the preprocessor macro _XOPEN_SOURCE. On GNU/Linux, the same happens --- 414,420 ---- commonly reported platform affected was Solaris.

This has been fixed for libstdc++ releases greater than 3.0.3. !

4.3.

_XOPEN_SOURCE and _GNU_SOURCE are always defined?

On Solaris, g++ (but not gcc) always defines the preprocessor macro _XOPEN_SOURCE. On GNU/Linux, the same happens *************** *** 440,455 **** g++ -E -dM - < /dev/null" to display a list of predefined macros for any particular installation.

This has been discussed on the mailing lists ! quite a bit.

This method is something of a wart. We'd like to find a cleaner solution, but nobody yet has contributed the time. !

4.4.

Mac OS X ctype.h is broken! How can I fix it?

This is a long-standing bug in the OS X support. Fortunately, the patch is quite simple, and well-known. ! Here's a link to the solution. !

4.5.

Threading is broken on i386?

Support for atomic integer operations is/was broken on i386 --- 440,455 ---- g++ -E -dM - < /dev/null" to display a list of predefined macros for any particular installation.

This has been discussed on the mailing lists ! quite a bit.

This method is something of a wart. We'd like to find a cleaner solution, but nobody yet has contributed the time. !

4.4.

Mac OS X ctype.h is broken! How can I fix it?

This is a long-standing bug in the OS X support. Fortunately, the patch is quite simple, and well-known. ! Here's a link to the solution. !

4.5.

Threading is broken on i386?

Support for atomic integer operations is/was broken on i386 *************** *** 459,465 **** on an i686, then you would encounter no problems. Only when actually running the code on a i386 will the problem appear.

This is fixed in 3.2.2. !

4.6.

MIPS atomic operations

The atomic locking routines for MIPS targets requires MIPS II --- 459,465 ---- on an i686, then you would encounter no problems. Only when actually running the code on a i386 will the problem appear.

This is fixed in 3.2.2. !

4.6.

MIPS atomic operations

The atomic locking routines for MIPS targets requires MIPS II *************** *** 469,475 ****

The mips*-*-linux* port continues to use the MIPS II routines, and more work in this area is expected. !

4.7.

Recent GNU/Linux glibc required?

When running on GNU/Linux, libstdc++ 3.2.1 (shared library version 5.0.1) and later uses localization and formatting code from the system --- 469,475 ----

The mips*-*-linux* port continues to use the MIPS II routines, and more work in this area is expected. !

4.7.

Recent GNU/Linux glibc required?

When running on GNU/Linux, libstdc++ 3.2.1 (shared library version 5.0.1) and later uses localization and formatting code from the system *************** *** 480,486 ****

The guideline is simple: the more recent the C++ library, the more recent the C library. (This is also documented in the main GCC installation instructions.) !

4.8.

Can't use wchar_t/wstring on FreeBSD

Older versions of FreeBSD's C library do not have sufficient --- 480,486 ----

The guideline is simple: the more recent the C++ library, the more recent the C library. (This is also documented in the main GCC installation instructions.) !

4.8.

Can't use wchar_t/wstring on FreeBSD

Older versions of FreeBSD's C library do not have sufficient *************** *** 499,505 **** Bugs in the ISO C++ language or library specification

5.3. Bugs in the compiler (gcc/g++) and not libstdc++ !

5.1.

What works already?

Short answer: Pretty much everything works --- 499,505 ---- Bugs in the ISO C++ language or library specification

5.3. Bugs in the compiler (gcc/g++) and not libstdc++ !

5.1.

What works already?

Short answer: Pretty much everything works *************** *** 513,519 **** C++98, TR1, and C++0x. !

5.2.

Bugs in the ISO C++ language or library specification

Unfortunately, there are some. --- 513,519 ---- C++98, TR1, and C++0x. !

5.2.

Bugs in the ISO C++ language or library specification

Unfortunately, there are some. *************** *** 521,534 **** For those people who are not part of the ISO Library Group (i.e., nearly all of us needing to read this page in the first place), a public list of the library defects is occasionally ! published here. Some of these issues have resulted in code changes in libstdc++.

If you think you've discovered a new bug that is not listed, please post a message describing your problem to or the Usenet group comp.lang.c++.moderated. !

5.3.

Bugs in the compiler (gcc/g++) and not libstdc++

On occasion, the compiler is wrong. Please be advised that this --- 521,534 ---- For those people who are not part of the ISO Library Group (i.e., nearly all of us needing to read this page in the first place), a public list of the library defects is occasionally ! published here. Some of these issues have resulted in code changes in libstdc++.

If you think you've discovered a new bug that is not listed, please post a message describing your problem to or the Usenet group comp.lang.c++.moderated. !

5.3.

Bugs in the compiler (gcc/g++) and not libstdc++

On occasion, the compiler is wrong. Please be advised that this *************** *** 541,547 **** these lists with terms describing your issue.

Before reporting a bug, please examine the ! bugs database with the category set to “g++”.

6.1. Reopening a stream fails --- 541,547 ---- these lists with terms describing your issue.

Before reporting a bug, please examine the ! bugs database with the category set to “g++”.

6.1. Reopening a stream fails *************** *** 563,569 **** list::size() is O(n)!
6.9. Aw, that's easy to fix! !

6.1.

Reopening a stream fails

One of the most-reported non-bug reports. Executing a sequence like: --- 563,569 ---- list::size() is O(n)!

6.9. Aw, that's easy to fix! !

6.1.

Reopening a stream fails

One of the most-reported non-bug reports. Executing a sequence like: *************** *** 590,596 **** Update: for GCC 4.0 we implemented the resolution of DR #409 and open() now calls clear() on success! !

6.2.

-Weffc++ complains too much

Many warnings are emitted when -Weffc++ is used. Making --- 590,596 ---- Update: for GCC 4.0 we implemented the resolution of DR #409 and open() now calls clear() on success! !

6.2.

-Weffc++ complains too much

Many warnings are emitted when -Weffc++ is used. Making *************** *** 602,608 **** We do, however, try to have libstdc++ sources as clean as possible. If you see some simple changes that pacify -Weffc++ without other drawbacks, send us a patch. !

6.3.

Ambiguous overloads after including an old-style header

Another problem is the rel_ops namespace and the template --- 602,608 ---- We do, however, try to have libstdc++ sources as clean as possible. If you see some simple changes that pacify -Weffc++ without other drawbacks, send us a patch. !

6.3.

Ambiguous overloads after including an old-style header

Another problem is the rel_ops namespace and the template *************** *** 611,620 **** (e.g., “using” them and the <iterator> header), then you will suddenly be faced with huge numbers of ambiguity errors. This was discussed on the -v3 list; Nathan Myers ! sums things up here. The collisions with vector/string iterator types have been fixed for 3.1. !

6.4.

The g++-3 headers are not ours

If you are using headers in --- 611,620 ---- (e.g., “using” them and the <iterator> header), then you will suddenly be faced with huge numbers of ambiguity errors. This was discussed on the -v3 list; Nathan Myers ! sums things up here. The collisions with vector/string iterator types have been fixed for 3.1. !

6.4.

The g++-3 headers are not ours

If you are using headers in *************** *** 630,636 **** 'v'?). Starting with version 3.2 the headers are installed in ${prefix}/include/c++/${version} as this prevents headers from previous versions being found by mistake. !

6.5.

Errors about *Concept and constraints in the STL

--- 630,636 ---- 'v'?). Starting with version 3.2 the headers are installed in ${prefix}/include/c++/${version} as this prevents headers from previous versions being found by mistake. !

6.5.

Errors about *Concept and constraints in the STL

*************** *** 647,653 **** checks, is available in the Diagnostics. chapter of the manual. !

6.6.

Program crashes when using library code in a dynamically-loaded library

--- 647,653 ---- checks, is available in the Diagnostics. chapter of the manual. !

6.6.

Program crashes when using library code in a dynamically-loaded library

*************** *** 666,677 ****
    // link the executable
    g++ -fPIC -rdynamic -o foo ... -L. -lfoo -ldl
!     

6.7.

“Memory leaks” in containers

A few people have reported that the standard containers appear to leak memory when tested with memory checkers such as ! valgrind. The library's default allocators keep free memory in a pool for later reuse, rather than returning it to the OS. Although this memory is always reachable by the library and is never --- 666,677 ----
    // link the executable
    g++ -fPIC -rdynamic -o foo ... -L. -lfoo -ldl
!     

6.7.

“Memory leaks” in containers

A few people have reported that the standard containers appear to leak memory when tested with memory checkers such as ! valgrind. The library's default allocators keep free memory in a pool for later reuse, rather than returning it to the OS. Although this memory is always reachable by the library and is never *************** *** 679,696 **** want to test the library for memory leaks please read Tips for memory leak hunting first. !

6.8.

list::size() is O(n)!

See the Containers chapter. !

6.9.

Aw, that's easy to fix!

If you have found a bug in the library and you think you have a working fix, then send it in! The main GCC site has a page ! on submitting patches that covers the procedure, but for libstdc++ you should also send the patch to our mailing list in addition to the GCC patches mailing list. The libstdc++ --- 679,696 ---- want to test the library for memory leaks please read Tips for memory leak hunting first. !

6.8.

list::size() is O(n)!

See the Containers chapter. !

6.9.

Aw, that's easy to fix!

If you have found a bug in the library and you think you have a working fix, then send it in! The main GCC site has a page ! on submitting patches that covers the procedure, but for libstdc++ you should also send the patch to our mailing list in addition to the GCC patches mailing list. The libstdc++ *************** *** 718,724 **** What's an ABI and why is it so messy?

7.8. How do I make std::vector<T>::capacity() == std::vector<T>::size? !

7.1.

string::iterator is not char*; vector<T>::iterator is not T*

If you have code that depends on container<T> iterators --- 718,724 ---- What's an ABI and why is it so messy?

7.8. How do I make std::vector<T>::capacity() == std::vector<T>::size? !

7.1.

string::iterator is not char*; vector<T>::iterator is not T*

If you have code that depends on container<T> iterators *************** *** 737,743 **** certain expressions to &*i. Future revisions of the Standard are expected to bless this usage for vector<> (but not for basic_string<>). !

7.2.

What's next after libstdc++?

Hopefully, not much. The goal of libstdc++ is to produce a --- 737,743 ---- certain expressions to &*i. Future revisions of the Standard are expected to bless this usage for vector<> (but not for basic_string<>). !

7.2.

What's next after libstdc++?

Hopefully, not much. The goal of libstdc++ is to produce a *************** *** 748,759 **** There is an effort underway to add significant extensions to the standard library specification. The latest version of this effort is described in ! The C++ Library Technical Report 1. !

7.3.

What about the STL from SGI?

! The STL from SGI, version 3.3, was the final merge of the STL codebase. The code in libstdc++ contains many fixes and changes, and the SGI code is no longer under active --- 748,759 ---- There is an effort underway to add significant extensions to the standard library specification. The latest version of this effort is described in ! The C++ Library Technical Report 1. !

7.3.

What about the STL from SGI?

! The STL from SGI, version 3.3, was the final merge of the STL codebase. The code in libstdc++ contains many fixes and changes, and the SGI code is no longer under active *************** *** 773,795 ****

The FAQ for SGI's STL (one jump off of their main page) is still recommended reading. !

7.4.

Extensions and Backward Compatibility

See the link on backwards compatibility and link on evolution. !

7.5.

Does libstdc++ support TR1?

Yes.

The C++ Standard Library Technical Report adds many new features to the library. The latest version of this effort is described in ! Technical Report 1.

The implementation status of TR1 in libstdc++ can be tracked on the TR1 status page. !

7.6.

How do I get a copy of the ISO C++ Standard?

Copies of the full ISO 14882 standard are available on line via the ISO mirror site for committee members. Non-members, or those --- 773,795 ----

The FAQ for SGI's STL (one jump off of their main page) is still recommended reading. !

7.4.

Extensions and Backward Compatibility

See the link on backwards compatibility and link on evolution. !

7.5.

Does libstdc++ support TR1?

Yes.

The C++ Standard Library Technical Report adds many new features to the library. The latest version of this effort is described in ! Technical Report 1.

The implementation status of TR1 in libstdc++ can be tracked on the TR1 status page. !

7.6.

How do I get a copy of the ISO C++ Standard?

Copies of the full ISO 14882 standard are available on line via the ISO mirror site for committee members. Non-members, or those *************** *** 798,814 **** get a copy of the standard from their respective national standards organization. In the USA, this national standards organization is ANSI and their website is ! right here. (And if you've already registered with them, clicking this link will take you to directly to the place where you can ! buy the standard on-line.

Who is your country's member body? Visit the ! ISO homepage and find out!

The 2003 version of the standard (the 1998 version plus TC1) is available in print, ISBN 0-470-84674-7. !

7.7.

What's an ABI and why is it so messy?

ABI stands for “Application Binary --- 798,814 ---- get a copy of the standard from their respective national standards organization. In the USA, this national standards organization is ANSI and their website is ! right here. (And if you've already registered with them, clicking this link will take you to directly to the place where you can ! buy the standard on-line.

Who is your country's member body? Visit the ! ISO homepage and find out!

The 2003 version of the standard (the 1998 version plus TC1) is available in print, ISBN 0-470-84674-7. !

7.7.

What's an ABI and why is it so messy?

ABI stands for “Application Binary *************** *** 856,862 **** so they may later be changed. Deciding which, and implementing the decisions, must happen before you can reasonably document a candidate C++ ABI that encompasses the standard library. !

7.8.

How do I make std::vector<T>::capacity() == std::vector<T>::size?

The standard idiom for deallocating a vector<T>'s --- 856,862 ---- so they may later be changed. Deciding which, and implementing the decisions, must happen before you can reasonably document a candidate C++ ABI that encompasses the standard library. !

7.8.

How do I make std::vector<T>::capacity() == std::vector<T>::size?

The standard idiom for deallocating a vector<T>'s diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/manual/abi.html gcc-4.6.1/libstdc++-v3/doc/html/manual/abi.html *** gcc-4.6.0/libstdc++-v3/doc/html/manual/abi.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/manual/abi.html Thu May 5 23:39:58 2011 *************** *** 1,6 **** ! ABI Policy and Guidelines

--- 1,6 ---- ! ABI Policy and Guidelines

*************** *** 21,27 **** virtual functions, etc. These details are defined as the compiler Application Binary Interface, or ABI. The GNU C++ compiler uses an industry-standard C++ ABI starting with version 3. Details can be ! found in the ABI specification.

The GNU C++ compiler, g++, has a compiler command line option to --- 21,27 ---- virtual functions, etc. These details are defined as the compiler Application Binary Interface, or ABI. The GNU C++ compiler uses an industry-standard C++ ABI starting with version 3. Details can be ! found in the ABI specification.

The GNU C++ compiler, g++, has a compiler command line option to *************** *** 30,36 **** g++ command line options may change the ABI as a side-effect of use. Such flags include -fpack-struct and -fno-exceptions, but include others: see the complete ! list in the GCC manual under the heading Options for Code Generation Conventions.

The configure options used when building a specific libstdc++ --- 30,36 ---- g++ command line options may change the ABI as a side-effect of use. Such flags include -fpack-struct and -fno-exceptions, but include others: see the complete ! list in the GCC manual under the heading Options for Code Generation Conventions.

The configure options used when building a specific libstdc++ *************** compatible. *** 115,121 **** Note 2: Not strictly required.

Note 3: This release (but not previous or subsequent) has one ! known incompatibility, see 33678 in the GCC bug database.

  • Symbol versioning on the libstdc++.so binary.

    mapfile: libstdc++-v3/config/abi/pre/gnu.ver

    It is versioned with the following labels and version definitions, where the version definition is the maximum for a --- 115,121 ---- Note 2: Not strictly required.

    Note 3: This release (but not previous or subsequent) has one ! known incompatibility, see 33678 in the GCC bug database.

  • Symbol versioning on the libstdc++.so binary.

    mapfile: libstdc++-v3/config/abi/pre/gnu.ver

    It is versioned with the following labels and version definitions, where the version definition is the maximum for a *************** class that would otherwise have implicit *** 289,295 **** the way the compiler deals with this class in by-value return statements or parameters: instead of passing instances of this class in registers, the compiler will be forced to use memory. See the ! section on Function Calling Conventions and APIs of the C++ ABI documentation for further details.

  • . Binary Compatibility of Shared Libraries Implemented in C++ on GNU/Linux Systems diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/manual/algorithms.html gcc-4.6.1/libstdc++-v3/doc/html/manual/algorithms.html *** gcc-4.6.0/libstdc++-v3/doc/html/manual/algorithms.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/manual/algorithms.html Thu May 5 23:39:58 2011 *************** *** 1,14 **** ! Chapter 11.  Algorithms

    The neatest accomplishment of the algorithms sect1 is that all the work is done via iterators, not containers directly. This means two important things: --- 1,14 ---- ! Chapter 11.  Algorithms

    The neatest accomplishment of the algorithms sect1 is that all the work is done via iterators, not containers directly. This means two important things: diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/manual/api.html gcc-4.6.1/libstdc++-v3/doc/html/manual/api.html *** gcc-4.6.0/libstdc++-v3/doc/html/manual/api.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/manual/api.html Thu May 5 23:39:58 2011 *************** *** 1,6 **** ! API Evolution and Deprecation History

    --- 1,6 ---- ! API Evolution and Deprecation History

    *************** _Alloc_traits have been removed. *** 75,85 **** __alloc to select an underlying allocator that satisfied memory allocation requests. The selection of this underlying allocator was not user-configurable. !


    Releases after gcc-3.4 have continued to add to the collection of available allocators. All of these new allocators are standard-style. The following table includes details, along with the first released version of GCC that included the extension allocator. !


    Debug mode first appears.

    Precompiled header support PCH support. --- 75,85 ---- __alloc to select an underlying allocator that satisfied memory allocation requests. The selection of this underlying allocator was not user-configurable. !


    Releases after gcc-3.4 have continued to add to the collection of available allocators. All of these new allocators are standard-style. The following table includes details, along with the first released version of GCC that included the extension allocator. !


    Debug mode first appears.

    Precompiled header support PCH support. diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/manual/appendix_contributing.html gcc-4.6.1/libstdc++-v3/doc/html/manual/appendix_contributing.html *** gcc-4.6.0/libstdc++-v3/doc/html/manual/appendix_contributing.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/manual/appendix_contributing.html Thu May 5 23:39:58 2011 *************** *** 1,14 **** ! Appendix A.  Contributing

    The GNU C++ Library follows an open development model. Active contributors are assigned maintainer-ship responsibility, and given write access to the source repository. First time contributors --- 1,14 ---- ! Appendix A.  Contributing

    The GNU C++ Library follows an open development model. Active contributors are assigned maintainer-ship responsibility, and given write access to the source repository. First time contributors *************** *** 23,44 **** the standard from their respective national standards organization. In the USA, this national standards organization is ANSI and their web-site is right ! here. (And if you've already registered with them, clicking this link will take you to directly to the place where you can ! buy the standard on-line.)

  • The library working group bugs, and known defects, can be obtained here: ! http://www.open-std.org/jtc1/sc22/wg21

  • The newsgroup dedicated to standardization issues is comp.std.c++: this FAQ for this group is quite useful and can be ! found here .

  • Peruse ! the GNU Coding Standards, and chuckle when you hit the part about “Using Languages Other Than C”.

  • --- 23,44 ---- the standard from their respective national standards organization. In the USA, this national standards organization is ANSI and their web-site is right ! here. (And if you've already registered with them, clicking this link will take you to directly to the place where you can ! buy the standard on-line.)

  • The library working group bugs, and known defects, can be obtained here: ! http://www.open-std.org/jtc1/sc22/wg21

  • The newsgroup dedicated to standardization issues is comp.std.c++: this FAQ for this group is quite useful and can be ! found here .

  • Peruse ! the GNU Coding Standards, and chuckle when you hit the part about “Using Languages Other Than C”.

  • *************** *** 67,73 **** this question would be appreciated.

    For more information about getting a copyright assignment, please see ! Legal Matters.

    Please contact Benjamin Kosnik at --- 67,73 ---- this question would be appreciated.

    For more information about getting a copyright assignment, please see ! Legal Matters.

    Please contact Benjamin Kosnik at *************** *** 77,83 **** , please cc the libstdc++ maintainer above so that progress can be monitored.

  • Every patch must have several pieces of information before it can be *************** *** 104,110 **** else, use diff -cp OLD NEW ... If your version of diff does not support these options, then get the latest version of GNU ! diff. The SVN Tricks wiki page has information on customising the output of svn diff.

  • --- 104,110 ---- else, use diff -cp OLD NEW ... If your version of diff does not support these options, then get the latest version of GNU ! diff. The SVN Tricks wiki page has information on customising the output of svn diff.

  • diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/manual/appendix_free.html gcc-4.6.1/libstdc++-v3/doc/html/manual/appendix_free.html *** gcc-4.6.0/libstdc++-v3/doc/html/manual/appendix_free.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/manual/appendix_free.html Thu May 5 23:39:58 2011 *************** *** 1,13 **** ! Appendix C.  Free Software Needs Free Documentation

    The biggest deficiency in free operating systems is not in the software--it is the lack of good free manuals that we can include in --- 1,13 ---- ! Appendix C.  Free Software Needs Free Documentation

    The biggest deficiency in free operating systems is not in the software--it is the lack of good free manuals that we can include in *************** can ill afford to lose manuals this way. *** 41,47 **** Free documentation, like free software, is a matter of freedom, not price. The problem with these manuals was not that O'Reilly Associates charged a price for printed copies--that in itself is fine. ! (The Free Software Foundation sells printed copies of free GNU manuals, too.) But GNU manuals are available in source code form, while these manuals are available only on paper. GNU manuals come with permission to copy and modify; the Perl manuals do not. --- 41,47 ---- Free documentation, like free software, is a matter of freedom, not price. The problem with these manuals was not that O'Reilly Associates charged a price for printed copies--that in itself is fine. ! (The Free Software Foundation sells printed copies of free GNU manuals, too.) But GNU manuals are available in source code form, while these manuals are available only on paper. GNU manuals come with permission to copy and modify; the Perl manuals do not. *************** manuals instead of proprietary ones. On *** 117,123 **** check the distribution terms of a manual before you buy it, and prefer copylefted manuals to non-copylefted ones.

    ! [Note: We now maintain a web page that lists free books available from other publishers].

    Copyright © 2004, 2005, 2006, 2007 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

    Verbatim copying and distribution of this entire article are permitted worldwide, without royalty, in any medium, provided this --- 117,123 ---- check the distribution terms of a manual before you buy it, and prefer copylefted manuals to non-copylefted ones.

    ! [Note: We now maintain a web page that lists free books available from other publishers].

    Copyright © 2004, 2005, 2006, 2007 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

    Verbatim copying and distribution of this entire article are permitted worldwide, without royalty, in any medium, provided this diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/manual/appendix_gfdl.html gcc-4.6.1/libstdc++-v3/doc/html/manual/appendix_gfdl.html *** gcc-4.6.0/libstdc++-v3/doc/html/manual/appendix_gfdl.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/manual/appendix_gfdl.html Thu May 5 23:39:58 2011 *************** *** 1,10 **** ! Appendix E. GNU Free Documentation License

    Version 1.3, 3 November 2008

    Copyright © 2000, 2001, 2002, 2007, 2008 ! Free Software Foundation, Inc.

    Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. --- 1,10 ---- ! Appendix E. GNU Free Documentation License

    Version 1.3, 3 November 2008

    Copyright © 2000, 2001, 2002, 2007, 2008 ! Free Software Foundation, Inc.

    Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. *************** *** 377,383 **** Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See ! Copyleft.

    Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License --- 377,383 ---- Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See ! Copyleft.

    Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License diff -Nrcpad gcc-4.6.0/libstdc++-v3/doc/html/manual/appendix_gpl.html gcc-4.6.1/libstdc++-v3/doc/html/manual/appendix_gpl.html *** gcc-4.6.0/libstdc++-v3/doc/html/manual/appendix_gpl.html Thu Feb 10 00:54:53 2011 --- gcc-4.6.1/libstdc++-v3/doc/html/manual/appendix_gpl.html Thu May 5 23:39:58 2011 *************** *** 1,6 **** ! Appendix D.  GNU General Public License version 3