2007-05-31 Paolo Carlini PR c++/32158 * semantics.c (finish_trait_expr): Complete the types. 2007-05-30 Russell Yanofsky Douglas Gregor Pedro Lamarao Howard Hinnant PR c++/7412 PR c++/29939 * typeck.c (comptypes): Don't consider rvalue and lvalue reference types to be equivalent. (check_return_expr): Move from certain lvalues when returning them. * decl.c (grokdeclarator): Implement reference collapsing. (copy_fn_p): Don't consider constructors taking rvalue references to be copy constructors. (move_fn_p): New. * call.c (conversion): New "rvaluedness_matches_p" member. (convert_class_to_reference): Require reference type as first parameter instead of base type. (reference_binding): Add logic to handle rvalue references. (implicit_conversion): Update inaccurate comment. (convert_like_real): Disable creation of temporaries that are impossible to initialize for types with move constructors. (build_over_call): Elide move constructors when possible. (maybe_handle_implicit_object): Set "rvaluedness_matches_p". (maybe_handle_ref_bind): Return conversion instead of type node. (compare_ics): Add logic to use "rvaluedness_matches_p" values to determine preferred conversion sequences. * cp-tree.h (TYPE_REF_IS_RVALUE): New. (LOOKUP_PREFER_RVALUE): New. (DECL_MOVE_CONSTRUCTOR_P): New. (struct cp_declarator): Add "reference" member for reference types, with new "rvalue_ref" flag. (cp_build_reference_type): Declare. (move_fn_p): Declare. * error.c (dump_type_prefix): Format rvalue reference types correctly in error messages. * except.c (build_throw): Move from certain lvalues when throwing. * mangle.c (write_type): Mangle rvalue references differently than regular references. * parser.c (make_reference_declarator): Add boolean parameter for rvalue references. (cp_parser_make_indirect_declarator): New. (cp_parser_new_declarator_opt): Call cp_parser_make_indirect_declarator. (cp_parser_conversion_declarator_opt): Ditto. (cp_parser_declarator): Ditto. (cp_parser_ptr_operator): Parse "&&" tokens into rvalue reference declarators. * pt.c (tsubst): Implement reference collapsing. (maybe_adjust_types_for_deduction): Implement special template parameter deduction rule for rvalue references. (type_unification_real): Update calls to maybe_adjust_types_for_deduction. (try_one_overload): Ditto. (unify_pack_expansion): Ditto. * tree.c (lvalue_p_1): Handle rvalue reference types. (cp_build_reference_type): New. 2007-05-30 Jakub Jelinek PR c++/31809 * decl.c (cp_finish_decl): Clear TREE_READONLY flag on TREE_STATIC variables that need runtime initialization. 2007-05-28 Andrew Pinski PR c++/31339 * typeck.c (build_unary_op ): Return the error_mark_node if either the real or imaginary parts would an error_mark_node. 2007-05-25 Simon Martin Manuel Lopez-Ibanez PR c++/31745 * parser.c (cp_parser_skip_to_closing_brace): Return true if the next token is a closing brace, false if there are no tokens left. (cp_parser_namespace_alias_definition): Only consume the next token if it is a closing brace. * parser.c (cp_parser_class_specifier): Likewise. 2007-05-25 H.J. Lu * semantics.c (finish_member_declaration): Fix a typo in the last checkin. 2007-05-25 Douglas Gregor PR c++/31431 PR c++/31432 PR c++/31434 PR c++/31435 PR c++/31437 PR c++/31438 PR c++/31442 PR c++/31443 PR c++/31444 PR c++/31445 * error.c (dump_type): Dump TYPE_ARGUMENT_PACK nodes. * cp-tree.h (check_for_bare_parameter_packs): Returns bool. * pt.c (check_for_bare_parameter_packs): Return bool indicated whether everything was okay. Fix indentation. (push_template_decl_real): Check for bare parameter packs in function parameters; where errors occur, mark the parameter types with ERROR_MARK_NODEs to avert ICEs. (coerce_template_parameter_pack): New. (coerce_template_parms): Moved parameter pack coercion into coerce_template_parameter_pack, and permit it anywhere in the template parameter list (not just at the end). Parameter and argument indices can vary (somewhat) separately now, so add PARM_IDX and ARG_IDX. (fn_type_unification): Don't set an argument pack as incomplete if no argument pack was deduced. (type_unification_real): If a type parameter is a parameter pack and has not otherwise been deduced, it will be deduced to an empty parameter pack. (more_specialized_fn): Use the actual lengths of the argument lists when comparing against expansions. * semantics.c (finish_member_declaration): If a field's type has bare parameter packs, error and set its type to ERROR_MARK_NODE. 2007-05-24 Danny Smith PR target/27067 * mangle.c (mangle_decl): Call targetm.mangle_decl_assembler_name. 2007-05-22 Ollie Wild * name-lookup.c (ambiguous_decl): Adds check for hidden types. (unqualified_namespace_lookup): Adds check for hidden types. 2007-05-22 Ollie Wild * decl.c (duplicate_decls): Verify namespace names are unique. 2007-05-21 Mark Mitchell * decl.c (cxx_maybe_build_cleanup): Handle __attribute__((cleanup)). 2007-05-19 Manuel Lopez-Ibanez * cvt.c (cp_convert_and_check): Don't check warnings if the conversion failed. 2007-05-18 Geoffrey Keating * mangle.c (write_real_cst): Use 'unsigned long' for %lx. 2007-05-14 Paolo Carlini PR c++/29928 * rtti.c (get_tinfo_decl_dynamic, get_typeid): Try to complete the type only if is a class type (5.2.8/4). 2007-05-14 Rafael Avila de Espindola * cp-objcp-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. * decl.c (grokdeclarator): Use unsigned_type_for instead of c_common_unsigned_type. 2007-05-11 Silvius Rus * cp/typeck.c (build_indirect_ref): Add call to strict_aliasing_warning. (build_reinterpret_cast_1): Condition call to strict_aliasing_warning. 2007-05-11 Jan Hubicka * semantics.c (expand_or_defer_fn): Do not call c_record_cdtor_fn. * decl2.c (start_objects): ctors and dtors are no longer public. (cp_write_global_declarations): Do not call c_build_cdtor_fns. 2007-05-07 Andrew Pinski * typeck.c (build_unary_op): Remove code that used to handle non lvalue increments/decrements. 2007-05-07 Mike Stump * parser.c (check_empty_body): Add. (cp_parser_iteration_statement): Add call to check_empty_body. 2007-05-05 Geoffrey Keating PR 31775 * mangle.c (write_mangled_name): Mangle static variable names. (write_unqualified_name): Use local-source-name for namespace-scope static variables. 2007-05-04 Dirk Mueller * cp-tree.h (DECL_MAIN_P): only if -ffreestanding is not in effect. 2007-05-02 Seongbae Park PR c++/31663 * decl2.c (constrain_class_visibility): Use strip_pointer_or_array_types instead of strip_array_types. 2007-04-28 Andrew Pinski PR C++/30221 * decl.c (reshape_init_r): Don't reshape the first element if it is a pointer to member function. 2007-04-27 Simon Baldwin * decl.c (grokparms): Changed message format from %qD to %qE. 2007-04-27 Douglas Gregor * error.c (maybe_warn_variadic_templates): Variadic templates are now in C++0x, so only warn about them in C++98 mode. 2007-04-26 Andrew Pinski PR C++/30016 * typeck.c (build_reinterpret_cast_1): Only allow conversion to integeral types from vectors types. 2007-04-26 Jakub Jelinek PR c++/31598 * semantics.c (finish_omp_clauses): Don't create CP_OMP_CLAUSE_INFO for type dependent OMP_CLAUSE_DECLs. 2007-04-24 Mark Mitchell PR c++/31338 * cp-tree.h (ARITHMETIC_TYPE): Include COMPLEX_TYPE. * typeck.c (type_after_usual_arithmetic_conversions): Adjust, as COMPLEX_TYPE is now an ARITHMETIC_TYPE. * init.c (build_zero_init): Adjust, as COMPLEX_TYPE is now a SCALAR_TYPE. * typeck2.c (digest_init): Allow brace-enclosed initializers for COMPLEX_TYPE, even though that is now a SCALAR_TYPE. 2007-04-25 Paolo Carlini * semantics.c (classtype_has_nothrow_copy_or_assign_p): Adjust per N2255; rename as classtype_has_nothrow_assign_or_copy_p. (trait_expr_value): Adjust. 2007-04-23 Simon Baldwin * decl.c (grokparms): Added new error for duplicate function parameters names in function prototypes, to match gcc behavior. 2007-04-23 Jan Hubicka * cp/decl2.c (finish_objects): Do not call target constructor/destructor bits dirrectly. 2007-04-21 Andrew Pinski * cp-tree.h (lang_tree_node): Use GENERIC_NEXT instead of checking GIMPLE_STMT_P in chain_next. 2007-04-17 Mark Mitchell PR c++/31513 * call.c (convert_for_arg_passing): Convert bitfields to their declared types. 2007-04-17 Simon Martin PR c++/31517 * pt.c (value_dependent_expression_p): Handle MODOP_EXPRs. 2007-04-16 Seongbae Park PR c++/29365 * cp/decl2.c (constrain_class_visibility): Do not warn about the use of anonymous namespace in the main input file. 2007-04-15 Mark Mitchell * cp-tree.h (current_template_parms): Fix typo in comment. 2007-04-15 Kazu Hirata * cp-tree.h, error.c: Fix comment typos. 2007-04-13 Jason Merrill PR c++/31074 * call.c (reference_binding): Add c_cast_p parm. If true, add quals to TO as needed to make it reference-compatible. 2007-04-11 Jan Hubicka * cp/class.c (convert_to_base_statically): Fold produced tree; verify that we are not processing template_decl. 2007-04-09 Mark Mitchell PR c++/31449 * class.c (build_base_path): Ensure that the converted pointer has the same cv-qualification as the input. 2007-04-09 Paolo Carlini * tree.c (cp_tree_equal): Deal with TRAIT_EXPR. 2007-04-08 Steven Bosscher * cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS): Do not set it. (LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P): Do not set it. * tree.c (cp_add_pending_fn_decls): Remove. * cp-tree.h (cp_add_pending_fn_decls): Remove prototype. 2007-04-07 Daniel Berlin Revert change removing staticp. 2007-04-06 Daniel Berlin * cp-objcp-common.c (cxx_staticp): Remove. * cp-objcp-common.h (LANG_HOOKS_STATICP): Remove. * cp-tree.h (cxx_staticp): 2007-04-04 Danny Smith * class.c (check_for_override): Don't remove dllmport attribute of virtual methods. 2007-04-03 Jakub Jelinek PR c++/30847 * typeck.c (build_modify_expr): For COND_EXPR on LHS, if RHS has void type issue error and return early. 2007-03-30 Jason Merrill PR c++/31187 * typeck.c (cp_type_readonly): New fn. * cp-tree.h: Declare it. * decl.c (start_decl): Set implicit DECL_THIS_STATIC here. (cp_finish_decl): Not here. 2007-03-31 Richard Guenther * optimize.c (maybe_clone_body): Replace splay-tree usage by pointer-map. 2007-03-31 Douglas Gregor PR c++/31138 PR c++/31140 PR c++/31141 * parser.c (declarator_can_be_parameter_pack): New. (cp_parser_template_parameter): Only parse the `...' if the declarator can be a parameter pack. (cp_parser_parameter_declaration): Ditto. Also, handle when TYPE is NULL. * pt.c (find_parameter_packs_r): Look into the bounds on integer types (they could be used as array bounds). (check_for_bare_parameter_packs): Deal with TEMPLATE_PARM_INDEX. (tsubst_pack_expansion): Handle failure to expand parameter packs. 2007-03-30 Paolo Carlini PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. 2007-03-29 Richard Guenther * tree.c (cp_walk_subtrees): Do not set input_location. 2007-03-28 Simon Martin PR c++/29077 * decl.c (grokfndecl): Properly setup decl if it is a constructor or a destructor. 2007-03-28 Douglas Gregor * parser.c (struct cp_parser): Update comment for greater_than_is_operator_p. (cp_parser_primary_expression): In C++0x mode, a cast operator can be terminated with a `>>' token when !GREATER_THAN_IS_OPERATOR_P. (TOKEN_PRECEDENCE): In C++0x mode, `>>' is treated like `>' when !GREATER_THAN_IS_OPERATOR_P. (cp_parser_binary_expression): When -Wc++0x-compat, warn about `>>' operators that will become two `>' tokens in C++0x. (cp_parser_parameter_declaration): Treat `>>' like `>' in C++0x mode, allowing it to terminate default arguments. (cp_parser_enclosed_template_argument_list): In C++0x mode, treat `>>' like two consecutive `>' tokens. (cp_parser_skip_to_end_of_template_parameter_list): Ditto. (cp_parser_next_token_ends_template_argument_p): In C++0x, `>>' ends a template argument. 2007-03-28 Douglas Gregor * decl.c (redeclaration_error_message): Complain when redeclaring a friend function with default template arguments (C++0x mode only). * cp-tree.h (check_default_tmpl_args): Declare. * pt.c (check_default_tmpl_args): In C++0x mode, permit default template arguments in function templates. Add support for checking the default template arguments of friend templates. (push_template_decl_real): Fix call to check_default_tmpl_args. (type_unification_real): If a template parameter has not been deduced but provides a default template argument, substitute into that default template argument. * parser.c (cp_parser_init_declarator): When declaring (but not defining!) a function template in C++0x mode, check for default template arguments. 2007-03-28 Douglas Gregor PR c++/29993 * decl.c (grokdeclarator): Deal with cv-qualified function type typedefs in the same way for member and non-member functions. 2007-03-26 Dirk Mueller * parser.c (cp_parser_member_declaration): Pedwarn about stray semicolons after member declarations. 2007-03-26 Paolo Carlini PR c++/30500 * pt.c (instantiate_decl): Set in_system_header. 2007-03-22 Mark Mitchell * cp-tree.h (current_tempalte_parms): Improve documentation. * pt.c (current_template_args): Likewise. PR c++/30863 * parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Do not consume tokens when failing. 2007-03-22 Jim Wilson Mark Mitchell PR c++/31273 * call.c (standard_conversion): Use type_decays_to. Keep FCODE consistent with FROM. 2007-03-22 Gabriel Dos Reis * error.c (dump_expr): Handle dependent names that designate types. * cxx-pretty-print.c (pp_cxx_unqualified_id): Handle TYPENAME_TYPE. 2007-03-17 Kazu Hirata * cp-tree.def, parser.c, pt.c: Fix comment typos. 2007-03-16 Manuel Lopez-Ibanez * cvt.c (cp_convert_and_check) : Define. * cp-tree.h (cp_convert_and_check): Declare. * call.c (convert_conversion_warnings): Rename to conversion_null_warnings. The warning for floating-point to integer is handled by convert_and_check in convert_like_real. (convert_like_real): convert_conversion_warnings was renamed as conversion_null_warnings. * typeck.c (build_binary_op): Use cp_convert_and_check to warn for overflow and changes of value during conversion. 2007-03-15 Manuel Lopez-Ibanez PR c++/30891 * parser.c (cp_parser_statement): If 'namespace' is found, this only can be a namespace alias definition, so parse it now. (cp_parser_namespace_alias_definition): if we find an open brace instead of '=', then this is actually a misplaced namespace definition. 2007-03-15 Manuel Lopez-Ibanez PR c++/24924 * decl.c (cxx_init_decl_processing): Move command-line options processing to c-opts.c. 2007-03-15 Douglas Gregor * ptree.c (cxx_print_type): Use formatting markup for integers when printing template parameter index/level/orig level. (cxx_print_xnode): Ditto. * cp-tree.h (TEMPLATE_PARM_PARAMETER_PACK): Use TREE_LANG_FLAG_0. (struct template_parm_index_s): Remove the PARAMETER_PACK member. Make INDEX, LEVEL, and ORIG_LEVEL integers instead of HOST_WIDE_INTs. (struct saved_scope): Make X_PROCESSING_TEMPLATE_DECL an int, rather than a HOST_WIDE_INT. Turn X_PROCESSING_EXPLICIT_INSTANTIATION, SKIP_EVALUATION, and NEED_POP_FUNCTION_CONTEXT into bool bitfields; reorder fields for better bit-packing. (struct language_function): Make RETURNS_VALUE, RETURNS_NULL, RETURNS_ABNORMALLY, IN_FUNCTION_TRY_HANDLER, and IN_BASE_INITIALIZER bool bitfields. (struct cp_declarator): Make KIND a 4-bit field. Make PARAMETER_PACK_P a bool bitfield just after KIND. * pt.c (uses_parameter_packs): Destroy the pointer set. (make_pack_expansion): Ditto. (check_for_bare_parameter_packs): Ditto. * name-lookup.c (push_to_top_level): Make need_pop a bool value. 2007-03-14 Andrew Pinski PR c++/31165 * call.c (convert_default_arg): Instead of copying the node, unshare it. 2007-03-15 Dirk Mueller PR c++/30860 * call.c (convert_conversion_warnings): New.. (convert_like_real): .. factored out from here. (convert_conversion_warnings): Add warning about false being converted to NULL in argument passing. 2007-03-14 Dirk Mueller * cp/semantics.c (c_finish_if_stmt): Call empty_if_body_warning. (finish_do_body): Warn about empty body in do/while statement. 2007-03-14 Manuel Lopez-Ibanez * class.c (warn_hidden): Add OPT_Woverloaded_virtual to warning. 2007-03-14 Manuel Lopez-Ibanez PR c/21438 * typeck.c (build_binary_op): Call warn_for_div_zero instead of warning. 2007-03-13 Alexandre Oliva * cp/repo.c (init_repo): Initialize random_seed saved options. (finish_repo): Adjust. 2007-03-13 Mark Mitchell PR bootstrap/30899 * Make-lang.in (doc/g++.1): Use $< to specify the location from which to copy. 2007-03-12 Seongbae Park * decl.c (compute_array_index_type): New warning flag warn_vla. 2007-03-12 Mark Mitchell PR c++/30108 * call.c (convert_default_arg): Copy non-constant arguments. 2007-03-11 Mark Mitchell PR c++/31038 * parser.c (cp_parser_postfix_expression): Disallow compound literals in constant expressions. PR c++/30328 * semantics.c (finish_typeof): Use unlowered_expr_type. 2007-03-10 Mark Mitchell PR c++/30274 * cp-tree.h (unlowered_expr_type): New function. * typeck.c (is_bitfield_expr_with_lowered_type): Handle COMPOUND_EXPR, MODIFY_EXPR, and SAVE_EXPR. (unlowered_expr_type): New function. (build_unary_op): Disallow predecrements of bool bitfields. * call.c (build_conditional_expr): Use unlowered_expr_type. * pt.c (type_unification_real): Likewise. 2007-03-09 Douglas Gregor PR c++/20599 * typeck.c (check_return_expr): Check for bare parameter packs. (comptypes): Compare template parameter packs and type pack expansions. * decl.c (grokdeclarator): Deal with the declaration of function parameter packs. (grokparms): Verify that the (optional) function parameter pack is at the end of the parameter list. (xref_basetypes): Handle pack expansions in the base class. (cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT. * cp-tree.def (TYPE_ARGUMENT_PACK): New. (NONTYPE_ARGUMENT_PACK): New. (TYPE_PACK_EXPANSION): New. (EXPR_PACK_EXPANSION): New. (ARGUMENT_PACK_SELECT): New. * cp-objcp-common.c (cp_tree_size): Compute size of (NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and ARGUMENT_PACK_SELECT. * error.c (dump_template_argument): Print template argument packs. (dump_template_argument_list): Ditto. (dump_template_parameter): Dump `...' for template type parameter packs. (dump_type): Dump TYPE_PACK_EXPANSION nodes. (dump_parameters): Print function parameter packs. (dump_template_parms): Print template argument packs. (dump_expr): Dump EXPR_PACK_EXPANSION nodes. (maybe_warn_variadic_templates): New. * operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. * mangle.c (write_type): Mangle TYPE_PACK_EXPANSION. (write_template_arg): Write argument packs as separate arguments. * cp-tree.h (struct template_parm_index_s): Add flag that indicates that the template parameter is actually a parameter pack. (struct tree_argument_pack_select): New. (enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT. (union lang_tree_node): Add argument_pack_select. (FUNCTION_PARAMETER_PACK_P): New. (PACK_EXPANSION_P): New. (PACK_EXPANSION_PATTERN): New. (SET_PACK_EXPANSION_PATTERN): New. (PACK_EXPANSION_PARAMETER_PACKS): New. (ARGUMENT_PACK_P): New. (ARGUMENT_PACK_ARGS): New. (SET_ARGUMENT_PACK_ARGS): New. (ARGUMENT_PACK_INCOMPLETE_P): New. (ARGUMENT_PACK_EXPLICIT_ARGS): New. (TEMPLATE_PARM_PARAMETER_PACK): New. (TEMPLATE_TYPE_PARAMETER_PACK): New. (ARGUMENT_PACK_SELECT_FROM_PACK): New. (ARGUMENT_PACK_SELECT_INDEX): New. (ARGUMENT_PACK_SELECT_ARG): New. (struct cp_declarator): Add parameter_pack_p flag. (maybe_warn_variadic_templates): Declare. (process_template_parm): Add bool parameter IS_PARAMETER_PACK, to indicate a template parameter pack. (uses_parameter_packs): Declare. (template_parameter_pack_p): Declare. (template_parms_variadic_p): Declare. (make_pack_expansion): Declare. (check_for_bare_parameter_packs): Declare. * cxx-pretty-print.c (pp_cxx_unary_expression): Print sizeof... expressions. (pp_cxx_expression): Print pack expansions and non-type argument packs. (pp_cxx_exception_specification): Print pack expansions. (pp_cxx_direct_declarator): Print ellipsis for parameter packs. (pp_cxx_ctor_initializer): Print pack expansions. (pp_cxx_type_id): Print pack expansions. (pp_cxx_template_argument_list): Print argument packs. (pp_cxx_template_parameter): Print ellipsis for template parameter packs. * pt.c (comp_template_parms): Compare template parameter packs. (template_parameter_pack_p): New. (template_parms_variadic_p): New. (template_args_variadic_p): New. (make_ith_pack_parameter_name): New. (struct find_parameter_pack_data): New. (find_parameter_packs_r): New. (uses_parameter_packs): New. (make_pack_expansion): New. (check_for_bare_parameter_packs): New. (expand_template_argument_pack): New. (reduce_template_parm_level): Propagate parameter pack flag. (process_template_parm): Add is_parameter_pack parameter to state when the parameter is actually a parameter pack. Create template parameter packs when is_parameter_pack is true. (current_template_args): The argument for a template parameter pack is an argument pack containing a single pack expansion. (process_partial_specialization): When checking that non-type argument expressions do not involve template parameters, loop over the arguments in argument packs separately. (push_template_decl_real): Check that the type of the declaration does not have any bare parameter packs. Check that primary templates have no more than one parameter pack, and that it comes at the end of the template parameter list. (convert_template_argument): Handle coercions for pack expansion expressions by coercing the pattern then rebuilding the expansion. (coerce_template_parms): When coercing the arguments for a variadic template, pack "extra" arguments into an argument pack. (coerce_template_template_parms): Cannot coerce between parameter packs and non-pack parameters. (template_args_equal): Compare PACK_EXPANSION_P expressions. (comp_template_args): Expand all template arguments packs before comparing template argument lists. (mangle_class_name_for_template): Make argument packs as separate template arguments. (for_each_template_parm_r): No need to handle BASELINK. (instantiate_class_template): Handle pack expansions in the base class list. (tsubst_pack_expansion): New. (tsubst_template_args): Handle substitutions of argument packs and pack expansion into template argument lists. (tsubst_decl): Expand function parameter packs into separate function parameters. (tsubst_arg_types): Expand a type pack expansion into separate argument types. (tsubst_exception_specification): Handle pack expansions in exception specifiers. (tsubst): See through ARGUMENT_PACK_SELECT arguments when replacing a template parameter with its argument. If we encounter a substitution for an argument pack, just return the parameter itself. (tsubst_copy): sizeof(X...) returns the number of elements in parameter pack X. See through ARGUMENT_PACK_SELECT when the PARM_DECL is a parameter pack. (tsubst_expr): Expression pack expansions and argument packs cannot show up here; they will all be handled through function calls, sizeof, and template argument lists. (tsubst_copy_and_build): sizeof(X...) returns the number of elements in parameter pack X. Handle pack expansions in TREE_LIST and CONSTRUCTOR nodes. (fn_type_unification): Handle "incomplete" explicit template argument lists that specify some of the arguments for a template parameter pack. (type_unification_real): Unify arguments against pack expansions. (template_parm_level_and_index): New, helper function. (unify_pack_expansion): New. (unify): Unify argument packs on an argument-by-argument basis, handling variadic argument packs as well. (more_specialized_fn): Handle unification of function parameter packs. All things being equal, prefer non-variadic function templates to variadic function templates. (more_specialized_class): Prefer the variadic class template partial specialization that binds fewer arguments to a parameter pack. (regenerate_decl_from_template): Expand function parameter packs into separate parameters. (instantiate_decl): Ditto. (tsubst_initializer_list): Handle pack expansions for base-class initializers. (dependent_type_p_r): Determine dependent types in argument packs and pack expansions. (value_dependent_expression_p): Determine value-dependence of non-type argument packs. (dependent_template_arg_p): Handle argument packs. * semantics.c (finish_cond): Check for bare parameter packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. * name-lookup.c (arg_assoc_type): Handle pack expansions and argument packs. * decl2.c (cp_build_parm_decl): Mark function parameter packs. * parser.c (make_declarator): Declarator is not an expansion. (make_pointer_declarator): Transfer parameter pack flag to outer declarator. (make_reference_declarator): Ditto. (make_ptrmem_declarator): Ditto. (make_call_declarator): Ditto. (make_array_declarator): Ditto. (cp_parser_postfix_expression): Allow pack expansion expressions in the argument list for a call expression. (cp_parser_parenthesized_expression_list): Add new parameter ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand into separate arguments." (cp_parser_new_placement): Allow pack expansion expressions. (cp_parser_new_initializer): Ditto. (cp_parser_mem_initializer_list): Allow ellipsis to create a base-class initializer expansion. (cp_parser_mem_initializer): Ditto. (cp_parser_template_parameter_list): Keep track of whether the template parameter is a template parameter pack. (cp_parser_template_parameter): Parse the ellipsis to indicate a template parameter pack. (cp_parser_type_parameter): Ditto. (cp_parser_template_argument_list): Parse the ellipsis to indicate a pack expansion. (cp_parser_direct_declarator): Parse the ellipsis to indicate that this declarator is a parameter pack. (cp_parser_parameter_declaration): The ellipsis does not end the parameter declaration, because it might be a parameter pack. Parse the ellipsis to indicate a parameter pack. (cp_parser_initializer): Allow pack expansions. (cp_parser_initializer_list): Allow ellipsis to create an initializer expansion. (cp_parser_base_clause): Allow ellipsis to create a base specifier expansion. (cp_parser_type_id_list): Allow ellipsis to create an exception specifier expansion. (cp_parser_attribute_list): Don't allow pack expansions. (cp_parser_functional_cast): Allow pack expansions. (cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to compute the length of a parameter pack. (cp_parser_next_token_ends_template_argument_p): An ellipsis can end a template argument. * tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK, NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION, CAST_EXPR. 2007-03-09 Dirk Mueller * cp/call.c (build_new_op): Call warn_logical_operator. 2007-03-08 Volker Reichelt PR c++/30852 * semantics.c (finish_offsetof): Handle COMPOUND_EXPR. PR c++/30534 * pt.c (any_template_arguments_need_structural_equality_p): Robustify. 2007-03-08 Alexandre Oliva * decl.c (grokdeclarator): Disable warnings for anonymous bitfields. 2007-03-05 Volker Reichelt * typeck2.c (readonly_error): Always emit a hard error. Remove last argument. * cp-tree.h (readonly_error): Adjust prototype. * semantics.c (finish_asm_stmt): Adjust call to readonly_error. * typeck.c (build_unary_op): Likewise. (build_modify_expr): Likewise. 2007-03-04 Simon Martin PR c++/30895 * tree.c (cp_tree_equal): Properly handle COMPLEX_CST trees. 2007-03-03 Manuel Lopez-Ibanez PR c++/15787 * parser.c (struct cp_parser): New IN_IF_STMT. (cp_parser_statement_seq_opt): Handle an unexpected 'else', returning if parsing the body of an 'if' statement or issuing an error and continuing. (cp_parser_selection_statement): Set IN_IF_STMT bit when parsing body of 'if'. (cp_parser_jump_statement): Mask new IN_IF_STMT bit. 2007-03-02 Simon Martin PR c++/28253 * class.c (update_vtable_entry_for_fn): Properly handle invalid overriders for thunks. 2007-03-02 Geoffrey Keating * g++spec.c (lang_specific_driver): Add -lstdc++ when compiling Objective-C++. Don't exit early if -shared-libgcc needs to be added. 2007-03-02 Manuel Lopez-Ibanez * typeck.c (common_base_type): Delete unused function. 2007-03-01 Brooks Moses * Make-lang.in: Add dummy lang.install-pdf target. 2007-03-01 Simon Baldwin PR c++/23689 * decl.c (check_tag_decl): Added new warning for typedef ignored when it precedes an otherwise valid non-typedef declaration. 2007-02-28 Sandra Loosemore * typeck.c (build_function_call): Store converted arguments in a stack-allocated array instead of building a list. (convert_arguments): Store arguments in the array passed in as an argument, and return the actual number of arguments. * call.c (build_call): Delete, and replace with... (build_call_n, build_call_a): New. (build_op_delete_call): Rewrite to avoid constructing argument lists. (build_over_call): Store converted arguments in a stack-allocated array instead of building a list. (build_cxx_call): Pass arguments in an array instead of as a list. (build_java_interface_fn_ref): Rewrite to avoid constructing argument lists. * tree.h: Update declarations to reflect above changes. * method.c (use_thunk): Use a stack-allocated array to hold the arguments instead of a list. * rtti.c (throw_bad_cast): Update call to cxx_call. (throw_bad_typeid): Likewise. (build_dynamic_cast_1): Likewise. * init.c (build_builtin_delete_call): Use build_call_n. * decl.c (expand_static_init): Likewise. * except.c (cp_protect_cleanup_actions): Likewise. * cp-gimplify.c (genericize_eh_spec_block): Likewise. (gimplify_must_not_throw_expr): Likewise. (cxx_omp_apply_fn): Use build_call_a. 2007-02-26 Mark Mitchell * semantics.c (expand_or_defer_fn): Call c_record_cdtor_fn. * decl2.c (cp_write_gloabl_declarations): Call c_build_cdtor_fns. 2007-02-25 Mark Mitchell * cp-tree.h (static_ctors): Remove. * cp-tree.h (static_dtors): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_lookup): Adjust for refactoring of tree_map hierarchy. (decl_shadowed_for_var_insert): Likewise. * semantics.c (expand_body): Use c_expand_body. (expand_or_defer_fn): Don't update static_ctors or static_dtors. * decl2.c (static_ctors): Remove. (static_dtors): Likewise. (generate_ctor_or_dtor_function): Pass NULL_TREE to objc_generate_static_init_call. Do not call static_[cd]tors. (generate_ctor_and_dtor_functions_for_priority): Do not check for static_[cd]tors. (cp_write_global_declarations): Likewise. 2007-02-23 Richard Guenther * class.c (note_name_declared_in_class): Make declaration changes meaning a pedwarn. 2007-02-22 Michael Matz PR c++/29433 * cp-tree.h (TFF_UNQUALIFIED_NAME): New formatting flag. * error.c (dump_aggr_type, dump_simple_decl, dump_decl, dump_function_decl): Guard emitting outer scopes by new flag. * cp-lang.c (cxx_dwarf_name): New function. (LANG_HOOKS_DWARF_NAME): Define to cxx_dwarf_name. * pt.c (classtype_mangled_name, mangle_class_name_for_template): Remove functions. (push_template_decl_real, lookup_template_class): Remove calls to above functions. 2007-02-19 Mark Mitchell * call.c (build_new_method_call): Ensure that explicit calls of destructors have type "void". 2007-02-19 Manuel Lopez-Ibanez * typeck.c (build_binary_op): Replace -Wstring-literal-comparison and -Walways-true with -Waddress. * cvt.c (convert_to_void): Replace unconditional warning with -Waddress. 2007-02-18 Kazu Hirata * decl.c, tree.c: Fix comment typos. 2007-02-15 Andrew Pinski PR C++/30158 * semantics.c (finish_stmt_expr_expr): Set TREE_TYPE of the statement expression if we had an error mark node. 2007-02-15 Sandra Loosemore Brooks Moses Lee Millward * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) : Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) : Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) : Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) : Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) : Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) : Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) : Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) : Use build_nt_call_list instead of build_min_nt. 2007-02-15 Manuel Lopez-Ibanez PR c++/28943 * call.c (build_conditional_expr): Improve error message. 2007-02-13 Dirk Mueller * friend.c (do_friend): Annotate warning about friend declarations in templates with OPT_Wnon_template_friend. Convert informal message from warning() to inform(). 2007-02-12 Simon Martin Mark Mitchell PR c++/14622 * pt.c (do_decl_instantiation): Detect type mismatches in explicit instantiations for variables. 2007-02-12 Manuel Lopez-Ibanez PR middle-end/7651 * cp-gimplify.c (gimplify_expr_stmt): Don't check extra_warnings. Check warn_unused_value just once. 2007-02-11 Mark Mitchell PR c++/26988 * pt.c (determine_specialization): Use skip_artificial_parms_for. (fn_type_unificiation): Likewise. (get_bindings): Likewise. o2007-02-06 Mark Mitchell PR target/29487 * decl.c (finish_function): Use DECL_REPLACEABLE. * tree.c (cp_cannot_inline_tree_fn): Likewise. 2007-02-10 Gabriel Dos Reis * parser.c (cp_parser_primary_expression): Reformat overly long lines. 2007-02-10 Richard Henderson , Jakub Jelinek * decl.c (grokvardecl): Don't error if !have_tls. (grokdeclarator): Likewise. * parser.c (cp_parser_omp_threadprivate): Likewise. 2007-02-07 Jakub Jelinek PR c++/30703 * cp-gimplify.c (cp_genericize_r): Don't dereference invisiref parameters and result decls in omp clauses. (cxx_omp_privatize_by_reference): Pass also invisiref PARM_DECLs by reference. 2007-02-05 Dirk Mueller PR bootstrap/30510 * parser.c (cp_parser_class_specifier): Always initialize bases. 2007-02-05 Paolo Bonzini * cp-tree.h (OMP_ATOMIC_CODE): Delete. (OMP_ATOMIC_DEPENDENT_P): Rewrite. * pt.c (tsubst_expr): Adjust for new format of dependent OMP_ATOMIC expressions. * semantics.c (finish_omp_atomic): Store a whole expression node in operand 1, and integer_zero_node in operand 0, for dependent OMP_ATOMIC. Rewrite to make flow easier to understand. 2007-02-03 Gabriel Dos Reis * decl.c (grokdeclarator): Use OPT_Wreturn_type instead of 0. 2007-02-04 Kazu Hirata * class.c, cp-tree.h, decl.c, decl2.c, g++spec.c, init.c, parser.c, pt.c, tree.c, typeck.c: Follow spelling conventions. 2007-02-03 Douglas Gregor * parser.c (cp_lexer_get_preprocessor_token): Attach the C++0x keyword warning to -Wc++0x-compat. 2007-02-03 Gabriel Dos Reis * decl.c (grokdeclarator): Update documentation. 2007-02-02 Jakub Jelinek PR c++/30536 * decl.c (grokdeclarator): If __thread is used together with a storage class other than extern and static, clear thread_p after issuing diagnostics and fall through to checking the storage class. 2007-01-30 Roger Sayle * error.c (dump_type_suffix): Avoid use of cp_build_binary_op when calculating the size of an array (to avoid recursive errors). 2007-01-30 Manuel Lopez-Ibanez PR c++/24745 * typeck.c (build_binary_op): Fix logic for warning. Move warning to -Wpointer-arith. * call.c (convert_like_real): Don't warn when converting to boolean type. 2007-01-29 Manuel Lopez-Ibanez * decl.c (pop_label): Replace warning with call to warn_for_unused_label. 2007-01-28 Andrew Pinski PR C++/28988 * semantics.c (finish_pseudo_destructor_expr): Check the destrutor name by calling check_dtor_name. 2007-01-24 Douglas Gregor * lex.c (D_CPP0X): Rename. (D_CXX0X): To this. (reswords): D_CPP0X -> D_CXX0X. (init_reswords): Ditto. * parser.c (cp_lexer_get_preprocessor_token): Warn about the use of C++0x keywords as identifiers. 2007-01-23 Simon Martin PR c++/27492 * decl.c (duplicate_decls): Don't reset DECL_INVALID_OVERRIDER_P for function decls. 2007-01-23 Ian Lance Taylor * typeck.c (convert_for_assignment): Only warn about a = b = c when converting to bool. 2007-01-23 Roger Sayle * call.c (null_ptr_cst_p): Replace use of TREE_CONSTANT_OVERFLOW with TREE_OVERFLOW. * typeck.c (ignore_overflows): Remove the remaining uses of TREE_CONSTANT_OVERFLOW. 2007-01-20 Jan Hubicka * decl2.c (start_objects, start_static_storage_duration_function): Do not make the functions uninlinable. 2007-01-17 Ian Lance Taylor * class.c (add_method): Call VEC_reserve_exact rather than passing a negative size to VEC_reserve. 2007-01-11 Simon Martin PR c++/29573 * tree.c (cp_tree_equal): Properly handle MODOP_EXPR trees. 2007-01-10 Mark Mitchell PR c++/28999 * decl.c (make_typename_type): If the qualified name is not a type, issue an error. * parser.c (cp_parser_elaborated_type_specifier): Fix comment formatting. 2007-01-08 Geoffrey Keating * rtti.c: Include target.h. (emit_support_tinfos): If ! targetm.cxx.library_rtti_comdat (), don't emit typeinfo for fundamental types as weak. * Make-lang.in (cp/rtti.o): Update and correct dependencies. 2007-01-08 Richard Guenther * cvt.c (cp_convert_to_pointer): Use build_int_cst_type. 2007-01-08 Mark Shinwell * call.c (standard_conversion): Pass flag to vector_types_convertible_p to disallow emission of note. * typeck.c (convert_for_assignment): Pass flag to vector_types_convertible_p to allow emission of note. (ptr_reasonably_similar): Pass flag to vector_types_convertible_p to disallow emission of note. 2007-01-07 Manuel Lopez-Ibanez PR c++/28986 * typeck.c (build_binary_op): Call overflow_warning if TREE_OVERFLOW_P is true for the result and not for any of the operands. 2007-01-06 Lee Millward PR c++/19439 * class.c (add_method): Don't wait until template instantiation time to complain about duplicate methods. 2007-01-05 Manuel Lopez-Ibanez PR c/19978 * semantics.c (finish_unary_op_expr): Warn only if result overflowed and operands did not. 2007-01-05 Ian Lance Taylor * typeck.c (build_binary_op): Warn about comparing a non-weak address to NULL. 2007-01-05 Douglas Gregor * pt.c (tsubst): Propagate the need for structural equality checks when reducing the level of template parameters. 2007-01-03 Kazu Hirata * pt.c: Fix a comment typo. 2007-01-02 Ian Lance Taylor * semantics.c (maybe_convert_cond): Optionally warn when using an assignment as a condition. * typeck.c (convert_for_assignment): Optionally warn about assigning the result of an assignment to a bool. 2007-01-02 Douglas Gregor * pt.c (canonical_template_parms): Correct typo in comment. 2007-01-02 Douglas Gregor * typeck.c (structural_comptypes): Renamed from "comptypes". (comptypes): Use canonical type information to perform fast type comparison. When VERIFY_CANONICAL_TYPES, verify that the canonical type comparison returns the same results as we would see from the current, structural check. Support COMPARE_STRUCTURAL when we need structural checks. * decl.c (typename_compare): Fix comment. (build_typename_type): TYPENAME_TYPE nodes require structural equality checks, because they resolve different based on the current class type. (make_unbound_class_template): UNBOUND_CLASS_TEMPLATE nodes require structural equality checks (for now). (build_ptrmemfunc_type): Build the canonical pointer to member function type. (compute_array_index_type): Whenever we build a new index type to represent the size of an array in a template, we need to mark this index type as requiring structural equality. This goes for arrays with value-dependent sizes with the current ABI, or all arrays with ABI-1. * tree.c (cplus_array_hash): New. (struct cplus_array_info): New. (cplus_array_compare): New. (cplus_array_htab): New. (build_cplus_array_type_1): Use a hash table to cache the array types we build. Build the canonical array type for each array type. (cp_build_qualified_type_real): When building a cv-qualified array type, use the hash table of array types and build canonical array types as necessary. (bind_template_template_parm): BOUND_TEMPLATE_TEMPLATE_PARM nodes use structural equality (for now). * cp-tree.h (COMPARE_STRUCTURAL): New. * pt.c (canonical_template_parms): New. (canonical_type_parameter): New. (process_template_parm): Find the canonical type parameter. (lookup_template_class): When we have named the primary template type, set the canonical type for our template class to the primary template type. If any of the template arguments need structural equality checks, the template class needs structural equality checks. (tsubst): When reducing the level of a template template parameter, we require structural equality tests for the resulting parameter because its template parameters have not had their types canonicalized. When reducing a template type parameter, find the canonical reduced type parameter. (any_template_arguments_need_structural_equality_p): New.