- 11 Feb, 2019 1 commit
-
-
gcc/ChangeLog: PR c++/87996 * builtins.c (max_object_size): Move from here... * builtins.h (max_object_size): ...and here... * tree.c (max_object_size): ...to here... * tree.h (max_object_size): ...and here. gcc/c-family/ChangeLog: PR c++/87996 * c-common.c (invalid_array_size_error): New function. (valid_array_size_p): Call it. Handle size as well as type. * c-common.h (valid_constant_size_p): New function. (enum cst_size_error): New type. gcc/cp/ChangeLog: PR c++/87996 * decl.c (compute_array_index_type_loc): Preserve signed sizes for diagnostics. Call valid_array_size_p instead of error. * init.c (build_new_1): Compute size for diagnostic. Call invalid_array_size_error (build_new): Call valid_array_size_p instead of error. gcc/testsuite/ChangeLog: PR c++/87996 * c-c++-common/array-5.c: New test. * c-c++-common/pr68107.c: Adjust text of diagnostics. * g++.dg/init/new38.C: Same. * g++.dg/init/new43.C: Same. * g++.dg/init/new44.C: Same. * g++.dg/init/new46.C: Same. * g++.dg/other/large-size-array.C: Same. * g++.dg/other/new-size-type.C: Same. * g++.dg/template/array30.C: Same. * g++.dg/template/array32.C: New test. * g++.dg/template/dependent-name3.C: Adjust. * gcc.dg/large-size-array-3.c: Same. * gcc.dg/large-size-array-5.c: Same. * gcc.dg/large-size-array.c: Same. * g++.old-deja/g++.brendan/array1.C: Same. * g++.old-deja/g++.mike/p6149.C: Same. From-SVN: r268774
Martin Sebor committed
-
- 31 Jan, 2019 1 commit
-
-
* constexpr.c (adjust_temp_type): Use copy_node and change the type instead of using build_constructor. * decl.c (reshape_init_r): Don't reshape a digested initializer. Return the initializer for COMPOUND_LITERAL_P. * g++.dg/cpp0x/initlist107.C: New test. * g++.dg/cpp0x/initlist108.C: New test. * g++.dg/cpp0x/initlist109.C: New test. * g++.dg/cpp0x/initlist110.C: New test. * g++.dg/cpp0x/initlist111.C: New test. * g++.dg/cpp0x/initlist112.C: New test. * g++.dg/init/ptrfn4.C: New test. From-SVN: r268428
Marek Polacek committed
-
- 17 Jan, 2019 1 commit
-
-
/cp 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokdeclarator): Use typespec_loc in error messages about 'auto' and trailing return type. /testsuite 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/cpp0x/auto52.C: Test locations too. * g++.dg/cpp0x/trailing2.C: Likewise. * g++.dg/cpp1y/auto-fn18.C: Likewise. * g++.dg/cpp1y/auto-fn25.C: Likewise. * g++.dg/cpp1y/auto-fn52.C: Likewise. * g++.dg/cpp1y/auto-fn53.C: Likewise. * g++.dg/cpp1y/auto-fn54.C: Likewise. From-SVN: r268043
Paolo Carlini committed
-
- 16 Jan, 2019 1 commit
-
-
decl.c (grokdeclarator): Use locations[ds_storage_class] in error messages about ill-formed uses of mutable. /cp 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokdeclarator): Use locations[ds_storage_class] in error messages about ill-formed uses of mutable. /testsuite 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/other/pr33558.C: Test location too. * g++.dg/other/pr33558-2.C: Likewise. * g++.dg/parse/crash4.C: Likewise. * g++.old-deja/g++.brendan/err-msg11.C: Likewise. * g++.old-deja/g++.mike/p7635.C: Likewise. * g++.old-deja/g++.other/decl6.C: Likewise. From-SVN: r267978
Paolo Carlini committed
-
- 15 Jan, 2019 1 commit
-
-
/cp 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (start_decl): Improve error location. * decl2.c (grokfield): Likewise. /testsuite 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/typedef-initialized.C: New. /cp 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokdeclarator): Move further up the location_t loc declaration and use the location when building a TYPE_DECL for a typedef name. * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error about an ill-formed bit-field as typedef. /testsuite 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/bitfld3.C: New. From-SVN: r267932
Paolo Carlini committed
-
- 14 Jan, 2019 1 commit
-
-
gcc/cp/ * cvt.c (type_promotes_to): Handle char8_t promotion. * decl.c (grokdeclarator): Handle invalid type specifier combinations involving char8_t. * lex.c (init_reswords): Add char8_t as a reserved word. * mangle.c (write_builtin_type): Add name mangling for char8_t (Du). * parser.c (cp_keyword_starts_decl_specifier_p) (cp_parser_simple_type_specifier): Recognize char8_t as a simple type specifier. (cp_parser_string_literal): Use char8_array_type_node for the type of CPP_UTF8STRING. (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system headers. * rtti.c (emit_support_tinfos): type_info support for char8_t. * tree.c (char_type_p): Recognize char8_t as a character type. * typeck.c (string_conv_p): Handle conversions of u8 string literals of char8_t type. (check_literal_operator_args): Handle UDLs with u8 string literals of char8_t type. * typeck2.c (ordinary_char_type_p): New. (digest_init_r): Disallow initializing a char array with a u8 string literal. gcc/c-family/ * c-common.c (c_common_reswords): Add char8_t. (fix_string_type): Use char8_t for the type of u8 string literals. (c_common_get_alias_set): char8_t doesn't alias. (c_common_nodes_and_builtins): Define char8_t as a builtin type in C++. (c_stddef_cpp_builtins): Add __CHAR8_TYPE__. (keyword_begins_type_specifier): Add RID_CHAR8. * c-common.h (rid): Add RID_CHAR8. (c_tree_index): Add CTI_CHAR8_TYPE and CTI_CHAR8_ARRAY_TYPE. Define D_CXX_CHAR8_T and D_CXX_CHAR8_T_FLAGS. Define char8_type_node and char8_array_type_node. * c-cppbuiltin.c (cpp_atomic_builtins): Predefine __GCC_ATOMIC_CHAR8_T_LOCK_FREE. (c_cpp_builtins): Predefine __cpp_char8_t. * c-lex.c (lex_string): Use char8_array_type_node as the type of CPP_UTF8STRING. (lex_charconst): Use char8_type_node as the type of CPP_UTF8CHAR. * c-opts.c: If not otherwise specified, enable -fchar8_t when targeting C++2a. * c.opt: Add the -fchar8_t command line option. libiberty/ * cp-demangle.c (cplus_demangle_builtin_types) (cplus_demangle_type): Add name demangling for char8_t (Du). * cp-demangle.h: Increase D_BUILTIN_TYPE_COUNT to accommodate the new char8_t type. From-SVN: r267923
Tom Honermann committed
-
- 12 Jan, 2019 1 commit
-
-
/cp 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (cp_finish_decl): Improve error location. * decl2.c (grokfield): Likewise, improve two locations. /testsuite 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/cpp0x/pr62101.C: Test locations too. * g++.dg/inherit/pure1.C: Likewise. From-SVN: r267887
Paolo Carlini committed
-
- 11 Jan, 2019 1 commit
-
-
/cp 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (start_decl): Improve error location. (grokdeclarator): Likewise, improve two locations. /testsuite 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/extern-initialized.C: New. * g++.dg/ext/dllimport-initialized.C: Likewise. From-SVN: r267830
Paolo Carlini committed
-
- 09 Jan, 2019 1 commit
-
-
/cp 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grok_reference_init): Improve error location. (grokdeclarator): Likewise, improve two locations. /testsuite 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/constexpr2.C: New. * g++.dg/diagnostic/ref3.C: Likewise. From-SVN: r267756
Paolo Carlini committed
-
- 08 Jan, 2019 2 commits
-
-
/cp 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (start_decl): Improve permerror location. /testsuite 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/out-of-class-redeclaration.C: New. From-SVN: r267675
Paolo Carlini committed -
PR c++/88554 * decl.c (finish_function): For -Wreturn-type don't add a return *this; fixit hint if current_class_ref is NULL. Use a single if instead of two nested ones. * g++.dg/warn/Wreturn-type-11.C: New test. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r267672
Jonathan Wakely committed
-
- 07 Jan, 2019 2 commits
-
-
/cp 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (start_decl): Improve two error_at locations. (expand_static_init): Likewise. /testsuite 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/constexpr1.C: New. * g++.dg/diagnostic/thread1.C: Likewise. From-SVN: r267662
Paolo Carlini committed -
* decl.c (cp_complete_array_type): Strip any location wrappers. * g++.dg/init/array50.C: New test. From-SVN: r267656
Marek Polacek committed
-
- 03 Jan, 2019 1 commit
-
-
PR c++/88636 * decl.c (builtin_function_1): Return result of pushdecl_top_level or pushdecl rather than decl. * g++.target/i386/pr88636.C: New test. From-SVN: r267548
Jakub Jelinek committed
-
- 01 Jan, 2019 1 commit
-
-
From-SVN: r267494
Jakub Jelinek committed
-
- 19 Dec, 2018 1 commit
-
-
This is v6 of the patch, as posted to: https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01331.html The C++ frontend gained various location wrapper nodes in r256448 (GCC 8). That patch: https://gcc.gnu.org/ml/gcc-patches/2018-01/msg00799.html added wrapper nodes around all nodes with !CAN_HAVE_LOCATION_P for: * arguments at callsites, and for * typeid, alignof, sizeof, and offsetof. This is a followup to that patch, adding many more location wrappers to the C++ frontend. It adds location wrappers for nodes with !CAN_HAVE_LOCATION_P to: * all literal nodes (in cp_parser_primary_expression) * all id-expression nodes (in finish_id_expression), except within a decltype. * all mem-initializer nodes within a mem-initializer-list (in cp_parser_mem_initializer) However, the patch also adds some suppressions: regions in the parser for which wrapper nodes will not be created: * within a template-parameter-list or template-argument-list (in cp_parser_template_parameter_list and cp_parser_template_argument_list respectively), to avoid encoding the spelling location of the nodes in types. For example, "array<10>" and "array<10>" are the same type, despite the fact that the two different "10" tokens are spelled in different locations in the source. * within a gnu-style attribute (none of are handlers are set up to cope with location wrappers yet) * within various OpenMP clauses The patch enables various improvements to locations for bad initializations, for -Wchar-subscripts, and enables various other improvements in the followup patch. For example, given the followup buggy mem-initializer: class X { X() : bad(42), good(42) { } void* bad; int good; }; previously, our diagnostic was on the final close parenthesis of the mem-initializer-list, leaving it unclear where the problem is: t.cc: In constructor 'X::X()': t.cc:3:16: error: invalid conversion from 'int' to 'void*' [-fpermissive] 3 | good(42) | ^ | | | int whereas with the patch we highlight which expression is bogus: t.cc: In constructor 'X::X()': t.cc:2:13: error: invalid conversion from 'int' to 'void*' [-fpermissive] 2 | X() : bad(42), | ^~ | | | int Similarly, the diagnostic for this bogus initialization: i.cc:1:44: error: initializer-string for array of chars is too long [-fpermissive] 1 | char test[3][4] = { "ok", "too long", "ok" }; | ^ is improved by the patch so that it indicates which string is too long: i.cc:1:27: error: initializer-string for array of chars is too long [-fpermissive] 1 | char test[3][4] = { "ok", "too long", "ok" }; | ^~~~~~~~~~ gcc/c-family/ChangeLog: PR c++/43064 PR c++/43486 * c-common.c (unsafe_conversion_p): Fold any location wrapper. (verify_tree): Handle location wrappers. (c_common_truthvalue_conversion): Strip any location wrapper. Handle CONST_DECL. (fold_offsetof): Strip any location wrapper. (complete_array_type): Likewise for initial_value. (convert_vector_to_array_for_subscript): Call fold_for_warn on the index before checking for INTEGER_CST. * c-pretty-print.c (c_pretty_printer::primary_expression): Don't print parentheses around location wrappers. * c-warn.c (warn_logical_operator): Call fold_for_warn on op_right before checking for INTEGER_CST. (warn_tautological_bitwise_comparison): Call tree_strip_any_location_wrapper on lhs, rhs, and bitop's operand before checking for INTEGER_CST. (readonly_error): Strip any location wrapper. (warn_array_subscript_with_type_char): Strip location wrappers before checking for INTEGER_CST. Use the location of the index if available. gcc/ChangeLog: PR c++/43064 PR c++/43486 * convert.c: Include "selftest.h". (preserve_any_location_wrapper): New function. (convert_to_pointer_maybe_fold): Update to handle location wrappers. (convert_to_real_maybe_fold): Likewise. (convert_to_integer_1): Strip expr when using TREE_OVERFLOW. Handle location wrappers when checking for INTEGER_CST. (convert_to_integer_maybe_fold): Update to handle location wrappers. (convert_to_complex_maybe_fold): Likewise. (selftest::test_convert_to_integer_maybe_fold): New functions. (selftest::convert_c_tests): New function. * convert.h (preserve_any_location_wrapper): New decl. * fold-const.c (size_binop_loc): Strip location wrappers when using TREE_OVERFLOW. (operand_equal_p): Strip any location wrappers. (integer_valued_real_p): Strip any location wrapper. * selftest-run-tests.c (selftest::run_tests): Call selftest::convert_c_tests. * selftest.h (selftest::convert_c_tests): New decl. * tree.c (build_complex): Assert that REAL and IMAG are constants. (integer_zerop): Look through location wrappers. (integer_onep): Likewise. (integer_each_onep): Likewise. (integer_all_onesp): Likewise. (integer_minus_onep): Likewise. (integer_pow2p): Likewise. (integer_nonzerop): Likewise. (integer_truep): Likewise. (fixed_zerop): Likewise. (real_zerop): Likewise. (real_onep): Likewise. (real_minus_onep): Likewise. (tree_int_cst_equal): Likewise. (simple_cst_equal): Treat location wrappers with non-equal source locations as being unequal. (uniform_integer_cst_p): Look through location wrappers. (maybe_wrap_with_location): Don't create wrappers if any auto_suppress_location_wrappers are active. (suppress_location_wrappers): New variable. (selftest::test_predicates): New test. (selftest::tree_c_tests): Call it. * tree.h (CONSTANT_CLASS_OR_WRAPPER_P): New macro. (suppress_location_wrappers): New decl. (class auto_suppress_location_wrappers): New class. gcc/cp/ChangeLog: PR c++/43064 PR c++/43486 * call.c (build_conditional_expr_1): Strip location wrappers when checking for CONST_DECL. (conversion_null_warnings): Use location of "expr" if available. * class.c (fixed_type_or_null): Handle location wrappers. * constexpr.c (potential_constant_expression_1): Likewise. * cvt.c (ignore_overflows): Strip location wrappers when checking for INTEGER_CST, and re-wrap the result if present. (ocp_convert): Call fold_for_warn before checking for INTEGER_CST. * decl.c (reshape_init_r): Strip any location wrapper. (undeduced_auto_decl): Likewise. * expr.c (mark_discarded_use): Likewise for expr. * init.c (build_aggr_init): Likewise before checking init for DECL_P. (warn_placement_new_too_small): Call fold_for_warn on adj before checking for CONSTANT_CLASS_P, and on nelts. Strip any location wrapper from op0 and on oper before checking for VAR_P. * parser.c (cp_parser_primary_expression): Call maybe_add_location_wrapper on numeric and string literals. (cp_parser_postfix_expression): Strip any location wrapper when checking for DECL_IS_BUILTIN_CONSTANT_P. (cp_parser_unary_expression): Ensure that folding of NEGATE_EXPR around a constant happens in the presence of location wrappers and returns a wrapped result. (cp_parser_has_attribute_expression): Strip any location wrapper from "oper". (cp_parser_binary_expression): Strip any location wrapper when checking for DECL_P on the lhs. (cp_parser_decltype): Strip any location wrapper from result of cp_parser_decltype_expr. (cp_parser_mem_initializer): Add location wrappers to the parenthesized expression list. (cp_parser_template_parameter_list): Don't create wrapper nodes within a template-parameter-list. (cp_parser_template_argument_list): Don't create wrapper nodes within a template-argument-list. (cp_parser_parameter_declaration): Strip location wrappers from default arguments. (cp_parser_gnu_attribute_list): Don't create wrapper nodes. (cp_parser_std_attribute_spec_seq): Likewise. (cp_parser_omp_all_clauses): Don't create wrapper nodes within OpenMP clauses. (cp_parser_omp_for_loop): Likewise. (cp_parser_omp_declare_reduction_exprs): Likewise. * pt.c (convert_nontype_argument_function): Strip location wrappers from fn_no_ptr before checking for FUNCTION_DECL. (tsubst_default_argument): Move note about which callsite led to instantiation to after the check_default_argument call. (do_auto_deduction): Likewise from init before checking for DECL_P. * semantics.c (force_paren_expr): Likewise from expr before checking for DECL_P. (finish_parenthesized_expr): Likewise from expr before checking for STRING_CST. (perform_koenig_lookup): Likewise from fn. (finish_call_expr): Likewise. (finish_id_expression): Rename to... (finish_id_expression_1): ...this, calling maybe_add_location_wrapper on the result. (capture_decltype): Use lookup_name_real rather than value_member when looking up decl within the capture-list. * tree.c (cp_stabilize_reference): Strip any location wrapper. (builtin_valid_in_constant_expr_p): Likewise. (strip_typedefs_expr): Strip any location wrapper before checking for decls or constants. (is_overloaded_fn): Likewise. (maybe_get_fns): Likewise. (selftest::test_lvalue_kind): Verify lvalue_p. * typeck.c (cxx_sizeof_expr): Strip any location wrapper. (cxx_alignof_expr): Likewise. (is_bitfield_expr_with_lowered_type): Handle location wrappers. (cp_build_array_ref): Call maybe_constant_value on "idx". (cp_build_binary_op): Strip location wrapper from first_arg before checking for PARM_DECL. Likewise for op1 before checking for INTEGER_CST in two places. Likewise for orig_op0 and orig_op1 when checking for STRING_CST. (cp_build_addr_expr_1): Likewise for arg when checking for FUNCTION_DECL. (cp_build_modify_expr): Likewise for newrhs when checking for STRING_CST. (convert_for_assignment): Don't strip location wrappers when stripping NON_LVALUE_EXPR. (maybe_warn_about_returning_address_of_local): Strip location wrapper from whats_returned before checking for DECL_P. (can_do_nrvo_p): Strip location wrapper from retval. (treat_lvalue_as_rvalue_p): Likewise. (check_return_expr): Likewise. * typeck2.c (cxx_incomplete_type_diagnostic): Strip location wrapper from value before checking for VAR_P or PARM_DECL. (digest_init_r): Strip location wrapper from init. When copying "init", also copy the wrapped node. gcc/objc/ChangeLog: PR c++/43064 PR c++/43486 * objc-act.c (objc_maybe_build_component_ref): Strip any location wrapper before checking for UOBJC_SUPER_decl and self_decl. (objc_finish_message_expr): Strip any location wrapper. (gen_declaration): Strip location wrappers from "w". gcc/testsuite/ChangeLog: PR c++/43064 PR c++/43486 * c-c++-common/pr51712.c (valid2): Mark xfail as passing on C++. * g++.dg/cpp0x/constexpr-47969.C: Update column of expected error. * g++.dg/cpp0x/constexpr-ex2.C: Likewise. * g++.dg/cpp0x/scoped_enum2.C: Likewise. * g++.dg/cpp1z/decomp48.C: Update expected location of warning for named local variables to use that of the local variable. * g++.dg/ext/vla1.C: Update column. * g++.dg/init/array43.C: Update expected column to be that of the initializer. * g++.dg/init/initializer-string-too-long.C: New test. * g++.dg/init/new44.C: Add "-ftrack-macro-expansion=0". * g++.dg/init/pr43064-1.C: New test. * g++.dg/init/pr43064-2.C: New test. * g++.dg/init/pr43064-3.C: New test. * g++.dg/other/fold1.C: Update column of expected error. * g++.dg/parse/crash36.C: Likewise. * g++.dg/plugin/diagnostic-test-expressions-1.C: Add negative integer and float expressions. * g++.dg/template/defarg6.C: Move expected error to the default argument; add expected message about where instantiated. * g++.dg/wrappers/Wparentheses.C: New test. * g++.old-deja/g++.bugs/900402_02.C: Update column of expected error. From-SVN: r267272
David Malcolm committed
-
- 15 Dec, 2018 1 commit
-
-
/cp 2018-12-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84644 * decl.c (check_tag_decl): A decltype with no declarator doesn't declare anything. /testsuite 2018-12-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84644 * g++.dg/cpp0x/decltype68.C: New. * g++.dg/cpp0x/decltype-33838.C: Adjust. * g++.dg/template/spec32.C: Likewise. * g++.dg/template/ttp22.C: Likewise. From-SVN: r267165
Paolo Carlini committed
-
- 12 Dec, 2018 2 commits
-
-
/cp 2018-12-12 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokdeclarator): Fix location of error message about static data member definition. /testsuite 2018-12-12 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/other/static5.C: New. From-SVN: r267066
Paolo Carlini committed -
PR c++/88446 * cp-tree.h (maybe_constant_value): Add manifestly_const_eval argument. * constexpr.c (struct constexpr_call): Rename pretend_const_required member to manifestly_const_eval. (struct constexpr_ctx): Likewise. (constexpr_call_hasher::equal): Adjust users. (cxx_eval_builtin_function_call): Likewise. Formatting fix. (cxx_eval_call_expression): Adjust users. (cxx_eval_outermost_constant_expr, maybe_constant_init_1, maybe_constant_init): Rename pretend_const_required argument to manifestly_const_eval, adjust function comments. (maybe_constant_value): Add manifestly_const_eval argument. If true, don't cache and call cxx_eval_outermost_constant_expr with true as manifestly_const_eval. * decl.c (compute_array_index_type_loc): Call maybe_constant_value with true as manifestly_const_eval. * g++.dg/cpp2a/is-constant-evaluated3.C: New test. From-SVN: r267047
Jakub Jelinek committed
-
- 11 Dec, 2018 1 commit
-
-
decl.c (grokvardecl): Add location_t parameter and use it in build_lang_decl_loc and build_decl calls. /cp 2018-12-11 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokvardecl): Add location_t parameter and use it in build_lang_decl_loc and build_decl calls. (grokdeclarator): Move up loc declaration and use it in the grokvardecl call too. /testsuite 2018-12-11 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/pr53037-4.C: Test the first two locations too. From-SVN: r267029
Paolo Carlini committed
-
- 06 Dec, 2018 1 commit
-
-
/cp 2018-12-06 Paolo Carlini <paolo.carlini@oracle.com> * class.c (check_bitfield_decl): In error message about non-integral type print the type itself too. * decl.c (grokdeclarator): Do not ICE on unnamed bit-fields declared friends; when calling build_decl for a FIELD_DECL possibly pass the declarator->id_loc. /testsuite 2018-12-06 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/parse/bitfield7.C: New. * g++.dg/other/bitfield2.C: Check location and type. * g++.dg/parse/bitfield1.C: Likewise. * g++.dg/parse/bitfield2.C: Likewise. From-SVN: r266876
Paolo Carlini committed
-
- 04 Dec, 2018 1 commit
-
-
/cp 2018-12-04 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84636 * decl.c (grokdeclarator): Avoid crashing on an anonymous bit-field with function type. /testsuite 2018-12-04 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84636 * g++.dg/parse/bitfield6.C: New. From-SVN: r266807
Paolo Carlini committed
-
- 29 Nov, 2018 1 commit
-
-
decl.c (compute_array_index_type_loc): New, like the current compute_array_index_type but takes a location_t too. /cp 2018-11-29 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (compute_array_index_type_loc): New, like the current compute_array_index_type but takes a location_t too. (compute_array_index_type): Forward to the latter. (create_array_type_for_decl): Use compute_array_index_type_loc. /testsuite 2018-11-29 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/cpp0x/constexpr-base6b.C: New. * g++.dg/cpp0x/constexpr-47969.C: Test locations too. * g++.dg/cpp0x/constexpr-48324.C: Likewise. * g++.dg/cpp0x/constexpr-ex2.C: Likewise. * g++.dg/cpp0x/scoped_enum2.C: Likewise. * g++.dg/cpp1y/pr63996.C: Likewise. * g++.dg/ext/constexpr-vla5.C: Likewise. * g++.dg/ext/stmtexpr15.C: Likewise. * g++.dg/ext/vla1.C: Likewise. * g++.dg/other/fold1.C: Likewise. * g++.dg/parse/array-size2.C: Likewise. * g++.dg/parse/crash36.C: Likewise. * g++.dg/ubsan/pr81530.C: Likewise. * g++.dg/warn/Wvla-1.C: Likewise. * g++.dg/warn/Wvla-2.C: Likewise. * g++.old-deja/g++.brendan/array1.C: Likewise. * g++.old-deja/g++.bugs/900402_02.C: Likewise. * g++.old-deja/g++.law/init3.C: Likewise. * g++.old-deja/g++.mike/p6149.C: Likewise. From-SVN: r266645
Paolo Carlini committed
-
- 28 Nov, 2018 1 commit
-
-
* decl.c (grokdeclarator): Check if declarator is null. * g++.dg/ext/flexary31.C: New test. From-SVN: r266581
Marek Polacek committed
-
- 27 Nov, 2018 1 commit
-
-
PR c++/88187 * decl.c (grokdeclarator): Don't diagnose deduction guide errors if !funcdecl_p. * g++.dg/other/pr88187.C: New test. From-SVN: r266537
Jakub Jelinek committed
-
- 16 Nov, 2018 1 commit
-
-
[[likely]] and [[unlikely]] are equivalent to the GNU hot/cold attributes, except that they can be applied to arbitrary statements as well as labels; this is most likely to be useful for marking if/else branches as likely or unlikely. Conveniently, PREDICT_EXPR fits the bill nicely as a representation. I also had to fix marking case labels as hot/cold, which didn't work before. Which then required me to force __attribute ((fallthrough)) to apply to the statement rather than the label. gcc/ * gimplify.c (gimplify_case_label_expr): Handle hot/cold attributes. gcc/c-family/ * c-lex.c (c_common_has_attribute): Handle likely/unlikely. * c-attribs.c (attr_cold_hot_exclusions): Make public. gcc/cp/ * tree.c (handle_likeliness_attribute): New. (std_attribute_table): Add likely/unlikely. * cp-gimplify.c (lookup_hotness_attribute, remove_hotness_attribute) (process_stmt_hotness_attribute, first_stmt): New. (genericize_if_stmt): Check for duplicate predictions. * parser.c (cp_parser_statement): Call process_stmt_hotness_attribute. (cp_parser_label_for_labeled_statement): Apply attributes to case. * decl.c (finish_case_label): Give label in template type void. * pt.c (tsubst_expr) [CASE_LABEL_EXPR]: Copy attributes. [PREDICT_EXPR]: Handle. From-SVN: r266223
Jason Merrill committed
-
- 14 Nov, 2018 1 commit
-
-
/cp 2018-11-14 Paolo Carlini <paolo.carlini@oracle.com> * parser.c (make_id_declarator): Add location_t parameter. (cp_parser_lambda_declarator_opt): Adjust call. (cp_parser_decomposition_declaration): Likewise. (cp_parser_alias_declaration): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_objc_class_ivars): Likewise. * decl.c (grokdeclarator): Use declarator->id_loc in two error messages. /testsuite 2018-11-14 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/cpp0x/nsdmi-union6.C: Test locations too. * g++.dg/cpp0x/nsdmi6.C: Likewise. * g++.dg/ext/flexary4.C: Likewise. * g++.dg/ext/flexary9.C: Likewise. * g++.dg/other/incomplete2.C: Likewise. * g++.dg/parse/friend12.C: Likewise. From-SVN: r266155
Paolo Carlini committed
-
- 13 Nov, 2018 2 commits
-
-
Historically GCC used location_t, while libcpp used source_location. This inconsistency has been annoying me for a while, so this patch removes source_location in favor of location_t throughout (as the latter is shorter). gcc/ChangeLog: * builtins.c: Replace "source_location" with "location_t". * diagnostic-show-locus.c: Likewise. * diagnostic.c: Likewise. * dumpfile.c: Likewise. * gcc-rich-location.h: Likewise. * genmatch.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * input.c: Likewise. * input.h: Likewise. Eliminate the typedef. * omp-expand.c: Likewise. * selftest.h: Likewise. * substring-locations.h (get_source_location_for_substring): Rename to.. (get_location_within_string): ...this. * tree-cfg.c: Replace "source_location" with "location_t". * tree-cfgcleanup.c: Likewise. * tree-diagnostic.c: Likewise. * tree-into-ssa.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa.c: Likewise. * tree-ssa.h: Likewise. * tree-vect-loop-manip.c: Likewise. gcc/c-family/ChangeLog: * c-common.c (c_get_substring_location): Update for renaming of get_source_location_for_substring to get_location_within_string. * c-lex.c: Replace "source_location" with "location_t". * c-opts.c: Likewise. * c-ppoutput.c: Likewise. gcc/c/ChangeLog: * c-decl.c: Replace "source_location" with "location_t". * c-tree.h: Likewise. * c-typeck.c: Likewise. * gimple-parser.c: Likewise. gcc/cp/ChangeLog: * call.c: Replace "source_location" with "location_t". * cp-tree.h: Likewise. * cvt.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * typeck.c: Likewise. gcc/fortran/ChangeLog: * cpp.c: Replace "source_location" with "location_t". * gfortran.h: Likewise. gcc/go/ChangeLog: * go-gcc-diagnostics.cc: Replace "source_location" with "location_t". * go-gcc.cc: Likewise. * go-linemap.cc: Likewise. * go-location.h: Likewise. * gofrontend/README: Likewise. gcc/jit/ChangeLog: * jit-playback.c: Replace "source_location" with "location_t". gcc/testsuite/ChangeLog: * g++.dg/plugin/comment_plugin.c: Replace "source_location" with "location_t". * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise. libcc1/ChangeLog: * libcc1plugin.cc: Replace "source_location" with "location_t". (plugin_context::get_source_location): Rename to... (plugin_context::get_location_t): ...this. * libcp1plugin.cc: Likewise. libcpp/ChangeLog: * charset.c: Replace "source_location" with "location_t". * directives-only.c: Likewise. * directives.c: Likewise. * errors.c: Likewise. * expr.c: Likewise. * files.c: Likewise. * include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to MAX_LOCATION_T. * include/line-map.h: Likewise. * init.c: Likewise. * internal.h: Likewise. * lex.c: Likewise. * line-map.c: Likewise. * location-example.txt: Likewise. * macro.c: Likewise. * pch.c: Likewise. * traditional.c: Likewise. From-SVN: r266085
David Malcolm committed -
A destroying operator delete takes responsibility for calling the destructor for the object it is deleting; this is intended to be useful for sized delete of a class allocated with a trailing buffer, where the compiler can't know the size of the allocation, and so would pass the wrong size to the non-destroying sized operator delete. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_impl_destroying_delete. gcc/cp/ * call.c (std_destroying_delete_t_p, destroying_delete_p): New. (aligned_deallocation_fn_p, usual_deallocation_fn_p): Use destroying_delete_p. (build_op_delete_call): Handle destroying delete. * decl2.c (coerce_delete_type): Handle destroying delete. * init.c (build_delete): Don't call dtor with destroying delete. * optimize.c (build_delete_destructor_body): Likewise. libstdc++-v3/ * libsupc++/new (std::destroying_delete_t): New. From-SVN: r266053
Jason Merrill committed
-
- 02 Nov, 2018 1 commit
-
-
https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00085.html gcc/cp/ * decl.c (duplicate_decls): Refactor checks. gcc/testsuite/ * g++.dg/lookup/crash6.C: Adjust error * g++.dg/parse/crash38.C: Likewise. From-SVN: r265744
Nathan Sidwell committed
-
- 01 Nov, 2018 3 commits
-
-
* decl.c (grokfndecl): Allow FUNCTION_DECL in assert. * lex.c (unqualified_fn_lookup_error): Handle TEMPLATE_ID_EXPR. * parser.c (cp_parser_postfix_expression): Do ADL for a template-name. (cp_parser_template_id): Give errors if parsing the template argument list didn't go well. Allow FUNCTION_DECL in assert. (cp_parser_template_name): Consider a name to refer to a template if it is an unqualified-id followed by a <. Don't return the identifier if the decl is a function and dependent. * pt.c (tsubst_copy) <case OVERLOAD>: Remove assert. * g++.dg/addr_builtin-1.C: Adjust dg-error. * g++.dg/cpp2a/fn-template1.C: New test. * g++.dg/cpp2a/fn-template10.C: New test. * g++.dg/cpp2a/fn-template11.C: New test. * g++.dg/cpp2a/fn-template12.C: New test. * g++.dg/cpp2a/fn-template13.C: New test. * g++.dg/cpp2a/fn-template14.C: New test. * g++.dg/cpp2a/fn-template15.C: New test. * g++.dg/cpp2a/fn-template16.C: New test. * g++.dg/cpp2a/fn-template2.C: New test. * g++.dg/cpp2a/fn-template3.C: New test. * g++.dg/cpp2a/fn-template4.C: New test. * g++.dg/cpp2a/fn-template5.C: New test. * g++.dg/cpp2a/fn-template6.C: New test. * g++.dg/cpp2a/fn-template7.C: New test. * g++.dg/cpp2a/fn-template8.C: New test. * g++.dg/cpp2a/fn-template9.C: New test. * g++.dg/parse/fn-template1.C: New test. * g++.dg/parse/fn-template2.C: New test. * g++.dg/parse/template19.C: Adjust dg-error. * g++.dg/template/pr61745.C: Add target to dg-error. From-SVN: r265734
Marek Polacek committed -
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02076.html * cp-tree.h (struct lang_function): Delete x_local_names field. (struct lang_decl_base): Rename u2sel to spare. (struct lang_decl_min): Remove lang_decl_u2 union. Keep access field. (LANG_DECL_U2_CHECK): Delete. (DECL_DISCRIMINATOR_P): Require function scope. (DECL_DISCRIMINATOR): Adjust. (DECL_DISCRIMINATOR_SET_P): Delete. (DECL_CAPTURED_VARIABLE, DECL_ACCESS, THUnK_VIRTUAL_OFFSET): Adjust. (local_classes): Don't declare. (determine_local_discriminator): Declare. * decl.c (push_local_name): Delete. (local_entities, determina_local_discrminator): New. (duplicate_decls): Copy DECL_ACCESS. Fix formatting. (cp_finish_decl): Use determine_local_discriminator. (save_function_data): Drop x_local_names. (finish_function): Drop local_names. * decl2.c (finish_anon_union): Use determine_local_disciminator. * mangle.c (write_unnamed_type_name): Use discriminator_for_local_entity. (local_class_index): Delete. (discriminator_for_local_entity): Reimplement. (write_local_name): Adjust discriminator code. * name-lookup.c (do_pushtag): Call determine_local_discrimiator. * semantics.c (finish_omp_threadprivate): Drop DECL_DISCRIMINATOR handling. * class.c (local_classes): Delete. (init_class_processing): Don't init it. * g++.dg/abi/anon5.C: New. From-SVN: r265714
Nathan Sidwell committed -
2018-11-01 Martin Liska <mliska@suse.cz> Jason Merrill <jason@redhat.com> PR c++/64266 PR bootstrap/70422 PR ipa/81277 * cp-tree.h (DECL_FNAME_P): New macro. * decl.c (cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P, DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. (cp_finish_decl): * lambda.c (is_capture_proxy): Use DECL_FNAME_P. * pt.c (tsubst_expr): Handle DECL_PRETTY_FUNCTION_P. 2018-11-01 Martin Liska <mliska@suse.cz> Jason Merrill <jason@redhat.com> PR c++/64266 PR bootstrap/70422 PR ipa/81277 * g++.dg/cpp0x/constexpr-__func__2.C: Make it a compilation test. * g++.old-deja/g++.ext/pretty4.C: Remove as the run-time assumptions are not longer valid. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r265711
Martin Liska committed
-
- 30 Oct, 2018 2 commits
-
-
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_explicit_bool. * call.c (add_template_candidate_real): Return if the declaration is explicit and we're only looking for non-converting constructor. * cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit. (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro. (cp_decl_specifier_seq): Add explicit_specifier field. (build_explicit_specifier, store_explicit_specifier): Declare. * decl.c (grokdeclarator): Call store_explicit_specifier. (build_explicit_specifier): New function. * parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>: Parse C++20 explicit(bool). * pt.c (store_explicit_specifier, lookup_explicit_specifier): New. (tsubst_function_decl): Handle explicit(dependent-expr). * g++.dg/cpp2a/explicit1.C: New test. * g++.dg/cpp2a/explicit10.C: New test. * g++.dg/cpp2a/explicit11.C: New test. * g++.dg/cpp2a/explicit12.C: New test. * g++.dg/cpp2a/explicit13.C: New test. * g++.dg/cpp2a/explicit2.C: New test. * g++.dg/cpp2a/explicit3.C: New test. * g++.dg/cpp2a/explicit4.C: New test. * g++.dg/cpp2a/explicit5.C: New test. * g++.dg/cpp2a/explicit6.C: New test. * g++.dg/cpp2a/explicit7.C: New test. * g++.dg/cpp2a/explicit8.C: New test. * g++.dg/cpp2a/explicit9.C: New test. * testsuite/20_util/any/cons/explicit.cc: Adjust dg-error. * testsuite/20_util/pair/cons/explicit_construct.cc: Likewise. * testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise. From-SVN: r265641
Marek Polacek committed -
/cp 2018-10-30 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic about flexible array members. /testsuite 2018-10-30 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/cpp1z/has-unique-obj-representations1.C: Test location too. * g++.dg/ext/flexarray-mangle-2.C: Likewise. * g++.dg/ext/flexarray-mangle.C: Likewise. * g++.dg/ext/flexarray-subst.C: Likewise. * g++.dg/ext/flexary10.C: Likewise. * g++.dg/ext/flexary11.C: Likewise. * g++.dg/ext/flexary14.C: Likewise. * g++.dg/ext/flexary16.C: Likewise. * g++.dg/ext/flexary26.C: Likewise. * g++.dg/ext/flexary27.C: Likewise. * g++.dg/ext/flexary7.C: Likewise. * g++.dg/ext/pr71290.C: Likewise. From-SVN: r265636
Paolo Carlini committed
-
- 29 Oct, 2018 1 commit
-
-
/cp 2018-10-29 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (create_array_type_for_decl): Add location_t parameter and use it. (grokdeclarator): Adjust call. /testsuite 2018-10-29 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/cpp0x/auto24.C: Test location too. * g++.dg/cpp0x/auto3.C: Likewise. * g++.dg/cpp0x/auto42.C: Likewise. * g++.dg/cpp0x/initlist57.C: Likewise. * g++.dg/cpp0x/initlist75.C: Likewise. * g++.dg/cpp0x/initlist80.C: Likewise. * g++.dg/cpp0x/lambda/lambda-ice13.C: Likewise. * g++.old-deja/g++.brendan/array-refs.C: Likewise. * g++.old-deja/g++.bugs/900322_01.C: Likewise. * g++.old-deja/g++.bugs/900519_07.C: Likewise. * g++.old-deja/g++.other/typeck1.C: Likewise. From-SVN: r265608
Paolo Carlini committed
-
- 09 Oct, 2018 1 commit
-
-
/cp 2018-10-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84423 * pt.c (convert_template_argument): Immediately return error_mark_node if the second argument is erroneous. * parser.c (cp_parser_type_id): Add location_t * parameter. (cp_parser_type_id_1): Likewise. (cp_parser_alias_declaration): Adjust cp_parser_type_id call, obtain the location of the type and save it. (cp_parser_template_type_arg): Adjust. (cp_parser_trailing_type_id): Likewise. * decl.c (grokdeclarator): Improve error message for 'auto' in alias declaration. /testsuite 2018-10-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84423 * g++.dg/concepts/pr84423-1.C: New. * g++.dg/concepts/pr84423-2.C: Likewise. * g++.dg/cpp0x/auto39.C: Test location too. * g++.dg/cpp0x/auto9.C: Likewise. * g++.dg/cpp1y/pr60384.C: Likewise. From-SVN: r264996
Paolo Carlini committed
-
- 20 Sep, 2018 1 commit
-
-
* c.opt (Wclass-conversion): New. * decl.c (grok_op_properties): Change a warning from -Wconversion to -Wclass-conversion. Make it print the types. * doc/invoke.texi: Document -Wclass-conversion. * g++.dg/conversion/op4.C: Add dg-warning. * g++.dg/warn/Wclass-conversion1.C: New test. * g++.dg/warn/Wclass-conversion2.C: New test. * g++.dg/warn/Wconversion5.C: Remove file. * g++.dg/warn/conversion-function-1.C: Use -Wno-class-converison. * g++.old-deja/g++.bugs/900215_01.C: Adjust dg-warning. * g++.old-deja/g++.jason/conversion5.C: Likewise. From-SVN: r264438
Marek Polacek committed
-
- 19 Sep, 2018 1 commit
-
-
PR c++/87357 - missing -Wconversion warning * decl.c (grok_op_properties): Remove diagnostic parts mentioning a conversion to a reference to void. Use same_type_ignoring_top_level_qualifiers_p rather than comparing types directly. * g++.dg/warn/Wconversion5.C: New test. From-SVN: r264425
Marek Polacek committed
-
- 18 Sep, 2018 1 commit
-
-
P1064R0 - Allowing Virtual Function Calls in Constant Expressions * call.c (build_over_call): No longer check if we're outside a template function. * class.c (build_vtbl_initializer): Build vtable's constructor with indexes. * constexpr.c (cxx_eval_constant_expression): Don't ignore _vptr's initializer. Handle OBJ_TYPE_REF. (potential_constant_expression_1): Handle OBJ_TYPE_REF. * decl.c (maybe_commonize_var): Bail out for any DECL_ARTIFICIAL. (initialize_artificial_var): Mark the variable as constexpr. (grokdeclarator): Change error to pedwarn. Only warn when pedantic and not C++2a. * gimple-fold.c (gimple_get_virt_method_for_vtable): Adjust assert. * g++.dg/cpp0x/constexpr-virtual5.C: Adjust dg-error. * g++.dg/cpp2a/constexpr-virtual1.C: New test. * g++.dg/cpp2a/constexpr-virtual2.C: New test. * g++.dg/cpp2a/constexpr-virtual3.C: New test. * g++.dg/cpp2a/constexpr-virtual4.C: New test. * g++.dg/cpp2a/constexpr-virtual5.C: New test. * g++.dg/cpp2a/constexpr-virtual6.C: New test. * g++.dg/cpp2a/constexpr-virtual7.C: New test. * g++.dg/cpp2a/constexpr-virtual8.C: New test. * g++.dg/cpp2a/constexpr-virtual9.C: New test. * g++.dg/diagnostic/virtual-constexpr.C: Skip for C++2a. Use -pedantic-errors. Adjust dg-error. From-SVN: r264408
Marek Polacek committed
-