aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
AgeCommit message (Collapse)AuthorFilesLines
2007-04-11class.c (convert_to_base_statically): Fold produced tree; verify that we are ↵Jan Hubicka2-4/+15
not processing template_decl. * cp/class.c (convert_to_base_statically): Fold produced tree; verify that we are not processing template_decl. From-SVN: r123711
2007-04-09re PR c++/31449 ([4.1] static_cast can remove const-ness)Mark Mitchell2-1/+18
PR c++/31449 * class.c (build_base_path): Ensure that the converted pointer has the same cv-qualification as the input. PR c++/31449 * g++.dg/init/const5.C: New test. From-SVN: r123679
2007-04-09tree.c (cp_tree_equal): Deal with TRAIT_EXPR.Paolo Carlini2-0/+10
2007-04-09 Paolo Carlini <pcarlini@suse.de> * tree.c (cp_tree_equal): Deal with TRAIT_EXPR. From-SVN: r123673
2007-04-08langhooks.c (lhd_tree_inlining_add_pending_fn_decls, [...]): Remove.Steven Bosscher4-26/+8
* langhooks.c (lhd_tree_inlining_add_pending_fn_decls, lhd_tree_inlining_anon_aggr_type_p, lhd_tree_inlining_start_inlining, lhd_tree_inlining_end_inlining): Remove. * langhooks.h (struct lang_hooks_for_tree_inlining): Remove then add_pending_fn_decls, anon_aggr_type_p, start_inlining, and end_inlining hooks. * langhooks-def.h (lhd_tree_inlining_add_pending_fn_decls, lhd_tree_inlining_anon_aggr_type_p, lhd_tree_inlining_start_inlining, lhd_tree_inlining_end_inlining): Remove prototypes. (LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS, LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P, LANG_HOOKS_TREE_INLINING_START_INLINING, LANG_HOOKS_TREE_INLINING_END_INLINING): Remove. * c-objc-common.h (LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P): Do not set it. cp/ * 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. From-SVN: r123658
2007-04-072007-04-07 Daniel Berlin <dberlin@dberlin.org>Daniel Berlin4-0/+22
Revert change removing staticp. From-SVN: r123650
2007-04-07in / 2007-04-06 Daniel Berlin <dberlin@dberlin.org>Daniel Berlin4-18/+6
in / 2007-04-06 Daniel Berlin <dberlin@dberlin.org> * tree.c (staticp): No longer use staticp langhook. * langhooks.c (lhd_staticp): Removed. * langhooks.h (struct lang_hooks): Remove staticp. * c-common.c (c_staticp): Remove. * c-common.h (c_staticp): Ditto. * langhooks-defs.h (lhd_staticp): Ditto. (LHD_HOOKS_STATICP): Ditto * tree.h (gcc_assert_lowered): New macro. in cp/ 2007-04-06 Daniel Berlin <dberlin@dberlin.org> * cp-objcp-common.c (cxx_staticp): Remove. * cp-objcp-common.h (LANG_HOOKS_STATICP): Remove. * cp-tree.h (cxx_staticp): From-SVN: r123636
2007-04-04winnt-cxx.c (i386_pe_type_dllimport_p): Don't ignore dllimport attribute of ↵Danny Smith2-10/+7
virtual methods. gcc * config/i386/winnt-cxx.c (i386_pe_type_dllimport_p): Don't ignore dllimport attribute of virtual methods. gcc/cp * class.c (check_for_override): Don't remove dllmport attribute of virtual methods. gcc/testsuite * g++.dg/ext/dllimport12.C: Update comments From-SVN: r123492
2007-04-03re PR c++/30847 (ICE with invalid statement expression)Jakub Jelinek2-0/+12
PR c++/30847 * typeck.c (build_modify_expr): For COND_EXPR on LHS, if RHS has void type issue error and return early. * g++.dg/parse/cond3.C: New test. From-SVN: r123456
2007-04-02re PR c++/31187 (extern declaration of variable in anonymous namespace ↵Jason Merrill4-8/+33
prevents use of its address as template argument) 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. * g++.dg/ext/visibility/anon3.C: New test. From-SVN: r123432
2007-03-31omp-low.c (splay-tree.h): Include.Richard Guenther2-19/+13
2007-03-31 Richard Guenther <rguenther@suse.de> * omp-low.c (splay-tree.h): Include. (lookup_decl): Replace splay-tree usage by pointer-map. (maybe_lookup_decl): Likewise. (new_omp_context): Likewise. (delete_omp_context): Likewise. * gimplify.c (splay-tree.h): Include. * tree-inline.c (insert_decl_map): Replace splay-tree usage by pointer-map. (remap_ssa_name): Likewise. (remap_decl): Likewise. (remap_type_1): Likewise. (remap_type): Likewise. (copy_body_r): Likewise. (expand_call_inline): Likewise. (clone_body): Likewise. (copy_tree_r): Likewise. (remap_save_expr): Likewise. (unsave_r): Likewise. (unsave_expr_now): Likewise. (tree_function_versioning): Likewise. (build_duplicate_type): Likewise. * tree-inline.h (pointer-set.h): Include instead of splay-tree.h. (struct copy_body_data): Replace splay-tree by pointer-map. * Makefile.in (TREE_INLINE_H): Depend on pointer-map.h, not $(SPLAY_TREE_H). (gimplify.o): Depend on $(SPLAY_TREE_H). (omp-low.p): Likewise. * optimize.c (maybe_clone_body): Replace splay-tree usage by pointer-map. From-SVN: r123381
2007-03-31re PR c++/31138 (ICE with ellipsis)Douglas Gregor3-18/+84
2007-03-31 Douglas Gregor <doug.gregor@gmail.com> 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-31 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/parser/pr31138.C: New. * g++.dg/parser/pr31140.C: New. * g++.dg/parser/pr31141.C: New. From-SVN: r123380
2007-03-30re PR c++/26099 (support for type traits is not available)Paolo Carlini12-8/+509
gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> 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. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-29tree.c (cp_walk_subtrees): Do not set input_location.Richard Guenther2-9/+4
2007-03-29 Richard Guenther <rguenther@suse.de> * tree.c (cp_walk_subtrees): Do not set input_location. From-SVN: r123329
2007-03-28re PR c++/29077 (Incorrect error message for destructor in wrong namespace)Simon Martin2-6/+21
2007-03-28 Simon Martin <simartin@users.sourceforge.net> PR c++/29077 * decl.c (grokfndecl): Properly setup decl if it is a constructor or a destructor. From-SVN: r123312
2007-03-28parser.c (struct cp_parser): Update comment for greater_than_is_operator_p.Douglas Gregor2-12/+95
2007-03-28 Douglas Gregor <doug.gregor@gmail.com> * 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 <doug.gregor@gmail.com> * g++.dg/cpp0x/bracket1.C: New. * g++.dg/cpp0x/bracket2.C: New. * g++.dg/cpp0x/bracket3.C: New. * g++.dg/cpp0x/bracket4.C: New. From-SVN: r123302
2007-03-28decl.c (redeclaration_error_message): Complain when redeclaring a friend ↵Douglas Gregor5-36/+122
function with default template arguments... 2007-03-28 Douglas Gregor <doug.gregor@gmail.com> * 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 <doug.gregor@gmail.com> * g++.dg/cpp0x/temp_default1.C: New. * g++.dg/cpp0x/temp_default3.C: New. * g++.dg/cpp0x/temp_default2.C: New. * g++.dg/cpp0x/temp_default4.C: New. From-SVN: r123300
2007-03-28[multiple changes]Douglas Gregor2-6/+12
2007-03-28 Douglas Gregor <doug.gregor@gmail.com> 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-28 Douglas Gregor <doug.gregor@gmail.com> PR c++/29993 * g++.dg/other/cv_func2.C: New. From-SVN: r123294
2007-03-27parser.c (cp_parser_member_declaration): Pedwarn about stray semicolons ↵Dirk Mueller2-1/+10
after member declarations. 2007-03-26 Dirk Mueller <dmueller@suse.de> * parser.c (cp_parser_member_declaration): Pedwarn about stray semicolons after member declarations. From-SVN: r123249
2007-03-26re PR c++/30500 (pragma GCC system_header vs templates)Paolo Carlini2-0/+8
2007-03-26 Paolo Carlini <pcarlini@suse.de> PR c++/30500 * pt.c (instantiate_decl): Set in_system_header. 2007-03-26 Paolo Carlini <pcarlini@suse.de> PR c++/30500 * g++.dg/warn/pragma-system_header1.C: New test. * g++.dg/warn/pragma-system_header2.C: New test. * g++.dg/warn/pragma-system_header1.h. New. * g++.dg/warn/pragma-system_header2.h. New. From-SVN: r123238
2007-03-26gengtype.c: Don't include gtyp-gen.h.Zack Weinberg1-1/+1
* gengtype.c: Don't include gtyp-gen.h. (srcdir): Declare here. (base_files, lang_dir_names): Allocate dynamically. (gt_files, num_gt_files, num_lang_dirs): New globals. (measure_input_list, read_input_line, read_input_list) (set_lang_bitmap): New functions. (get_base_file_bitmap): Rename get_lang_bitmap and drastically simplify, relying on read_input_list to set up the bitmaps. (main): Arguments are no longer unused. Check for correct number of command line arguments, set srcdir and srcdir_len, then call read_input_list, before doing anything else. No need to worry about duplicates in main loop. * configure.ac: Simplify the calculation of all_gtfiles. Put language tags in there. Don't set or substitute all_gtfiles_files_langs or all_gtfiles_files_frags. * Makefile.in: Revamp the way gengtype is invoked, now that it takes a file on its command line with a much simpler format. Remove or replace with gtyp-input.list all references to gtyp-gen.h. (GTFILES): Remove duplicates and C source files. * c-config-lang.in, cp/config-lang.in, objc/config-lang.in * objcp/config-lang.in: Add c-pragma.h to gtfiles. * configure: Regenerate. From-SVN: r123234
2007-03-23cp-tree.h (current_tempalte_parms): Improve documentation.Mark Mitchell3-4/+13
* cp-tree.h (current_tempalte_parms): Improve documentation. * pt.c (current_template_args): Likewise. From-SVN: r123153
2007-03-23re PR c++/30863 (Unsigned templatized struct treated as unsigned int)Mark Mitchell2-2/+9
PR c++/30863 * parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Do not consume tokens when failing. PR c++/30863 * g++.dg/template/error24.C: New test. * g++.dg/parse/tmpl-outside1.C: Tweak error markers. From-SVN: r123152
2007-03-23Mark Mitchell <mark@codesourcery.com> PR c++/31273Mark Mitchell2-9/+13
Mark Mitchell <mark@codesourcery.com> PR c++/31273 * call.c (standard_conversion): Use type_decays_to. Keep FCODE consistent with FROM. PR c++/31273 * g++.dg/expr/bitfield7.C: New test. From-SVN: r123150
2007-03-23error.c (dump_expr): Handle dependent names that designate types.Gabriel Dos Reis4-10/+39
* error.c (dump_expr): Handle dependent names that designate types. * cxx-pretty-print.c (pp_cxx_unqualified_id): Handle TYPENAME_TYPE. From-SVN: r123148
2007-03-17* cp-tree.def, parser.c, pt.c: Fix comment typos.Kazu Hirata4-4/+8
From-SVN: r123024
2007-03-16invoke.texi (-Wconversion): Document warnings specific to C++.Manuel López-Ibáñez5-18/+44
2007-03-16 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * doc/invoke.texi (-Wconversion): Document warnings specific to C++. * c-common.c (convert_and_check): Move warning logic to... (warnings_for_convert_and_check): ...here. Define. * c-common.h (warnings_for_convert_and_check): Declare. cp/ * 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. testsuite/ * g++.dg/warn/Wconversion-integer.C: New * g++.dg/warn/Wconversion-real.C: New. * g++.dg/warn/Wconversion-real-integer.C: New. * g++.dg/warn/conv2.C: Updated. From-SVN: r123005
2007-03-15re PR c++/30891 (poor diagnostic with namespace in the function scope)Manuel López-Ibáñez2-0/+24
2007-03-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/30891 cp/ * 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. testsuite/ * g++.dg/parse/namespace-definition.C: New. From-SVN: r122962
2007-03-15re PR c++/24924 (front end and preprocessor pedantic_errors settings should ↵Manuel López-Ibáñez2-11/+6
agree) 2007-03-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/24924 * c-opts.c (c_common_post_options): Handle C++ post-processing here. Set also -pedantic-errors by default for the preprocessor unless -fpermissive is given. cp/ * decl.c (cxx_init_decl_processing): Move command-line options processing to c-opts.c. testsuite/ * g++.dg/cpp/pedantic-errors.C: New. * g++.dg/cpp/permissive.C: New. From-SVN: r122961
2007-03-15ptree.c (cxx_print_type): Use formatting markup for integers when printing ↵Douglas Gregor5-28/+54
template parameter... 2007-03-15 Douglas Gregor <doug.gregor@gmail.com> * 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. From-SVN: r122955
2007-03-14re PR c++/31165 (Error: symbol `an_empty_string' is already defined)Andrew Pinski2-1/+7
2007-03-14 Andrew Pinski <andrew_pinski@playstation.sony.com> PR c++/31165 * call.c (convert_default_arg): Instead of copying the node, unshare it. 2007-03-14 Andrew Pinski <andrew_pinski@playstation.sony.com> PR C++/31165 * g++.dg/other/default7.C: New test. From-SVN: r122941
2007-03-14re PR c++/30860 (Should warn about boolean constant false used in pointer ↵Dirk Mueller2-24/+44
context) 2007-03-15 Dirk Mueller <dmueller@suse.de> 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. * g++.dg/warn/Wconversion2.C: New. From-SVN: r122934
2007-03-14c-common.h (empty_body_warning): Rename to empty_if_body_warning.Dirk Mueller2-2/+14
2007-03-14 Dirk Mueller <dmueller@suse.de> * c-common.h (empty_body_warning): Rename to empty_if_body_warning. * c-common.c (empty_if_body_warning): Rephrase diagnostic message. * c-parser.c (c_parser_if_body): Always add an empty statement in case of empty body. * c-parser.c (c_parser_do_statement): Warn about empty body in do/while statement. * c-typeck (c_finish_if_stmt): Call empty_if_body_warning. * doc/invoke.texi (-Wempty-body): Update documentation. * cp/semantics.c (c_finish_if_stmt): Call empty_if_body_warning. (finish_do_body): Warn about empty body in do/while statement. * g++.dg/warn/do-empty.C: New. * gcc.dg/do-empty.c: New. * gcc.dg/if-empty-1.c: Update. * gcc.dg/20001116-1.c: Update. * gcc.dg/pr23165.c: Update. From-SVN: r122928
2007-03-14class.c (warn_hidden): Add OPT_Woverloaded_virtual to warning.Manuel López-Ibáñez2-2/+6
2007-03-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org> cp/ * class.c (warn_hidden): Add OPT_Woverloaded_virtual to warning. From-SVN: r122926
2007-03-14re PR c/21438 (Warning about division by zero depends on lexical form)Manuel López-Ibáñez2-8/+8
2007-03-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c/21438 * c-common.h (warn_for_div_by_zero): Declare. * c-common.c (warn_for_div_by_zero): Define. * c-typeck.c (build_binary_op): Call warn_for_div_zero instead of warning. cp/ * typeck.c (build_binary_op): Call warn_for_div_zero instead of warning. From-SVN: r122925
2007-03-14flags.h (flag_random_seed): Remove declaration, in favor of...Alexandre Oliva2-3/+12
gcc/ChangeLog: * flags.h (flag_random_seed): Remove declaration, in favor of... * toplev.h (get_random_seed, set_random_seed): ... these. * tree.c (get_file_function_name): Use the former. * opts.c (common_handle_option): Use the latter. * toplev.c gcc/cp/ChangeLog: * cp/repo.c (init_repo): Initialize random_seed saved options. (finish_repo): Adjust. From-SVN: r122901
2007-03-13re PR bootstrap/30899 (build failure with --enable-generated-files-in-srcdir)Mark Mitchell2-1/+7
PR bootstrap/30899 * Make-lang.in (doc/g++.1): Use $< to specify the location from which to copy. From-SVN: r122890
2007-03-12invoke.texi (Wvla): New warning.Seongbae Park2-3/+16
ChangeLog: 2007-03-12 Seongbae Park <seongbae.park@gmail.com> * gcc/doc/invoke.texi (Wvla): New warning. gcc/ChangeLog: 2007-03-12 Seongbae Park <seongbae.park@gmail.com> * c-decl.c (warn_variable_length_array): New function. Refactored from grokdeclarator to handle warn_vla and handle unnamed array case. (grokdeclarator): Refactored VLA warning case. * c.opt (Wvla): New flag. gcc/cp/ChangeLog: 2007-03-12 Seongbae Park <seongbae.park@gmail.com> * decl.c (compute_array_index_type): New warning flag warn_vla. gcc/testsuite/ChangeLog: 2007-03-12 Seongbae Park <seongbae.park@gmail.com> * gcc.dg/wvla-1.c: New test * gcc.dg/wvla-2.c: New test * gcc.dg/wvla-3.c: New test * gcc.dg/wvla-4.c: New test * gcc.dg/wvla-5.c: New test * gcc.dg/wvla-6.c: New test * gcc.dg/wvla-7.c: New test * g++.dg/warn/Wvla-1.C: New test * g++.dg/warn/Wvla-2.C: New test * g++.dg/warn/Wvla-3.C: New test From-SVN: r122851
2007-03-12re PR c++/30108 (internal compiler error: in make_decl_rtl, at varasm.c:890)Mark Mitchell2-3/+12
PR c++/30108 * call.c (convert_default_arg): Copy non-constant arguments. PR c++/30108 * g++.dg/other/default6.C: New test. From-SVN: r122844
2007-03-12re PR c++/30328 (bit-field: unassemblable assembly code)Mark Mitchell3-1/+25
PR c++/30328 * semantics.c (finish_typeof): Use unlowered_expr_type. PR c++/30328 * g++.dg/ext/bitfield1.C: New test. PR c++/31038 * parser.c (cp_parser_postfix_expression): Disallow compound literals in constant expressions. PR c++/31038 * g++.dg/template/complit2.C: New test. From-SVN: r122829
2007-03-11re PR c++/30274 (bool bit-field: wrong increment and decremenet)Mark Mitchell5-20/+60
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. PR c++/30274 * g++.dg/expr/bitfield3.C: New test. * g++.dg/expr/bitfield4.C: Likewise. * g++.dg/expr/bitfield5.C: Likewise. * g++.dg/expr/bitfield6.C: Likewise. From-SVN: r122813
2007-03-10re PR c++/20599 (variadic template support)Douglas Gregor16-287/+3226
2007-03-09 Douglas Gregor <doug.gregor@gmail.com> 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. From-SVN: r122788
2007-03-09re PR c/17946 (wanted: warning for "a && MASK" when "a & MASK" was probably ↵Dirk Mueller2-2/+23
intended) 2007-03-09 Dirk Mueller <dmueller@suse.de> PR c++/17946 * doc/invoke.texi (-Wlogical-op): Document. * common.opt (-Wlogical-op): New. * c-common.h (warn_logical_operator): Declare. * c-common.c (warn_logical_operator): Define. * c-typeck.c (parser_build_binary_op): Call warn_logical_operator. * cp/call.c (build_new_op): Call warn_logical_operator. * testsuite/gcc.dg/Wlogical-op-1.c: New. * testsuite/g++.dg/warn/Wlogical-op-1.C: New. From-SVN: r122751
2007-03-08re PR c++/30852 (Trouble with __builtin_offsetof and volatile)Volker Reichelt2-1/+5
PR c++/30852 * c-common.c (fold_offsetof_1): Handle COMPOUND_EXPR. * semantics.c (finish_offsetof): Handle COMPOUND_EXPR. * g++.dg/ext/offsetof1.C: Add cases with volatile. From-SVN: r122686
2007-03-08re PR c++/30534 (ICE with invalid template argument)Volker Reichelt2-1/+9
PR c++/30534 * pt.c (any_template_arguments_need_structural_equality_p): Robustify. * g++.dg/template/arg5.C: New test. From-SVN: r122685
2007-03-08c-decl.c (grokdeclarator): Disable warnings for anonymous bitfields.Alexandre Oliva2-1/+9
gcc/ChangeLog: * c-decl.c (grokdeclarator): Disable warnings for anonymous bitfields. * tree-sra.c (instantiate_element): Propagate disabled warnings from the element itself to the created variable. gcc/cp/ChangeLog: * decl.c (grokdeclarator): Disable warnings for anonymous bitfields. From-SVN: r122684
2007-03-05typeck2.c (readonly_error): Always emit a hard error.Volker Reichelt5-22/+22
* 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. From-SVN: r122541
2007-03-04re PR c++/30895 (ICE with complex values in template parameter)Simon Martin2-0/+9
2007-03-04 Simon Martin <simartin@users.sourceforge.net> PR c++/30895 * tree.c (cp_tree_equal): Properly handle COMPLEX_CST trees. From-SVN: r122532
2007-03-03re PR c++/15787 (Poor error message with if and blocks)Manuel López-Ibáñez2-4/+36
2007-03-03 Manuel Lopez-Ibanez <manu@gcc.gnu.org> 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. testsuite/ * g++.dg/parse/else.C: New. * g++.dg/parse/else-2.C: New. From-SVN: r122505
2007-03-02re PR c++/28253 (ICE with invalid covariant return)Simon Martin2-1/+8
2007-03-02 Simon Martin <simartin@users.sourceforge.net> PR c++/28253 * class.c (update_vtable_entry_for_fn): Properly handle invalid overriders for thunks. From-SVN: r122490
2007-03-02Index: gcc/cp/ChangeLogGeoffrey Keating2-8/+15
2007-03-02 Geoffrey Keating <geoffk@apple.com> * g++spec.c (lang_specific_driver): Add -lstdc++ when compiling Objective-C++. Don't exit early if -shared-libgcc needs to be added. Index: gcc/testsuite/ChangeLog 2007-03-02 Geoffrey Keating <geoffk@apple.com> * g++.dg/other/darwin-minversion-1.C: New. From-SVN: r122488