aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/error.c
AgeCommit message (Collapse)AuthorFilesLines
2012-02-16re PR c++/51415 (Broken diagnostic: 'vec_init_expr' not supported by dump_expr)Jason Merrill1-0/+2
PR c++/51415 * error.c (dump_expr): Handle lambda closures specifically. From-SVN: r184314
2012-01-27re PR c++/51370 (ICE with invalid template parameter)Paolo Carlini1-4/+7
/cp 2012-01-26 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51370 * error.c (dump_decl, [TEMPLATE_ID_EXPR]): Handle error_mark_node as TREE_OPERAND (t, 1). /testsuite 2012-01-26 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51370 * g++.dg/template/crash112.C: New. From-SVN: r183593
2012-01-06* error.c (dump_expr): Print type of CONSTRUCTOR.Jason Merrill1-0/+2
From-SVN: r182967
2011-12-05Implement C++11 delegating constructors.Ville Voutilainen1-0/+5
* cp-tree.h (enum cpp0x_warn_str): Add CPP0X_DELEGATING_CTORS. * error.c (maybe_warn_cpp0x): Adjust. * parser.c (cp_parser_mem_initializer_list): Use it. Diagnose multiple initializers if a delegating initializer is present. * call.c (build_special_member_call): Convert an assert into an if. * init.c (perform_target_ctor): New. (emit_mem_initializers): Use it. (expand_member_init, expand_default_init): Adjust. Co-Authored-By: Pedro Lamarão <pedro.lamarao@gmail.com> From-SVN: r182012
2011-11-20re PR c++/51230 (Broken diagnostic: 'template_parm_index' not supported by ↵Paolo Carlini1-0/+1
dump_type) /cp 2011-11-20 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51230 * pt.c (unify_inconsistency): Handle non-type parameters better. * error.c (dump_expr): Handle TEMPLATE_TEMPLATE_PARM. /cp 2011-11-20 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51230 * g++.dg/template/error46.C: New. From-SVN: r181538
2011-11-08re PR middle-end/51010 (bad diagnostics: #'ssa_name' not supported by ↵Richard Guenther1-0/+7
pp_c_expression#]') 2011-11-08 Richard Guenther <rguenther@suse.de> PR middle-end/51010 c-family/ * c-pretty-print.c (pp_c_expression): Handle SSA_NAMEs. cp/ * error.c (dump_expr): Handle SSA_NAMEs. * c-c++-common/uninit-pr51010.c: New testcase. From-SVN: r181165
2011-11-08Fix context handling of alias-declarationDodji Seketeli1-0/+2
gcc/cp/ * decl.c (start_decl): Update comment. * error.c (dump_alias_template_specialization): Dump the context of the specialization. * parser.c (cp_parser_alias_declaration): Call pop_scope on the pushed scope yielded by start_decl. gcc/testsuite * g++.dg/cpp0x/alias-decl-11.C: New test. From-SVN: r181152
2011-11-07PR c++/45114 - Support C++11 alias-declarationDodji Seketeli1-8/+47
gcc/cp/ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P) (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor macros. (TYPE_TEMPLATE_INFO): Get template info of an alias template specializations from its TYPE_DECL. (SET_TYPE_TEMPLATE_INFO): Set template info of alias template specializations into its TYPE_DECL. (DECL_CLASS_TEMPLATE_P): Re-write using the new DECL_TYPE_TEMPLATE_P. (enum cp_decl_spec): Add new ds_alias enumerator. (alias_type_or_template_p, alias_template_specialization_p): Declare new functions. * parser.c (cp_parser_alias_declaration): New static function. (cp_parser_check_decl_spec): Add "using" name for the `alias' declspec. (cp_parser_type_name): Update comment. Support simple-template-id representing alias template specializations in c++0x mode. (cp_parser_qualifying_entity): Update comment. Use cp_parser_type_name. (cp_parser_block_declaration): Handle alias-declaration in c++11. Update comment. (cp_parser_template_id): Handle specializations of alias templates. (cp_parser_member_declaration): Add alias-declaration production to comment. Support alias-declarations. (cp_parser_template_declaration_after_export): Handle alias templates in c++11. * decl.c (make_typename_type, make_unbound_class_template): Accept alias templates. (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias declarations. * decl2.c (grokfield): Move template creation after setting up the TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias template actually carries the right type-id of the alias declaration. * pt.c (alias_type_or_template_p) (alias_template_specialization_p): Define new public functions. (maybe_process_partial_specialization): Reject partial specializations of alias templates. (primary_template_instantiation_p): Consider alias template instantiations. (push_template_decl_real): Assert that TYPE_DECLs of alias templates are different from those of class template. Store template info onto the TYPE_DECL of the alias template. (convert_template_argument): Strip aliases from template arguments. (lookup_template_class_1): Handle the creation of the specialization of an alias template. (tsubst_decl): Create a substituted copy of the TYPE_DECL of an member alias template. (tsubst): Handle substituting into the type of an alias template. Handle substituting UNBOUND_CLASS_TEMPLATE into BOUND_TEMPLATE_TEMPLATE_PARM. (do_type_instantiation): Better diagnostics when trying to explicitely instantiate a non-class template. * search.c (lookup_field_1, lookup_field_r): Support looking up alias templates. * semantics.c (finish_template_type): For instantiations of alias templates, return the TYPE_DECL of the actual alias and not the one of the aliased type. * error.c (dump_alias_template_specialization): New static function. (dump_type): Handle printing of alias templates and their specializations. templates. (dump_aggr_type): For specialization of alias templates, fetch arguments from the right place. (dump_decl): Print an alias-declaration like `using decl = type;' (dump_template_decl): Support printing of alias templates. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-0.C: New test case. * g++.dg/cpp0x/alias-decl-1.C: Likewise. * g++.dg/cpp0x/alias-decl-3.C: Likewise. * g++.dg/cpp0x/alias-decl-4.C: Likewise. * g++.dg/cpp0x/alias-decl-6.C: Likewise. * g++.dg/cpp0x/alias-decl-7.C: Likewise. * g++.dg/cpp0x/alias-decl-8.C: Likewise. * g++.dg/cpp0x/alias-decl-9.C: Likewise. * g++.dg/cpp0x/alias-decl-10.C: Likewise. * g++.dg/ext/alias-decl-attr1.C: Likewise. * g++.dg/ext/alias-decl-attr2.C: Likewise. * g++.dg/ext/alias-decl-attr3.C: Likewise. * g++.dg/ext/alias-decl-attr4.C: Likewise. From-SVN: r181118
2011-10-31re PR c++/50920 (add a -std=c++11 option to the driver)Jason Merrill1-11/+11
PR c++/50920 gcc/c-family * c-common.h (cxx_dialect): Add cxx11 and cxx03. * c.opt: Add -std=c++11, -std=gnu++11, -std=gnu++03, and -Wc++11-compat. * c-opts.c (set_std_cxx11): Rename from set_std_cxx0x. gcc/cp * class.c (check_field_decl): Change c++0x in diags to c++11. * error.c (maybe_warn_cpp0x): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. * pt.c (check_default_tmpl_args): Likewise. libcpp * include/cpplib.h (enum c_lang): Rename CLK_CXX0X to CLK_CXX11, CLK_GNUCXX0X to CLK_GNUCXX11. libstdc++-v3 * include/bits/c++0x_warning.h: Change -std=c++0x to -std=c++11. From-SVN: r180707
2011-10-26Implement C++11 user-defined literals.Ed Smith-Rowland1-2/+13
libcpp/ * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix, cpp_userdef_string_remove_type, cpp_userdef_string_add_type, cpp_userdef_char_remove_type, cpp_userdef_char_add_type, cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New. (cpp_classify_number): Classify unrecognized tokens as user-defined literals. * include/cpplib.h: Add new tokens for user-defined literals. * init.c: Add new preprocessor flag (cxx11). * lex.c: (lex_string, lex_raw_string): Handle user-defined literals including concatenation and promotion with suffixes. c-family/ * c-common.c (build_userdef_literal): New. * c-common.def: New tree code. * c-common.h (tree_userdef_literal): New tree struct and accessors. * c-lex.c (interpret_float): Add suffix parm. (c_lex_with_flags): Build literal tokens. cp/ * cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree. * cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator name tools. New tree code for user-defined literals. * cxx-pretty-print.h: (pp_cxx_userdef_literal) New. * cxx-pretty-print.c: (pp_cxx_userdef_literal) New. (pp_cxx_primary_expression, pp_cxx_expression): Use it. * decl.c: (cp_tree_node_structure): Return new tree code. (duplicate_decls): Check for raw vs. template operator conflicts. (grokfndecl, grokdeclarator): New checks for literal operators. * error.c: (dump_expr): Warn about user-defined literals in C++98 mode. (dump_function_name): Pretty printing. * mangle.c: (write_literal_operator_name): New. (write_unqualified_id, write_unqualified_name): Use it. * parser.c: (cp_parser_operator): Handle operator"". (cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal, cp_parser_userdef_string_literal): New. (cp_parser_primary_expression): Handle new user-defined literal tokens with new functions. * semantics.c: (potential_constant_expression_1): Add user-defined literals. * typeck.c (check_raw_literal_operator, check_literal_operator_args): New. From-SVN: r180536
2011-10-17Emit macro expansion related diagnosticsTom Tromey1-2/+3
In this third instalment the diagnostic machinery -- when faced with the virtual location of a token resulting from macro expansion -- uses the new linemap APIs to unwind the stack of macro expansions that led to that token and emits a [hopefully] more useful message than what we have today. diagnostic_report_current_module has been slightly changed to use the location given by client code instead of the global input_location variable. This results in more precise diagnostic locations in general but then the patch adjusts some C++ tests which output changed as a result of this. Three new regression tests have been added. The mandatory screenshot goes like this: [dodji@adjoa gcc]$ cat -n test.c 1 #define OPERATE(OPRD1, OPRT, OPRD2) \ 2 OPRD1 OPRT OPRD2; 3 4 #define SHIFTL(A,B) \ 5 OPERATE (A,<<,B) 6 7 #define MULT(A) \ 8 SHIFTL (A,1) 9 10 void 11 g () 12 { 13 MULT (1.0);/* 1.0 << 1; <-- so this is an error. */ 14 } [dodji@adjoa gcc]$ ./cc1 -quiet -ftrack-macro-expansion test.c test.c: In function 'g': test.c:5:14: erreur: invalid operands to binary << (have 'double' and 'int') test.c:2:9: note: in expansion of macro 'OPERATE' test.c:5:3: note: expanded from here test.c:5:14: note: in expansion of macro 'SHIFTL' test.c:8:3: note: expanded from here test.c:8:3: note: in expansion of macro 'MULT2' test.c:13:3: note: expanded from here Co-Authored-By: Dodji Seketeli <dodji@redhat.com> From-SVN: r180083
2011-10-11re PR c++/49855 (internal compiler error: in fold_convert_const_int_from_real)Jason Merrill1-0/+1
PR c++/49855 PR c++/49896 * cp-tree.def (IMPLICIT_CONV_EXPR): New. * call.c (perform_implicit_conversion_flags): Build it instead of NOP_EXPR. * cp-objcp-common.c (cp_common_init_ts): It's typed. * cxx-pretty-print.c (pp_cxx_cast_expression): Handle it. (pp_cxx_expression): Likewise. * error.c (dump_expr): Likewise. * semantics.c (potential_constant_expression_1): Likewise. * tree.c (cp_tree_equal): Likewise. (cp_walk_subtrees): Likewise. * pt.c (iterative_hash_template_arg): Likewise. (for_each_template_parm_r): Likewise. (type_dependent_expression_p): Likewise. (tsubst_copy, tsubst_copy_and_build): Handle IMPLICIT_CONV_EXPR and CONVERT_EXPR. * cp-tree.h (IMPLICIT_CONV_EXPR_DIRECT_INIT): New. From-SVN: r179813
2011-09-27re PR c++/45487 (Request to change comma to semicolon in error message)Paolo Carlini1-6/+7
/cp 2011-09-26 Paolo Carlini <paolo.carlini@oracle.com> PR c++/45487 * error.c (dump_template_bindings): Separate bindings with semicolons instead of commas. /testsuite 2011-09-26 Paolo Carlini <paolo.carlini@oracle.com> PR c++/45487 * g++.dg/diagnostic/bindings1.C: New. * g++.old-deja/g++.pt/memtemp77.C: Adjust. From-SVN: r179226
2011-09-24Implement C++11 non-static data member initializers.Jason Merrill1-0/+5
* cp-tree.h (enum cpp_warn_str): Add CPP0X_NSDMI. * error.c (maybe_warn_cpp0x): Handle it. * call.c (convert_like_real) [ck_user]: Don't complain about using an explicit constructor for direct-initialization. * class.c (check_field_decl): Fix ancient typo. (check_field_decls): NSDMIs make the default ctor non-trivial. * decl.c (cp_finish_decl): Record NSDMI. (grokdeclarator): Allow NSDMI. * decl2.c (grokfield): Allow NSDMI. Correct LOOKUP flags. * init.c (perform_member_init): Use NSDMI. * method.c (walk_field_subobs): Check for NSDMI. * parser.c (cp_parser_member_declaration): Parse { } init. * semantics.c (register_constexpr_fundef): Don't talk about a return statement in a constexpr constructor. (cxx_eval_call_expression): Check DECL_INITIAL instead of DECL_SAVED_TREE. From-SVN: r179155
2011-08-13re PR c++/50059 ([C++0x] Broken error message with __builtin_remquo & constexpr)Jason Merrill1-0/+4
PR c++/50059 * error.c (dump_expr): Handle MODIFY_EXPR properly. From-SVN: r177735
2011-07-22Warn about the use of final/override in non-c++0x mode, and add __final for ↵Ville Voutilainen1-0/+5
non-c++0x mode. Warn about the use of final/override in non-c++0x mode, and add __final for non-c++0x mode. * cp-tree.h (cpp0x_warn_str): Add CPP0X_OVERRIDE_CONTROLS. * error.c (maybe_warn_cpp0x): Adjust. * parser.c (cp_parser_virt_specifier_seq_opt): Use it. Add '__final' as a non-c++0x alternative for 'final'. From-SVN: r176655
2011-07-16pt.c (tinst_level_tick, [...]): Replace with last_error_tinst_level.Jason Merrill1-20/+13
gcc/cp/ * pt.c (tinst_level_tick, last_template_error_tick): Replace with last_error_tinst_level. (push_tinst_level, pop_tinst_level): Adjust. (problematic_instantiation_changed): Adjust. (record_last_problematic_instantiation): Adjust. * error.c (cp_print_error_function): Don't print current_function_decl if we're in a template instantiation context. (print_instantiation_full_context): Always print first line. gcc/testsuite/ * lib/prune.exp (prune_gcc_output): Prune "In substitution" too. From-SVN: r176366
2011-07-04error.c (dump_template_bindings): Don't print typenames for a partial ↵Jason Merrill1-16/+37
instantiation. * error.c (dump_template_bindings): Don't print typenames for a partial instantiation. (dump_function_decl): If we aren't printing function arguments, print template arguments as <args> rather than [with ...]. (dump_expr): Don't print return type or template header. [BASELINK]: Use BASELINK_FUNCTIONS rather than get_first_fn. * pt.c (dependent_template_arg_p): Handle null arg. From-SVN: r175834
2011-07-04* error.c (type_to_string): Avoid redundant akas.Jason Merrill1-0/+14
From-SVN: r175833
2011-06-16re PR c++/49420 ([C++0x] compiler segfault using result_of)Jason Merrill1-1/+3
PR c++/49420 * error.c (dump_template_argument): Don't try to omit default template args from an argument pack. From-SVN: r175117
2011-06-14* error.c (type_to_string): Print typedef-stripped version too.Jason Merrill1-0/+9
From-SVN: r175045
2011-06-08re PR c++/49107 ([C++0x][4.7 Regression] incomplete type regression with ↵Jason Merrill1-1/+4
std::pair) PR c++/49107 * cp-tree.def (DEFERRED_NOEXCEPT): New. * cp-tree.h (struct tree_deferred_noexcept): New. (DEFERRED_NOEXCEPT_PATTERN, DEFERRED_NOEXCEPT_ARGS): New. (DEFERRED_NOEXCEPT_SPEC_P): New. (enum cp_tree_node_structure_enum): Add TS_CP_DEFERRED_NOEXCEPT. (union lang_tree_node): Add tree_deferred_noexcept. (maybe_instantiate_noexcept): Declare. * cp-objcp-common.c (cp_tree_size): Handle DEFERRED_NOEXCEPT. * error.c (dump_exception_spec): Likewise. * cxx-pretty-print.c (pp_cxx_exception_specification): Likewise. * ptree.c (cxx_print_xnode): Likewise. * tree.c (cp_tree_equal): Likewise. * decl.c (cp_tree_node_structure): Likewise. (duplicate_decls): Call maybe_instantiate_noexcept. * except.c (build_noexcept_spec): Handle DEFERRED_NOEXCEPT. (nothrow_spec_p, type_noexcept_p, type_throw_all_p): Check DEFERRED_NOEXCEPT_SPEC_P. * typeck2.c (merge_exception_specifiers): Likewise. * decl2.c (mark_used): Call maybe_instantiate_noexcept. * method.c (process_subob_fn, defaulted_late_check): Likewise. * pt.c (tsubst_exception_specification): Add defer_ok parm. Build DEFERRED_NOEXCEPT. (maybe_instantiate_noexcept): New. (tsubst, regenerate_decl_from_template, instantiate_decl): Adjust. * search.c (check_final_overrider): Call maybe_instantiate_noexcept. From-SVN: r174820
2011-06-07re PR c++/48969 (ICE with -std=c++0x)Jason Merrill1-23/+46
PR c++/48969 PR c++/44175 gcc/c-family/ * c-common.c (max_tinst_depth): Lower default to 900. gcc/cp/ * error.c (subst_to_string): New. (cp_printer): Use it for 'S'. (print_instantiation_partial_context_line): Handle subst context. * pt.c (push_tinst_level): Handle subst context. (deduction_tsubst_fntype): Don't track specific substitutions. Use push_tinst_level. From-SVN: r174772
2011-05-27re PR c++/48284 ([C++0x] incorrect printing of decltype operand in diagnostic)Jason Merrill1-1/+4
PR c++/48284 * error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot with INDIRECT_REF of REFERENCE_TYPE. From-SVN: r174353
2011-05-25re PR c++/49156 ([C++0x] Error reporting routines re-entered)Jason Merrill1-0/+5
PR c++/49156 * error.c (dump_template_bindings): Set processing_template_decl for a partial instantiation. From-SVN: r174256
2011-05-23re PR c++/47336 ([C++0x] ICE: "Error reporting routines re-entered")Jason Merrill1-0/+2
PR c++/47336 * error.c (dump_template_bindings): Suppress access control. From-SVN: r174072
2011-05-06introduce {class,type}_of_this_parm functionsNathan Froyd1-4/+2
introduce {class,type}_of_this_parm functions * cp-tree.h (type_of_this_parm, class_of_this_parm): New functions. * call.c (standard_conversion): Call class_of_this_parm. * cxx-pretty-print.c (pp_cxx_implicit_parameter_type): Likewise. (pp_cxx_direct_abstract_declarator): Likewise. * decl2.c (change_return_type): Likewise. (cp_reconstruct_complex_type): Likewise. * error.c (dump_type_suffix, dump_function_decl): Likewise. * mangle.c (write_function_type): Likewise. * pt.c (unify): Likewise. * typeck.c (merge_types, type_memfn_quals): Likewise. * decl.c (build_this_parm): Call type_of_this_parm. From-SVN: r173496
2011-04-25c-common.c (struct c_common_resword): Add __underlying_type.Paolo Carlini1-1/+12
/gcc 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * c-family/c-common.c (struct c_common_resword): Add __underlying_type. * c-family/c-common.h (enum rid): Add RID_UNDERLYING_TYPE. /cp 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * cp-tree.def: Add a new UNDERLYING_TYPE tree code. * cp-tree.h (enum cp_trait_kind): Add CPTK_UNDERLYING_TYPE, tidy. (UNDERLYING_TYPE_TYPE): Add. * cp-objcp-common.c (cp_common_init_ts): Mark UNDERLYING_TYPE as TS_COMMON. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword, cp_parser_simple_type_specifier): Handle UNDERLYING_TYPE. (cp_parser_trait_expr): Deal with RID_UNDERLYING_TYPE; tidy. * semantics.c (finish_underlying_type): New. * typeck.c (structural_comptypes): Handle UNDERLYING_TYPE. * error.c (dump_type, dump_type_prefix, dump_type_suffix): Likewise. * cxx-pretty-print.c (p_cxx_type_id): Likewise. * tree.c (cp_walk_subtrees): Likewise. * pt.c (for_each_template_parm_r, tsubst, unify, dependent_type_p_r): Likewise. * mangle.c (write_type): Sorry for __underlying_type. * doc/extend.texi: Document __underlying_type. /testsuite 2011-04-25 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/ext/underlying_type1.C: New. * g++.dg/ext/underlying_type2.C: Likewise. * g++.dg/ext/underlying_type3.C: Likewise. * g++.dg/ext/underlying_type4.C: Likewise. * g++.dg/ext/underlying_type5.C: Likewise. * g++.dg/ext/underlying_type6.C: Likewise. * g++.dg/ext/underlying_type7.C: Likewise. * g++.dg/ext/underlying_type8.C: Likewise. * g++.dg/ext/underlying_type9.C: Likewise. * g++.dg/ext/underlying_type10.C: Likewise. From-SVN: r172943
2011-03-21ChangeLog gcc/c-familyKai Tietz1-0/+2
2011-03-21 Kai Tietz <ktietz@redhat.com> PR target/12171 * c-pretty-print.c (pp_c_specifier_qualifier_list): Display allowed attributes for function pointer types. (pp_c_attributes_display): New function to display attributes having affects_type_identity flag set to true. * c-pretty-print.h (pp_c_attributes_display): New prototype. ChangeLog gcc/cp 2011-03-21 Kai Tietz <ktietz@redhat.com> PR target/12171 * cxx-pretty-print.c (pp_cxx_ptr_operator): Display allowed attributes for function pointer types. * error.c (dump_type_prefix): Likewise. From-SVN: r171210
2011-02-20re PR c++/47703 ([C++0x] ICE: std::sort chokes on simple lambda function)Jason Merrill1-1/+5
PR c++/47703 * error.c (location_of): Handle non-tagged types. From-SVN: r170349
2010-12-14re PR c++/45330 (Suggest likely nested-name-specifiers for undeclared ↵Nathan Froyd1-0/+36
identifiers.) gcc/cp/ PR c++/45330 * cp-tree.h (suggest_alternatives_for): Add location_t parameter. * name-lookup.c (suggest_alternatives_for): Likewise. Adjust. * lex.c (unqualified_name_lookup_error): Adjust call to it. * semantics.c (qualified_name_lookup_error): Move to... * error.c (qualified_name_lookup_error): ...here. Call. suggest_alternatives_for. gcc/testsuite/ PR c++/45330 * g++.dg/lookup/suggestions1.C: New test. From-SVN: r167814
2010-12-10decl.c (grokmethod): Test DECL_CLASS_SCOPE_P.Nathan Froyd1-1/+1
* decl.c (grokmethod): Test DECL_CLASS_SCOPE_P. * error.c (dump_decl): Test DECL_FILE_SCOPE_P. From-SVN: r167691
2010-12-07re PR c++/45330 (Suggest likely nested-name-specifiers for undeclared ↵Nathan Froyd1-2/+2
identifiers.) gcc/ PR c++/45330 * params.def (CXX_MAX_NAMESPACES_FOR_DIAGNOSTIC_HELP): New parameter. * doc/invoke.texi (cxx-max-namespaces-for-diagnostic-help): Document. gcc/cp/ PR c++/45330 * cp-tree.h (suggest_alternatives_for, location_of): Declare. * error.c (dump_expr): Handle TYPE_DECL. (location_of): Unstaticize. * name-lookup.c (suggest_alternatives_for): New function. * lex.c (unqualified_name_lookup_error): Call it. gcc/testsuite/ PR c++/45330 * g++.dg/pr45330.C: New test. * g++.dg/ext/builtin3.C: Adjust. * g++.dg/lookup/error1.C: Adjust. * g++.dg/lookup/koenig5.C: Adjust. * g++.dg/overload/koenig1.C: Adjust. * g++.dg/parse/decl-specifier-1.C: Adjust. * g++.dg/template/static10.C: Adjust. * g++.old-deja/g++.mike/ns5.C: Adjust. * g++.old-deja/g++.mike/ns7.C: Adjust. * g++.old-deja/g++.ns/koenig5.C: Adjust. * g++.old-deja/g++.ns/koenig9.C: Adjust. * g++.old-deja/g++.other/lineno5.C: Adjust. From-SVN: r167536
2010-12-06In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-0/+1
In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * c-family/c-common.h: Removed the declarations of all the objc_ callbacks, and moved them into c-objc.h. Removed objc_ivar_visibility_kind and moved it into c-objc.h. * c-family/c-objc.h: New file. * c-family/c-common.c: Include c-objc.h. * c-family/c-format.c: Same change. * c-family/stub-objc.c: Same change. * c-decl.c: Include c-family/c-objc.h. * c-parser.c: Same change. * c-typeck.c: Same change. * c-config-lang.in (gtfiles): Added c-family/c-objc.h. * Makefile.in (c-decl.o): Depend on c-family/c-objc.h. (c-parser.o): same change. (c-typeck.o): Same change. (c-family/c-format.o): Same change. (c-family/stub-objc.o): Same change. (c-family/c-common.o): Same change. (PLUGIN_HEADERS): Added c-family/c-objc.h. In gcc/cp/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * call.c: Include c-family/c-objc.h. * decl.c: Same change. * decl2.c: Same change. * error.c: Same change. * lex.c: Same change. * parser.c: Same change. * pt.c: Same change. * semantics.c: Same change. * typeck.c: Same change. * Make-lang.in (cp/decl.o): Depend on c-family/c-objc.h. (cp/decl2.o): Same change. (cp/call.o): Same change. (cp/error.o): Same change. (cp/lex.o): Same change. (cp/parser.o): Same change. (cp/pt.o): Same change. (cp/semantics.o): Same change. (cp/typeck.o): Same change. * config-lang.in (gtfiles): Added c-family/c-objc.h. In gcc/objc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c: Include c-family/c-objc.h. * objc-lang.c: Same change. * Make-lang.in (objc/objc-act.o): Depend on c-family/c-objc.h. (objc/objc-lang.o): Same change. * config-lang.in (gtfiles): Added c-family/c-objc.h. In gcc/objcp/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * config-lang.in (gtfiles): Added c-family/c-objc.h. * Make-lang.in (objcp/objcp-act.o): Depend on c-family/c-objc.h. (objcp/objcp-lang.o): Same change. (objcp/objcp-decl.o): Same change. * objcp-lang.c: Include c-family/c-objc.h. * objcp-decl.c: Same change. From-SVN: r167481
2010-12-03re PR middle-end/46745 ('#'mem_ref' not supported by dump_expr#<expression ↵Richard Guenther1-0/+28
error>') 2010-12-03 Richard Guenther <rguenther@suse.de> PR c/46745 * c-pretty-print.c (pp_c_postfix_expression): Handle MEM_REF. (pp_c_unary_expression): Likewise. (pp_c_expression): Likewise. cp/ * error.c (dump_expr): Handle MEM_REF. From-SVN: r167433
2010-11-30diagnostic-core.h: Include bversion.h.Joseph Myers1-1/+0
* diagnostic-core.h: Include bversion.h. * toplev.h: Don't include input.h or bversion.h. (parse_optimize_options): Don't declare here. * alias.c, auto-inc-dec.c, c-aux-info.c, c-convert.c, c-parser.c, caller-save.c, cfg.c, cfganal.c, cfgbuild.c, cfgcleanup.c, combine-stack-adj.c, config/arm/pe.c, config/darwin-c.c, config/host-darwin.c, config/i386/host-cygwin.c, config/i386/host-mingw32.c, config/i386/msformat-c.c, config/i386/netware.c, config/i386/nwld.c, config/i386/winnt-cxx.c, config/i386/winnt-stubs.c, config/ia64/ia64-c.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/microblaze/microblaze-c.c, config/rs6000/host-darwin.c, config/rs6000/rs6000-c.c, config/score/score3.c, config/score/score7.c, config/sh/symbian-base.c, config/sh/symbian-c.c, config/sh/symbian-cxx.c, config/sol2-c.c, config/sol2.c, config/v850/v850-c.c, config/vxworks.c, convert.c, cppbuiltin.c, cselib.c, dbgcnt.c, ddg.c, dfp.c, dominance.c, emit-rtl.c, fixed-value.c, fwprop.c, ggc-common.c, gimple.c, gimplify.c, graphite-blocking.c, graphite-clast-to-gimple.c, graphite-dependences.c, graphite-flattening.c, graphite-interchange.c, graphite-poly.c, graphite-scop-detection.c, graphite.c, haifa-sched.c, implicit-zee.c, integrate.c, ipa-pure-const.c, ipa-reference.c, ira-build.c, ira-conflicts.c, ira-costs.c, ira-lives.c, jump.c, lists.c, loop-doloop.c, loop-iv.c, lto-cgraph.c, lto-compress.c, lto-opts.c, lto-section-in.c, lto-section-out.c, lto-streamer-out.c, lto-symtab.c, modulo-sched.c, optabs.c, params.c, postreload-gcse.c, postreload.c, predict.c, profile.c, regcprop.c, reginfo.c, regmove.c, reorg.c, resource.c, sched-deps.c, sched-ebb.c, sched-rgn.c, sdbout.c, sel-sched-dump.c, sel-sched-ir.c, sese.c, stmt.c, targhooks.c, tree-cfgcleanup.c, tree-mudflap.c, tree-nomudflap.c, tree-object-size.c, tree-outof-ssa.c, tree-phinodes.c, tree-profile.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-live.c, tree-ssa-loop-prefetch.c, tree-ssa-loop.c, tree-ssa-operands.c, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-vect-patterns.c, value-prof.c, var-tracking.c, web.c: Don't include toplev.h. * Makefile.in (TOPLEV_H): Remove. All uses changed to use toplev.h. Dependencies for above files and c-family files changed to remove $(TOPLEV_H) or toplev.h. (C_TREE_H): Don't include $(TOPLEV_H). (DIAGNOSTIC_CORE_H): Use $(INPUT_H) instead of input.h. Add bversion.h. * config/arm/t-pe, config/arm/t-wince-pe, config/i386/t-cygming, config/ia64/t-ia64, config/mep/t-mep, config/score/t-score-elf, config/t-darwin, config/t-sol2, config/t-vxworks, config/v850/t-v850, config/v850/t-v850e: Dependencies for above files changed to remove $(TOPLEV_H) or toplev.h. c-family: * c-common.h (parse_optimize_options): Declare. * c-cppbuiltin.c, c-format.c, c-gimplify.c, c-lex.c, c-omp.c, c-pch.c, c-pragma.c, c-semantics.c: Don't include toplev.h. cp: * cp-gimplify.c, cp-lang.c, cvt.c, cxx-pretty-print.c, error.c, except.c, expr.c, friend.c, init.c, mangle.c, name-lookup.c, optimize.c, parser.c, rtti.c, tree.c, typeck2.c: Don't include toplev.h. * Make-lang.in: Dependencies for above files changed to remove toplev.h. java: * expr.c, lang.c, mangle.c, mangle_name.c, typeck.c, verify-glue.c: Don't include toplev.h. * Make-lang.in: Dependencies for above files changed to remove toplev.h. lto: * Make-lang.in (lto/lto-object.o): Depend on toplev.h instead of $(TOPLEV_H). From-SVN: r167293
2010-11-24revert accidentally committed changesNathan Froyd1-1/+0
From-SVN: r167130
2010-11-24cppbuiltin.c (define_builtin_macros_for_type_sizes): Define ↵Nathan Froyd1-0/+1
__FLOAT_WORD_ORDER__ according to FLOAT_WORDS_BIG_ENDIAN. gcc/ * cppbuiltin.c (define_builtin_macros_for_type_sizes): Define __FLOAT_WORD_ORDER__ according to FLOAT_WORDS_BIG_ENDIAN. * config/dfp-bit.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete. * doc/cpp.texi (__FLOAT_WORD_ORDER__): Document. * system.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Poison. libgcc/ * config/libbid/bid_conf.h (BID_BIG_ENDIAN): Define in terms of __FLOAT_WORD_ORDER__. * config/libbid/bid_gcc_intrinsics.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete. libdecnumber/ * dconfig.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete. (WORDS_BIG_ENDIAN): Define based on value of __FLOAT_WORD_ORDER__. From-SVN: r167129
2010-11-08Correct conversion/overflow behavior.Jason Merrill1-1/+3
* cvt.c (ignore_overflows): Move here from typeck.c. (ocp_convert): Use it. (cp_fold_convert): Use it. Don't call rvalue. * typeck.c (build_static_cast_1): Don't use it. Do call rvalue. * error.c (location_of): Handle expressions, too. * class.c (check_bitfield_decl): Set input_location around call to cxx_constant_value. * semantics.c (cxx_eval_outermost_constant_expr): Don't print the expression if it already had TREE_OVERFLOW set. (reduced_constant_expression_p): Check TREE_OVERFLOW_P for C++98, too. (verify_constant): Allow overflow with a permerror if we're enforcing. (cxx_eval_outermost_constant_expr): Use verify_constant. (adjust_temp_type): Use cp_fold_convert. * decl.c (build_enumerator): Don't call constant_expression_warning. * decl2.c (grokbitfield): Likewise. From-SVN: r166453
2010-11-01semantics.c (call_stack, [...]): New.Jason Merrill1-0/+27
* semantics.c (call_stack, call_stack_tick, cx_error_context): New. (last_cx_error_tick, push_cx_call_context, pop_cx_call_context): New. (cxx_eval_call_expression): Call push/pop_cx_call_context instead of giving follow-on errors. * error.c (maybe_print_constexpr_context): New. (cp_diagnostic_starter): Call it. * cp-tree.h: Declare cx_error_context. From-SVN: r166169
2010-10-27* error.c (dump_simple_decl): Print constexpr.Jason Merrill1-6/+13
From-SVN: r166010
2010-10-24In gcc/cp/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-0/+12
In gcc/cp/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> Removed Objective-C++ specific replacement of cxx_printable_name. * cp-objcp-common.h: Added LANG_HOOKS_DECL_PRINTABLE_NAME, set to cxx_printable_name for both C++ and Objective-C++. * cp-lang.h: Removed LANG_HOOKS_DECL_PRINTABLE_NAME. * error.c (dump_decl): For Objective-C++, call objc_maybe_printable_name here ... * tree.c (cxx_printable_name_internal): ... instead of here. In gcc/objcp/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> * objcp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Do not define. In gcc/objc/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_build_keyword_decl): Updated comments. Do not emit a warning that method parameter attributes are unimplemented. Instead, store them into DECL_ATTRIBUTES of the KEYWORD_DECL. (start_method_def): Copy attributes from each KEYWORD_DECL into the corresponding PARM_DECL. (objc_warn_deprecated_use): Removed. (build_objc_method_call): Call warn_deprecated_use, not objc_warn_deprecated_use. (objc_maybe_printable_name): Do not try to get the identifier name of DECLs that we don't recognize. Immediately return NULL for them. (objc_printable_name): Removed C++-specific case, which is no longer used. Updated comments. In gcc/testsuite/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/attributes/method-attribute-2.m: Updated test. Method parameter attributes are now supported. * obj-c++.dg/attributes/method-attribute-2.m: Same change. * objc.dg/attributes/parameter-attribute-1.m: New test. * objc.dg/attributes/parameter-attribute-2.m: New test. * obj-c++.dg/attributes/parameter-attribute-1.m: New test. * obj-c++.dg/attributes/parameter-attribute-2.m: New test. From-SVN: r165896
2010-10-14re PR c++/44561 (using nullptr_t with -flto/-fwhopr causes ICE: tree code ↵Richard Guenther1-0/+6
'lang_type' is not supported in gimple streams) 2010-10-14 Richard Guenther <rguenther@suse.de> PR lto/44561 * tree.def (NULLPTR_TYPE): New tree code. * dbxout.c (dbxout_type): Handle NULLPTR_TYPE. * dwarf2out.c (is_base_type): Likewise. (gen_type_die_with_usage): Likewise. * sdbout.c (plain_type_1): Likewise. * tree.c (build_int_cst_wide): Likewise. * gimple.c (gimple_types_compatible_p_1): NULLPTR_TYPE types are equal. cp/ * cp-tree.h (NULLPTR_TYPE_P): Adjust. * decl.c (cxx_init_decl_processing): Build a NULLPTR_TYPE node, use build_int_cst. * error.c (dump_type): Handle NULLPTR_TYPE. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. * mangle.c (write_type): Likewise. * name-lookup.c (arg_assoc_type): Likewise. * rtti.c (typeinfo_in_lib_p): Likewise. * pt.c (tsubst): Likewise. * g++.dg/lto/20101010-3_0.C: New testcase. * g++.dg/lto/20101010-4_0.C: Likewise. From-SVN: r165462
2010-10-07In gcc/testsuite/: 2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-0/+8
In gcc/testsuite/: 2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com> * obj-c++.dg/encode-10.mm: New testcase. In gcc/cp/: 2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com> * cp-tree.def: Changed type of AT_ENCODE_EXPR from tcc_unary to tcc_expression. * cxx-pretty-print.c (pp_cxx_unary_expression): Added case for AT_ENCODE_EXPR. * error.c (dump_expr): Added case for AT_ENCODE_EXPR. * pt.c (tsubst_copy): Added case for AT_ENCODE_EXPR. (value_dependent_expression_p): Added case for AT_ENCODE_EXPR. (type_dependent_expression_p): Added case for AT_ENCODE_EXPR. * parser.c (cp_parser_objc_encode_expression): Updated comment. From-SVN: r165138
2010-09-24error.c (dump_expr): Print conversion between reference and pointer to the ↵Jason Merrill1-2/+15
same type as "*" or "&". * error.c (dump_expr) [CASE_CONVERT]: Print conversion between reference and pointer to the same type as "*" or "&". From-SVN: r164597
2010-09-10re PR c++/43824 (C++0x feature "inline namespace" enabled under -std=c++98; ↵Rodrigo Rivas Costa1-0/+5
no warnings) PR c++/43824 * error.c (maybe_warn_cpp0x): Add new warning CPP0X_INLINE_NAMESPACES. * parser.c (cp_parser_namespace_definition): Likewise. * cp-tree.h (cpp0x_warn_str): Likewise. From-SVN: r164201
2010-08-20vec.h (FOR_EACH_VEC_ELT): Define.Nathan Froyd1-1/+1
gcc/ * vec.h (FOR_EACH_VEC_ELT): Define. * c-decl.c: Use it. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/bfin/bfin.c: Likewise. * config/mips/mips.c: Likewise. * config/rs6000/rs6000.c: Likewise. * dbxout.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * dse.c: Likewise. * dwarf2out.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * ggc-common.c: Likewise. * gimplify.c: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * implicit-zee.c: Likewise. * ipa-prop.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * lambda-code.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-opts.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-symtab.c: Likewise. * matrix-reorg.c: Likewise. * opts.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-data-ref.c: Likewise. * tree-emutls.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * vmsdbgout.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Use FOR_EACH_VEC_ELT. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. gcc/c-family/ * c-common.c: Use FOR_EACH_VEC_ELT. * c-gimplify.c: Likewise. * c-pragma.c: Likewise. gcc/cp/ * call.c: Use FOR_EACH_VEC_ELT. * class.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * error.c: Likewise. * except.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * repo.c: Likewise. * semantics.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * trans-openmp.c: Use FOR_EACH_VEC_ELT. gcc/java/ * class.c: Use FOR_EACH_VEC_ELT. * expr.c: Likewise. * jcf-parse.c: Likewise. * resource.c: Likewise. gcc/lto/ * lto.c: Use FOR_EACH_VEC_ELT. From-SVN: r163401
2010-07-06* error.c (dump_function_decl): Don't crash on null DECL_NAME.Jason Merrill1-1/+1
From-SVN: r161878
2010-06-22re PR c++/44627 (ICE in dump_expr, at cp/error.c:1735)Jakub Jelinek1-1/+3
PR c++/44627 * error.c (dump_expr): Don't look at CALL_EXPR_ARG (t, 0) if the CALL_EXPR has no arguments. * g++.dg/diagnostic/method1.C: New test. From-SVN: r161227
2010-06-17re PR c++/44486 (missing space in __PRETTY_FUNCTION__ expansion in anonymous ↵Manuel López-Ibáñez1-1/+1
namespace) 2010-06-17 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/44486 cp/ * error.c (dump_decl): Better wording for anonymous namespace. testsuite/ * g++.dg/pr44486.C: New. From-SVN: r160877