12019-12-30 Marek Polacek <polacek@redhat.com> 2 3 * decl.c (reshape_init_r): Remove assert. 4 52019-12-30 Paolo Carlini <paolo.carlini@oracle.com> 6 7 * decl2.c (delete_sanity): Add location_t parameter and use 8 it throughout. 9 * init.c (build_vec_delete_1): Likewise. 10 (build_delete): Likewise. 11 (build_vec_delete): Likewise. 12 (perform_target_ctor): Adjust call. 13 (perform_member_init): Likewise. 14 (build_vec_init): Likewise. 15 * decl.c (cxx_maybe_build_cleanup): Likewise. 16 * pt.c (tsubst_copy_and_build): Likewise. 17 * parser.c (cp_parser_delete_expression): Likewise, pass the 18 combined_loc. 19 * cp-tree.h: Update declarations. 20 212019-12-29 Marek Polacek <polacek@redhat.com> 22 23 PR c++/88337 - Implement P1327R1: Allow dynamic_cast in constexpr. 24 * constexpr.c (cxx_dynamic_cast_fn_p): New function. 25 (extract_obj_from_addr_offset): New function. 26 (get_component_with_type): New function. 27 (cxx_eval_dynamic_cast_fn): New function. 28 (cxx_eval_call_expression): Call cxx_eval_dynamic_cast_fn for a call 29 to __dynamic_cast. 30 (potential_constant_expression_1): Don't give up on 31 cxx_dynamic_cast_fn_p. 32 * rtti.c (build_dynamic_cast_1): When creating a call to 33 __dynamic_cast, use the location of the original expression. 34 352019-12-26 Jakub Jelinek <jakub@redhat.com> 36 37 PR c++/92438 38 * parser.c (cp_parser_constructor_declarator_p): If open paren 39 is followed by RID_ATTRIBUTE, skip over the attribute tokens and 40 try to parse type specifier. 41 422019-12-23 Richard Sandiford <richard.sandiford@arm.com> 43 44 PR c++/92789 45 * typeck.c (structural_comptypes): Make sure that two vector types 46 agree on gnu_vector_type_p. 47 482019-12-23 Richard Sandiford <richard.sandiford@arm.com> 49 50 * cvt.c (ocp_convert): Apply rvalue to the source of vector 51 conversions. 52 * typeck.c (build_reinterpret_cast_1): Likewise. 53 542019-12-19 Marek Polacek <polacek@redhat.com> 55 56 PR c++/92745 - bogus error when initializing array of vectors. 57 * decl.c (reshape_init_r): For a nested compound literal, do 58 call reshape_init_{class,array,vector}. 59 60 PR c++/92974 - bogus location for enum and non-enum in ?: warning. 61 * tree.c (build_min_non_dep): Use the location of NON_DEP when 62 building the expression. 63 642019-12-20 Jakub Jelinek <jakub@redhat.com> 65 66 PR c++/92965 67 * pt.c (invalid_nontype_parm_type_p): Call structural_type_p with 68 explain=true only if emitting error. 69 70 PR c++/92966 71 * method.c (early_check_defaulted_comparison): Don't set 72 DECL_MAYBE_DELETED when returning false. 73 74 PR c++/92973 75 * method.c (early_check_defaulted_comparison): For C++17 and earlier 76 diagnose defaulted comparison operators. 77 78 PR c++/92666 79 * call.c (convert_arg_to_ellipsis): For floating point or 80 decltype(nullptr) arguments call mark_rvalue_use. 81 82 PR c++/92992 83 * call.c (convert_arg_to_ellipsis): For decltype(nullptr) arguments 84 that have side-effects use cp_build_compound_expr. 85 862019-12-20 Eric Botcazou <ebotcazou@adacore.com> 87 88 * decl2.c (c_parse_final_cleanups): Always call collect_source_ref on 89 the main input filename. 90 912019-12-19 Julian Brown <julian@codesourcery.com> 92 Cesar Philippidis <cesar@codesourcery.com> 93 94 * parser.c (cp_parser_omp_clause_name): Support attach and detach 95 clauses. 96 (cp_parser_omp_var_list_no_open): Add ALLOW_DEREF optional parameter. 97 Parse deref if true. 98 (cp_parser_omp_var_list): Add ALLOW_DEREF optional parameter. Pass to 99 cp_parser_omp_var_list_no_open. 100 (cp_parser_oacc_data_clause): Support attach and detach clauses. 101 Update call to cp_parser_omp_var_list_no_open. 102 (cp_parser_oacc_all_clauses): Support attach and detach. 103 (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK, 104 OACC_KERNELS_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK, 105 OACC_SERIAL_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_ATTACH. 106 (OACC_EXIT_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_DETACH. 107 * semantics.c (handle_omp_array_sections_1): Reject subarrays for 108 attach and detach. 109 (handle_omp_array_sections): Use GOMP_MAP_ATTACH_DETACH instead of 110 GOMP_MAP_ALWAYS_POINTER for OpenACC. 111 (cp_oacc_check_attachments): New function. 112 (finish_omp_clauses): Use above function. Allow structure fields and 113 class members to appear in OpenACC data clauses. Support 114 GOMP_MAP_ATTACH_DETACH. Support deref. 115 1162019-12-19 Jason Merrill <jason@redhat.com> 117 118 PR c++/52320 - EH cleanups for partially constructed arrays. 119 * typeck2.c (split_nonconstant_init_1): Add nested parm. 120 Add cleanup for whole array if true. 121 122 PR c++/66139 - EH cleanups for partially constructed aggregates. 123 PR c++/57510 124 * cp-gimplify.c (cp_gimplify_init_expr): Use split_nonconstant_init. 125 * typeck2.c (split_nonconstant_init): Handle non-variable dest. 126 (split_nonconstant_init_1): Clear TREE_SIDE_EFFECTS. 127 * tree.c (is_local_temp): New. 128 1292019-12-18 Jason Merrill <jason@redhat.com> 130 131 PR c++/91165 follow-on tweak 132 * constexpr.c (cxx_eval_call_expression): Use 133 unshare_expr_without_location. 134 1352019-12-19 Julian Brown <julian@codesourcery.com> 136 Maciej W. Rozycki <macro@codesourcery.com> 137 Tobias Burnus <tobias@codesourcery.com> 138 Thomas Schwinge <thomas@codesourcery.com> 139 140 * parser.c (cp_parser_omp_clause_name): Support no_create. 141 (cp_parser_oacc_data_clause): Likewise. 142 (cp_parser_oacc_all_clauses): Likewise. 143 (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) 144 (OACC_PARALLEL_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_NO_CREATE. 145 * semantics.c (handle_omp_array_sections): Support no_create. 146 1472019-12-18 Paolo Carlini <paolo.carlini@oracle.com> 148 149 * typeck.c (cxx_sizeof_or_alignof_type): Add location_t parameter 150 and use it throughout. 151 (cxx_sizeof_expr): Likewise. 152 (cxx_alignof_expr): Likewise. 153 (cxx_sizeof_or_alignof_expr): Likewise. 154 (cxx_alignas_expr): Update call. 155 * decl.c (fold_sizeof_expr): Likewise. 156 * pt.c (tsubst_copy): Likewise. 157 (tsubst_copy_and_build): Likewise. 158 * except.c (build_throw): Add location_t parameter and use it. 159 (expand_end_catch_block): Update call. 160 * parser.c (cp_parser_unary_expression): Update 161 cxx_sizeof_or_alignof_type and cxx_sizeof_or_alignof_expr calls, 162 pass the compound location. 163 (cp_parser_throw_expression): Likewise pass the combined location 164 to build_throw. 165 * cp-tree.h: Update declarations. 166 167 * semantics.c (finish_handler_parms): Use DECL_SOURCE_LOCATION. 168 * decl2.c (check_classfn): Likewise. 169 170 * except.c (is_admissible_throw_operand_or_catch_parameter): 171 Exploit cp_expr_loc_or_input_loc in one place. 172 173 * except.c (create_try_catch_expr): Remove, unused. 174 1752019-12-17 Jason Merrill <jason@redhat.com> 176 177 PR c++/12333 - X::~X() with implicit this->. 178 * parser.c (cp_parser_lookup_name): Use lookup_destructor. 179 * typeck.c (lookup_destructor): No longer static. 180 1812019-12-17 Martin Sebor <msebor@redhat.com> 182 183 PR c++/61339 184 * parser.c (cp_parser_maybe_warn_enum_key): New function. 185 (class_decl_loc_t): New class. 186 (cp_parser_elaborated_type_specifier): Call 187 cp_parser_maybe_warn_enum_key. 188 (cp_parser_class_head): Call cp_parser_check_class_key. 189 (cp_parser_check_class_key): Add arguments. Call class_decl_loc_t::add. 190 (c_parse_file): Call class_decl_loc_t::diag_mismatched_tags. 191 1922019-12-17 Jason Merrill <jason@redhat.com> 193 194 PR c++/79592 - missing explanation of invalid constexpr. 195 * constexpr.c (register_constexpr_fundef): Do store the body of a 196 template instantiation that is not potentially constant. 197 (explain_invalid_constexpr_fn): Look it up. 198 (cxx_eval_call_expression): Check fundef->result. 199 2002019-12-17 Jason Merrill <jason@redhat.com> 201 202 PR c++/92576 - redeclaration of variable template. 203 * decl.c (redeclaration_error_message): Recurse for variable 204 templates. 205 2062019-12-17 Jason Merrill <jason@redhat.com> 207 208 * name-lookup.c (get_std_name_hint): Add std::byte. 209 2102019-12-17 Jakub Jelinek <jakub@redhat.com> 211 212 PR c++/59655 213 * pt.c (push_tinst_level_loc): If limit_bad_template_recursion, 214 set TREE_NO_WARNING on tldcl. 215 * decl2.c (no_linkage_error): Treat templates with TREE_NO_WARNING 216 as defined during error recovery. 217 2182019-12-13 Jason Merrill <jason@redhat.com> 219 220 PR c++/91165 - verify_gimple ICE with cached constexpr. 221 * constexpr.c (cxx_bind_parameters_in_call): Don't unshare. 222 (cxx_eval_call_expression): Unshare all args if we're caching. 223 2242019-12-12 Jason Merrill <jason@redhat.com> 225 226 PR c++/92496 - ICE with <=> and no #include <compare>. 227 * typeck.c (cp_build_binary_op): Handle error from spaceship_type. 228 2292019-12-11 David Malcolm <dmalcolm@redhat.com> 230 231 * cxx-pretty-print.c (cxx_pretty_printer::clone): New vfunc 232 implementation. 233 * cxx-pretty-print.h (cxx_pretty_printer::clone): New vfunc decl. 234 * error.c (cxx_format_postprocessor::clone): New vfunc. 235 2362019-12-11 Jakub Jelinek <jakub@redhat.com> 237 238 PR c++/92869 239 * class.c (finish_struct): For C++17 and earlier, check 240 type_has_user_provided_or_explicit_constructor rather than 241 TYPE_HAS_USER_CONSTRUCTOR whether to set CLASSTYPE_NON_AGGREGATE. 242 2432019-12-11 Marek Polacek <polacek@redhat.com> 244 245 PR c++/92878 - Parenthesized init of aggregates in new-expression. 246 * init.c (build_new_1): Handle parenthesized initialization of 247 aggregates in new-expression. 248 2492019-12-11 Jason Merrill <jason@redhat.com> 250 251 PR c++/92105 - decltype(decltype) error cascade. 252 * parser.c (cp_parser_decltype_expr): Don't tentative_firewall here. 253 (cp_parser_decltype): Do it here. Remember a non-tentative error. 254 255 PR c++/57082 - new X{} and private destructor. 256 * init.c (build_new_1): Also pass tf_no_cleanup to 257 build_special_member_call. 258 259 PR c++/92774 - ICE with implicitly deleted operator<=>. 260 * method.c (comp_info::~comp_info): Factor out of... 261 (build_comparison_op): Here. Handle error return from build_new_op. 262 263 PR c++/92859 - ADL and bit-field. 264 * name-lookup.c: Use unlowered_expr_type. 265 266 PR c++/92446 - deduction of class NTTP. 267 * pt.c (deducible_expression): Look through VIEW_CONVERT_EXPR. 268 2692019-12-10 Jason Merrill <jason@redhat.com> 270 271 PR c++/92847 - C++20 comparison ambiguity with class template. 272 * call.c (cand_parms_match): Handle all templated functions. 273 274 Fix C++20 structural type vs. private base. 275 * class.c (build_base_field_1): Take access parameter. 276 (build_base_field): Likewise. 277 (build_base_fields, layout_virtual_bases): Pass it. 278 * tree.c (structural_type_p): Improve private base diagnostic. 279 280 PR c++/92560 - ICE with decltype and rewritten operator. 281 * call.c (build_new_op_1): Clear tf_decltype on inner call. 282 2832019-12-09 David Malcolm <dmalcolm@redhat.com> 284 285 * error.c (range_label_for_type_mismatch::get_text): Replace 286 label_text ctor calls with label_text::borrow. 287 2882019-12-09 Paolo Carlini <paolo.carlini@oracle.com> 289 290 * typeck.c (check_for_casting_away_constness): Add location_t 291 parameter and use it. 292 (maybe_warn_about_useless_cast): Likewise. 293 (maybe_warn_about_cast_ignoring_quals): Likewise. 294 (build_static_cast_1): Likewise. 295 (build_static_cast): Likewise; sets the location of the returned tree. 296 (build_reinterpret_cast_1): Likewise. 297 (build_reinterpret_cast): Likewise; sets the location of the returned 298 tree. 299 (build_const_cast_1): Likewise. 300 (build_const_cast): Likewise; sets the location of the returned tree. 301 (cp_build_c_cast): Likewise. 302 (build_c_cast): Adjust. 303 (build_ptrmemfunc): Adjust calls. 304 (cp_build_unary_op): Pass the location to invert_truthvalue_loc. 305 * rtti.c (build_dynamic_cast_1): Add location_t parameter and 306 use it. 307 (build_dynamic_cast): Likewise. 308 * cp-tree.h: Adjust declarations. 309 * parser.c (cp_parser_postfix_expression): Pass cp_cast_loc to 310 the various build_*_cast functions. 311 (get_cast_suggestion): Adjust calls. 312 (cp_parser_builtin_offsetof): Likewise. 313 * decl.c (reshape_init): Adjust call. 314 * method.c (forward_parm): Likewise. 315 (build_comparison_op): Likewise. 316 * pt.c (tsubst_copy_and_build): Likewise. 317 * semantics.c (finish_omp_reduction_clause): Likewise. 318 (cp_omp_finish_iterators): Likewise. 319 * tree.c (cp_stabilize_reference): Likewise. 320 (move): Likewise. 321 * typeck2.c (build_functional_cast): Likewise. 322 323 * typeck2.c (build_functional_cast_1): New. 324 (build_functional_cast_1): Calls the latter and sets the location 325 of the returned tree. 326 3272019-12-08 Jakub Jelinek <jakub@redhat.com> 328 329 * cvt.c (maybe_warn_nodiscard): Add workaround for GCC 3.4-4.4 - cast 330 msg to (const char *) in conditional expressions. Formatting fixes. 331 3322019-12-07 Jason Merrill <jason@redhat.com> 333 Jakub Jelinek <jakub@redhat.com> 334 335 PR c++/92831 336 * call.c (build_conditional_expr_1): For ?: with omitted middle 337 operand use cp_stabilize_reference if arg1 is glvalue_p rather than 338 just if it is lvalue_p. 339 3402019-12-06 Jakub Jelinek <jakub@redhat.com> 341 342 * parser.c (cp_parser_diagnose_invalid_type_name): Mention 343 that concept is also available with -std=c++2a. 344 345 PR c++/92831 - CWG 1299, not extending temporary lifetime for ?: 346 * cp-tree.h (extend_ref_init_temps): Add a new argument with NULL 347 default arg. 348 * call.c (set_up_extended_ref_temp): Add COND_GUARD argument, pass it 349 down to extend_ref_init_temps. Before pushing cleanup, if COND_GUARD 350 is non-NULL, create a bool temporary if needed, initialize to false 351 and guard the cleanup with the temporary being true. 352 (extend_ref_init_temps_1): Add COND_GUARD argument, pass it down 353 to recursive calls and set_up_extended_ref_temp. Handle COND_EXPR. 354 (extend_ref_init_temps): Add COND_GUARD argument, pass it down to 355 recursive calls and to extend_ref_init_temps_1. 356 3572019-12-06 Richard Sandiford <richard.sandiford@arm.com> 358 359 * decl.c (start_decl_1): Use verify_type_context to check whether 360 the target allows variables of a particular type to have static 361 or thread-local storage duration. 362 (check_array_initializer): Use verify_type_context to check whether 363 the target allows a particular type to be used as an array element. 364 (create_array_type_for_decl): Likewise. 365 (cp_finish_decl): Use verify_type_context to check whether 366 the target allows static member variables of a particular type. 367 (grokdeclarator): Likewise. Also use verify_type_context to check 368 whether the target allows non-static member variables of a particular 369 type. 370 * except.c: Include target.h. 371 (is_admissible_throw_operand_or_catch_parameter): Use 372 verify_type_context to check whether the target allows particular 373 types to be thrown and caught. 374 * typeck2.c (add_exception_specifier): Likewise. 375 * init.c (build_new_1): Use verify_type_context to check whether 376 the target allows particular types to be dynamically allocated. 377 (build_vec_delete_1, build_delete): Use verify_type_context to check 378 whether the target allows particular types to be deleted. 379 * lambda.c (add_capture): Use verify_type_context to check 380 whether the target allows particular types to be captured by copy. 381 * pt.c: Include target.h. 382 (instantiate_class_template_1): Use verify_type_context to check 383 whether the target allows non-static member variables of a particular 384 type. 385 * typeck.c (cxx_alignof_expr): Use verify_type_context to check 386 whether the target allows the alignment of a particular type 387 to be measured. 388 (pointer_diff, cp_build_unary_op): Use verify_type_context to check 389 whether the target allows arithmetic involving pointers to particular 390 types. 391 3922019-12-05 Marek Polacek <polacek@redhat.com> 393 Jakub Jelinek <jakub@redhat.com> 394 395 PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts. 396 * class.c (trivial_default_constructor_is_constexpr): Return true in 397 C++20. 398 * constexpr.c (cx_check_missing_mem_inits): Allow missing field 399 initializers in C++20. 400 (cxx_eval_call_expression): Don't clear CONSTRUCTOR_NO_CLEARING for 401 constexpr constructors in C++20. 402 (reduced_constant_expression_p): Don't set FIELD for union and array 403 types. Skip empty class fields without initializers. 404 * decl.c (check_for_uninitialized_const_var): Permit trivial default 405 initialization in constexpr. 406 (next_initializable_field): Don't skip vptr fields. 407 * method.c (walk_field_subobs): Still consider a constructor that 408 doesn't initialize all the members constexpr. 409 4102019-12-05 Marek Polacek <polacek@redhat.com> 411 412 PR c++/92271 - make __is_same alias for __is_same_as. 413 * cxx-pretty-print.c (pp_cxx_trait_expression) <case CPTK_IS_SAME_AS>: 414 Print "__is_same". 415 4162019-12-05 David Edelsohn <dje.gcc@gmail.com> 417 418 * cp-gimplify.c: Include memmodel.h. 419 4202019-12-05 Paolo Carlini <paolo.carlini@oracle.com> 421 422 * typeck2.c (build_functional_cast): Add location_t parameter 423 and use it. 424 * cp-tree.h: Update declaration. 425 * parser.c (cp_parser_functional_cast): Adjust call. 426 * call.c (build_op_delete_call): Likewise. 427 (build_new_method_call_1): Likewise. 428 * decl.c (check_initializer): Likewise. 429 * pt.c (tsubst_copy_and_build): Likewise. 430 * semantics.c (finish_compound_literal): Likewise. 431 4322019-12-04 David Edelsohn <dje.gcc@gmail.com> 433 434 * cp-gimplify.c: Include tm_p.h. 435 4362019-12-04 Marek Polacek <polacek@redhat.com> 437 438 * parser.c (enum primary_constraint_error): Remove stray comma. 439 4402019-12-04 Richard Sandiford <richard.sandiford@arm.com> 441 442 * cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p 443 instead of VECTOR_TYPE. 444 * call.c (build_conditional_expr_1): Restrict vector handling 445 to vectors that satisfy gnu_vector_type_p. 446 * cvt.c (ocp_convert): Only allow vectors to be converted 447 to bool if they satisfy gnu_vector_type_p. 448 (build_expr_type_conversion): Only allow conversions from 449 vectors if they satisfy gnu_vector_type_p. 450 * typeck.c (cp_build_binary_op): Only allow binary operators to be 451 applied to vectors if they satisfy gnu_vector_type_p. 452 (cp_build_unary_op): Likewise unary operators. 453 (build_reinterpret_cast_1): 454 4552019-12-03 Jakub Jelinek <jakub@redhat.com> 456 457 * cp-tree.h (enum cp_tree_index): Add CPTI_SOURCE_LOCATION_IMPL. 458 (source_location_impl): Define. 459 (enum cp_built_in_function): Add CP_BUILT_IN_SOURCE_LOCATION. 460 (fold_builtin_source_location): Declare. 461 * cp-gimplify.c: Include output.h, file-prefix-map.h and cgraph.h. 462 (cp_gimplify_expr, cp_fold): Handle CP_BUILT_IN_SOURCE_LOCATION. 463 Formatting fix. 464 (get_source_location_impl_type): New function. 465 (struct source_location_table_entry, 466 struct source_location_table_entry_hash): New types. 467 (source_location_table, source_location_id): New variables. 468 (fold_builtin_source_location): New function. 469 * constexpr.c (cxx_eval_builtin_function_call): Handle 470 CP_BUILT_IN_SOURCE_LOCATION. 471 * tree.c (builtin_valid_in_constant_expr_p): Likewise. Formatting 472 fix. 473 * decl.c (cxx_init_decl_processing): Register 474 __builtin_source_location. 475 * name-lookup.c (get_std_name_hint): Add source_location entry. 476 4772019-12-03 Paolo Carlini <paolo.carlini@oracle.com> 478 479 * typeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc 480 location in a few additional diagnostics; tidy. 481 (check_return_expr): Likewise. 482 483 * typeck.c (cp_build_addr_expr_1): Use tree_strip_any_location_wrapper 484 for the address of main pedwarn. 485 4862019-12-03 Jakub Jelinek <jakub@redhat.com> 487 488 PR c++/91369 489 * constexpr.c (struct constexpr_global_ctx): Add cleanups member, 490 initialize it in the ctor. 491 (cxx_eval_constant_expression) <case TARGET_EXPR>: If TARGET_EXPR_SLOT 492 is already in the values hash_map, don't evaluate it again. Put 493 TARGET_EXPR_SLOT into hash_map even if not lval, and push it into 494 save_exprs too. If there is TARGET_EXPR_CLEANUP and not 495 CLEANUP_EH_ONLY, push the cleanup to cleanups vector. 496 <case CLEANUP_POINT_EXPR>: Save outer cleanups, set cleanups to 497 local auto_vec, after evaluating the body evaluate cleanups and 498 restore previous cleanups. 499 <case TRY_CATCH_EXPR>: Don't crash if the first operand is NULL_TREE. 500 (cxx_eval_outermost_constant_expr): Set cleanups to local auto_vec, 501 after evaluating the expression evaluate cleanups. 502 5032019-12-03 Marek Polacek <polacek@redhat.com> 504 505 PR c++/91363 - P0960R3: Parenthesized initialization of aggregates. 506 * call.c (build_new_method_call_1): Handle parenthesized initialization 507 of aggregates by building up a CONSTRUCTOR. 508 (extend_ref_init_temps): Do nothing for CONSTRUCTOR_IS_PAREN_INIT. 509 * cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT, LOOKUP_AGGREGATE_PAREN_INIT): 510 Define. 511 * decl.c (grok_reference_init): Handle aggregate initialization from 512 a parenthesized list of values. 513 (reshape_init): Do nothing for CONSTRUCTOR_IS_PAREN_INIT. 514 (check_initializer): Handle initialization of an array from a 515 parenthesized list of values. Use NULL_TREE instead of NULL. 516 * tree.c (build_cplus_new): Handle BRACE_ENCLOSED_INITIALIZER_P. 517 * typeck2.c (digest_init_r): Set LOOKUP_AGGREGATE_PAREN_INIT if it 518 receives a CONSTRUCTOR with CONSTRUCTOR_IS_PAREN_INIT set. Allow 519 narrowing when LOOKUP_AGGREGATE_PAREN_INIT. 520 (massage_init_elt): Don't lose LOOKUP_AGGREGATE_PAREN_INIT when passing 521 flags to digest_init_r. 522 5232019-12-03 Jakub Jelinek <jakub@redhat.com> 524 525 PR c++/92732 526 * typeck2.c (digest_nsdmi_init): For bitfields, use 527 DECL_BIT_FIELD_TYPE instead of TREE_TYPE. 528 5292019-12-03 Jason Merrill <jason@redhat.com> 530 Jakub Jelinek <jakub@redhat.com> 531 532 PR c++/92705 533 * call.c (strip_standard_conversion): New function. 534 (build_new_op_1): Use it for user_conv_p. 535 (compare_ics): Likewise. 536 (source_type): Likewise. 537 5382019-12-03 Jakub Jelinek <jakub@redhat.com> 539 540 PR c++/92695 541 * constexpr.c (cxx_bind_parameters_in_call): For virtual calls, 542 adjust the first argument to point to the derived object rather 543 than its base. 544 5452019-12-02 Jakub Jelinek <jakub@redhat.com> 546 547 PR c++/92695 548 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Use 549 STRIP_NOPS before checking for ADDR_EXPR. 550 5512019-11-29 Jakub Jelinek <jakub@redhat.com> 552 553 PR c++/60228 554 * parser.c (cp_parser_omp_declare_reduction_exprs): If 555 processing_template_decl, wrap the combiner or initializer 556 into EXPR_STMT. 557 * decl.c (start_preparsed_function): Don't start a lambda scope 558 for DECL_OMP_DECLARE_REDUCTION_P functions. 559 (finish_function): Don't finish a lambda scope for 560 DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function 561 them nor cp_genericize them. 562 * mangle.c (decl_mangling_context): Look through 563 DECL_OMP_DECLARE_REDUCTION_P functions. 564 * semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P 565 functions, use tentative linkage, don't keep their bodies with 566 -fkeep-inline-functions and return false at the end. 567 5682019-11-28 Jakub Jelinek <jakub@redhat.com> 569 570 PR c++/92695 571 * decl2.c (mark_used): Don't call note_vague_linkage_fn for pure 572 virtual functions, even if they are declared inline. 573 5742019-11-16 Jason Merrill <jason@redhat.com> 575 576 Implement P1814R0, CTAD for alias templates. 577 * pt.c (rewrite_tparm_list): Factor out of build_deduction_guide. 578 (maybe_aggr_guide): Check for copy-init here. 579 (alias_ctad_tweaks, deduction_guides_for): New. 580 (ctor_deduction_guides_for): Factor out of do_class_deduction. 581 (ctad_template_p): New. 582 * parser.c (cp_parser_simple_type_specifier): Use it. 583 * constraint.cc (append_constraint): New. 584 5852019-11-16 Jason Merrill <jason@redhat.com> 586 587 * cxx-pretty-print.c (pp_cxx_unqualified_id): Handle alias 588 template-id. 589 * pt.c (complex_alias_template_p): True if constraints. 590 (get_underlying_template, tsubst): Check alias constraints. 591 (push_template_decl_real): Set alias constraints here. 592 * parser.c (cp_parser_alias_declaration): Not here. 593 * constraint.cc (get_constraints): Take const_tree. 594 5952019-11-12 Jason Merrill <jason@redhat.com> 596 597 PR c++/92206 - ICE with typedef to dependent alias. 598 * pt.c (dependent_alias_template_spec_p) 599 (alias_template_specialization_p): Add transparent_typedefs 600 parameter. 601 (iterative_hash_template_arg, any_template_parm_r) 602 (primary_template_specialization_p, tsubst, dependent_type_p_r): 603 Adjust. 604 * decl.c (check_elaborated_type_specifier): Adjust. 605 * error.c (dump_template_bindings, dump_aggr_type): Adjust. 606 6072019-11-27 Andrew Sutton <asutton@lock3software.com> 608 609 PR c++/92236 610 Defer evaluation of concept checks so that static assertions can 611 emit more detailed diagnostics. 612 * constexpr.c (cxx_eval_call_expression): Handle concept checks. 613 (cxx_eval_constant_expression): Diagnose misuse of function concepts 614 as template-id expressions. Follow the usual return path for results. 615 (cxx_eval_outermost_constant_expr): Avoid calling 616 cp_get_callee_fndecl_nofold for function concepts. 617 * constraint.cc (build_function_check): Fully type the concept check 618 so that we don't ICE in conversions. 619 * cp-gimplify.c (cp_genericize_r) [CALL_EXPR]: Handle concept checks. 620 [TEMPLATE_ID_EXPR] Likewise. 621 * cvt.c (convert_to_void): Always evaluate concept checks so we don't 622 accidentally ignore them. Substitution during satisfaction can make 623 a program ill-formed (example in g++.dg/cpp2a/concepts6.C). 624 * pt.c (tsubst_copy_and_build): [CALL_EXPR]: Don't evaluate concepts. 625 [TEMPLATE_ID_EXPR]: Likewise. 626 * semantics.c (finish_call_expr): Don't evaluate concepts. 627 (finish_id_expression_1): Likewise. 628 (finish_static_assert): Preserve the original condition so we can 629 diagnose concept errors when a check returns false. 630 6312019-11-27 Andrew Sutton <asutton@lock3software.com> 632 633 PR c++/92439 634 Improve quality of diagnostics for subexpressions that need parens. 635 * parser.c (cp_parser_requires_clause_opt): Add a flag to indicate 636 when parsing a requires-clause before lambda parameters, and... 637 (cp_parser_lambda_declarator_opt): ... use that here ... 638 (cp_parser_type_parameter): ... and here ... 639 (cp_parser_late_return_type_opt): ... and here ... 640 (cp_parser_explicit_template_declaration): ... and here. 641 (cp_parser_diagnose_ungrouped_constraint_plain): Adjust the message 642 because this can apply to subexpressions that are not immediately 643 after a requires-clause. 644 (cp_parser_diagnose_ungrouped_constraint_rich): Likewise. 645 (primary_constraint_error): New. 646 (cp_parser_constraint_requires_parens): New. 647 (cp_parser_unary_constraint_requires_parens): New. 648 (cp_parser_constraint_primary_expression): Check for unary expressions 649 before parsing the primary expression. Also check for binary and 650 postfix operators after a successful parse of the primary expression. 651 Force a re-parse if the result would form a lower-precedence string. 652 (cp_parser_constraint_logical_and_expression): Propagate lambda flag; 653 move checks for ill-formed constraints into the constraint primary 654 expression. 655 (cp_parser_constraint_logical_or_expression): Likewise. 656 (cp_parser_requires_clause_expression): Propagate lambda flag. 657 6582019-11-27 Andrew Sutton <asutton@lock3software.com> 659 660 PR c++/88395 661 * constraint.cc (satisfy_declaration_constraints): Push tinst levels 662 around satisfaction. 663 6642019-11-27 Andrew Sutton <asutton@lock3software.com> 665 666 Diagnose certain constraint errors as hard errors, but otherwise treat 667 them the same as normal SFINAE-type errors. Also, generally clean up 668 the satisfaction functions. 669 670 * constexpr.c (cxx_eval_constant_expression): Use 671 evaluate_concept_check. 672 * constraint.cc (normalize_concept_definition): Accept a diagnostic 673 flag and only cache when not diagnosing errors. 674 (decl_satisfied_cache): Map to trees instead of bools. 675 (satisfy_atom): Guarantee a location for the errors, propagate complain 676 flags to force_rvalue, and emit errors for non-boolean constraints. 677 (get_normalized_constraints_and_args): New overloads. Factored out of 678 satisfy_constraint_expression and satisfy_declaration_constraints. 679 (satisfy_constraint_expression): Propagate diagnostic info to 680 normalization. 681 (satisfy_declaration_constraints): New. Factored out of 682 constraints_satisfied_p. 683 (constraint_satisfaction_value): New. Calls 684 satisfy_constraint_expression or satisfy_declaration_constraints. 685 (constraints_satisfied_p): Call constraint_satisfaction_value. 686 (evaluate_concept_check): Don't take tsubst_falgs_t. Replay 687 satisfaction if an error is encountered. 688 (current_failed_constraint): Moved from pt.c. 689 (diagnose_constraints): Call constraint_satisfaction_value. 690 * cp-tree.h: Update declarations. 691 * pt.c (current_failed_constraint): Moved to constraint.cc. 692 * semantics.c (finish_id_expression_1): Remove a duplicate case. 693 6942019-11-27 Jakub Jelinek <jakub@redhat.com> 695 696 PR c++/92524 697 * tree.c (replace_placeholders_r): Don't walk constructor elts with 698 RANGE_EXPR indexes. 699 7002019-11-26 Jason Merrill <jason@redhat.com> 701 702 * pt.c (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Remember the 703 location of a variable template-id. 704 * constexpr.c (cxx_eval_constant_expression): Get expr location 705 before stripping location wrappers. 706 (non_const_var_error): Take location argument. 707 7082019-11-26 Paolo Carlini <paolo.carlini@oracle.com> 709 710 * typeck.c (cp_build_unary_op): Consistently use the accurate 711 location in seven additional diagnostic messages. 712 (cp_build_compound_expr): Use cp_expr_loc_or_input_loc in one place. 713 7142019-11-26 Jakub Jelinek <jakub@redhat.com> 715 716 PR c++/92648 717 * parser.c (cp_parser_std_attribute): For unknown attributes, 718 skip balanced token seq instead of trying to parse 719 attribute-argument-clause as expression list. Formatting fix. 720 721 PR c++/61414 722 * class.c (enum_to_min_precision): New hash_map. 723 (enum_min_precision): New function. 724 (check_bitfield_decl): Use it. 725 7262019-11-25 Paolo Carlini <paolo.carlini@oracle.com> 727 728 * typeck.c (cp_build_indirect_ref_1): Add location_t parameter 729 and use it in error messages. 730 (build_x_indirect_ref): Adjust call. 731 (build_indirect_ref): Likewise. 732 (cp_build_fold_indirect_ref): Likewise. 733 (cp_build_array_ref): Likewise. 734 * call.c (build_new_op_1): Likewise. 735 * semantics.c (finish_omp_clauses): Likewise. 736 (finish_omp_depobj): Likewise. 737 * typeck2.c (build_x_arrow): Likewise. 738 * cp-tree.h (cp_build_indirect_ref): Update declaration. 739 740 * call.c (build_new_op_1): Use location argument in warning_at. 741 742 * typeck.c (cp_build_modify_expr): Consistently use the 743 location_t argument. 744 7452019-11-23 Bernd Edlinger <bernd.edlinger@hotmail.de> 746 747 PR c++/92365 748 * name-lookup.c (check_local_shadow): Use can_convert_arg 749 instead of can_convert. 750 7512019-11-22 Marek Polacek <polacek@redhat.com> 752 753 PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr. 754 * constexpr.c (potential_constant_expression_1): Allow a typeid 755 expression whose operand is of polymorphic type in constexpr in 756 C++20. 757 * rtti.c (build_typeid): Remove obsolete FIXME comment. 758 7592019-11-22 Jakub Jelinek <jakub@redhat.com> 760 761 PR c/90677 762 * cp-objcp-common.c (identifier_global_tag): Define. 763 764 PR c++/92458 765 * init.c (nsdmi_inst): Change type to 766 decl_tree_cache_map * from tree_cache_map *. 767 * constraint.cc (decl_constraints): Likewise. 768 * decl.c (get_tuple_decomp_init): Likewise. 769 * pt.c (defarg_inst, explicit_specifier_map): Likewise. 770 (tsubst_default_argument, store_explicit_specifier): Use 771 decl_tree_cache_map::create_ggc rather than 772 tree_cache_map::create_ggc. 773 * cp-objcp-common.c (debug_type_map): Change type to 774 type_tree_cache_map * from tree_cache_map *. 775 7762019-11-21 Marek Polacek <polacek@redhat.com> 777 778 PR c++/92450 - ICE with invalid nested name specifier. 779 * parser.c (cp_parser_member_declaration): Don't attempt to print 780 erroneous bit-field diagnostic if grokdeclarator returns 781 error_mark_node. 782 7832019-11-21 Jakub Jelinek <jakub@redhat.com> 784 Jason Merrill <jason@redhat.com> 785 786 PR c++/90842 787 * parser.c (cp_parser_decl_specifier_seq): For concept or typedef 788 break early if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR. 789 For type specifiers, set CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS 790 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR is set. 791 7922019-11-20 Paolo Carlini <paolo.carlini@oracle.com> 793 794 * typeck2.c (build_x_arrow): Early return if decay_conversion 795 returns error_mark_node. 796 7972019-11-20 Jakub Jelinek <jakub@redhat.com> 798 799 PR c++/90767 800 * call.c (complain_about_no_candidates_for_method_call): If 801 conv->from is not a type, pass to complain_about_bad_argument 802 lvalue_type of conv->from. 803 8042019-11-20 Paolo Carlini <paolo.carlini@oracle.com> 805 806 * cvt.c (ocp_convert): Use additional warning sentinel. 807 8082019-11-19 Jakub Jelinek <jakub@redhat.com> 809 810 PR c++/92414 811 * constexpr.c (cxx_eval_outermost_constant_expr): If DECL_INITIAL 812 on object is erroneous, return t without trying to evaluate 813 a constexpr dtor. 814 8152019-11-12 Jason Merrill <jason@redhat.com> 816 817 * call.c (same_fn_or_template): Change to cand_parms_match. 818 (joust): Adjust. 819 (print_z_candidate): Mark rewritten/reversed candidates. 820 (build_new_op_1): Warn about recursive call with reversed arguments. 821 8222019-11-15 Andrew Sutton <asutton@lock3software.com> 823 824 PR c++/89913 825 * pt.c (get_underlying_template): Exit loop if the original type 826 of the alias is null. 827 8282019-11-19 Andrew Sutton <asutton@lock3software.com> 829 830 PR c++/92078 831 * pt.c (maybe_new_partial_specialization): Apply access to newly 832 created partial specializations. Update comment style. 833 8342019-11-19 Andrew Sutton <asutton@lock3software.com> 835 836 PR c++/92078 837 * pt.c (maybe_new_partial_specialization): Apply access to newly 838 created partial specializations. Update comment style. 839 8402019-11-19 Andrew Sutton <asutton@lock3software.com> 841 842 PR c++/92403 843 Suppress diagnostics substituting into a requires-expression. 844 * pt.c (tsubst_copy_and_build): Perform the first substitution without 845 diagnostics and a second only if tsubst_requries_expr returns an error. 846 8472019-11-19 Jakub Jelinek <jakub@redhat.com> 848 849 PR c++/92504 850 * semantics.c (handle_omp_for_class_iterator): Don't call 851 cp_fully_fold on cond. 852 8532019-11-18 Paolo Carlini <paolo.carlini@oracle.com> 854 855 * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc 856 in three places. 857 (cxx_sizeof_expr): Use it in one additional place. 858 (cxx_alignof_expr): Likewise. 859 (lvalue_or_else): Likewise. 860 8612019-11-18 Marek Polacek <polacek@redhat.com> 862 863 PR c++/91962 - ICE with reference binding and qualification conversion. 864 * call.c (convert_like_real) <case ck_ref_bind>: Check need_temporary_p. 865 8662019-11-17 Jakub Jelinek <jakub@redhat.com> 867 868 * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%> 869 to print the decl. 870 (lookup_comparison_category): Use %qD instead of %<std::%D%> to print 871 the decl. 872 8732019-11-15 Paolo Carlini <paolo.carlini@oracle.com> 874 875 * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter 876 and use it in calls; also pass the location_t of the expression to 877 cp_build_binary_op and c_common_truthvalue_conversion. 878 * rtti.c (build_dynamic_cast_1): Adjust call. 879 * cvt.c (ocp_convert): Likewise. 880 * cp-gimplify.c (cp_fold): Likewise. 881 * cp-tree.h (cp_truthvalue_conversion): Update declaration. 882 8832019-11-14 Jason Merrill <jason@redhat.com> 884 885 Implement P1816R0, class template argument deduction for aggregates. 886 * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New. 887 (is_spec_or_derived): Split out from do_class_deduction. 888 (build_deduction_guide): Handle aggregate guide. 889 * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a 890 template. 891 * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an 892 aggregate. 893 8942019-11-14 Richard Sandiford <richard.sandiford@arm.com> 895 896 * call.c (build_conditional_expr_1): Use truth_type_for instead 897 of build_same_sized_truth_vector_type. 898 * typeck.c (build_vec_cmp): Likewise. 899 9002019-11-14 Jakub Jelinek <jakub@redhat.com> 901 902 * parser.c (cp_parser_omp_context_selector): Don't require score 903 argument to fit into shwi, just to be INTEGER_CST. Diagnose 904 negative score. 905 * pt.c (tsubst_attribute): Likewise. 906 907 * parser.c (cp_parser_omp_context_selector): Rename 908 CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID. 909 Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single 910 identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers 911 and string literals. 912 * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string. 913 9142019-11-13 Marek Polacek <polacek@redhat.com> 915 916 PR c++/89070 - bogus [[nodiscard]] warning in SFINAE. 917 * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with 918 tf_warning. 919 9202019-11-13 Richard Sandiford <richard.sandiford@arm.com> 921 922 PR c++/92206 923 * cp-tree.h (STF_STRIP_DEPENDENT): New constant. 924 * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags 925 when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE. 926 Don't apply the fix for DR1558 in that case; allow aliases with 927 dependent template parameters to be stripped instead. 928 9292019-11-12 Nathan Sidwell <nathan@acm.org> 930 931 * name-lookup.c (lookup_using_decl): New function, merged from ... 932 (do_class_using_decl): ... here. Call it. And ... 933 (finish_nonmember_using_decl): ... here. Call it. 934 9352019-11-12 Martin Liska <mliska@suse.cz> 936 937 * name-lookup.c: Do not include params.h. 938 * typeck.c: Likewise. 939 9402019-11-12 Martin Liska <mliska@suse.cz> 941 942 * name-lookup.c (namespace_hints::namespace_hints): Replace old 943 parameter syntax with the new one, include opts.h if needed. Use 944 SET_OPTION_IF_UNSET macro. 945 * typeck.c (comptypes): Likewise. 946 9472019-11-12 Maciej W. Rozycki <macro@codesourcery.com> 948 Frederik Harwath <frederik@codesourcery.com> 949 950 gcc/cp/ 951 * constexpr.c (potential_constant_expression_1): Handle 952 OACC_SERIAL. 953 * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro. 954 (cp_parser_oacc_kernels_parallel): Rename function to... 955 (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL. 956 (cp_parser_omp_construct): Update accordingly. 957 (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic 958 order. 959 * pt.c (tsubst_expr): Handle OACC_SERIAL. 960 9612019-11-11 Jason Merrill <jason@redhat.com> 962 963 Implement P1946R0, Allow defaulting comparisons by value. 964 * method.c (early_check_defaulted_comparison): Accept by-value, 965 reject mixed by-value and by-reference parms. 966 * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend. 967 * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT. 968 969 * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE. 970 9712019-11-11 Jakub Jelinek <jakub@redhat.com> 972 973 PR c++/92447 974 * decl.c (finish_function): Move ctype initialization before 975 DECL_DELETED_FN handling. 976 977 * semantics.c (finish_translation_unit): Diagnose declare target 978 without corresponding end declare target. 979 9802019-11-10 Jason Merrill <jason@redhat.com> 981 982 Implement D1957R0, T* to bool should be considered narrowing. 983 * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing 984 conversion with -std=c++2a. 985 9862019-11-08 Marek Polacek <polacek@redhat.com> 987 988 PR c++/92215 - flawed diagnostic for bit-field with non-integral type. 989 * parser.c (cp_parser_member_declaration): Add a diagnostic for 990 bit-fields with non-integral types. 991 9922019-11-08 Jakub Jelinek <jakub@redhat.com> 993 994 * init.c (build_vec_delete_1): Fix a comment typo - mist -> must. 995 9962019-11-07 Jason Merrill <jason@redhat.com> 997 998 Implement D1959R0, remove weak_equality and strong_equality. 999 * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality. 1000 (genericize_spaceship, common_comparison_type): Likewise. 1001 * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the 1002 relational operators, exclude other types no longer supported. 1003 10042019-11-06 Jason Merrill <jason@redhat.com> 1005 1006 Implement D1907R1 "structural type". 1007 * tree.c (structural_type_p): New. 1008 * pt.c (invalid_nontype_parm_type_p): Use it. 1009 * class.c (build_base_field_1): Take binfo. Copy TREE_PRIVATE. 1010 (build_base_field): Pass binfo. 1011 1012 PR c++/92150 - partial specialization with class NTTP. 1013 * pt.c (unify): Handle VIEW_CONVERT_EXPR. 1014 1015 * pt.c (use_pack_expansion_extra_args_p): Still do substitution if 1016 all packs are simple pack expansions. 1017 (add_extra_args): Check that the extra args aren't dependent. 1018 10192019-11-06 Andrew Sutton <asutton@lock3software.com> 1020 1021 Use satisfaction with nested requirements. 1022 * constraint.cc (build_parameter_mapping): Use 1023 current_template_parms when the declaration is not available. 1024 (norm_info::norm_info) Make explicit. 1025 (normalize_constraint_expression): Factor into a separate overload 1026 that takes arguments, and use that in the original function. 1027 (tsubst_nested_requirement): Use satisfy_constraint instead of 1028 trying to evaluate this as a constant expression. 1029 (finish_nested_requirement): Keep the normalized constraint and the 1030 original normalization arguments with the requirement. 1031 (diagnose_nested_requirement): Use satisfy_constraint. Tentatively 1032 implement more comprehensive diagnostics, but do not enable. 1033 * parser.c (cp_parser_requires_expression): Relax requirement that 1034 requires-expressions can live only inside templates. 1035 * pt.c (any_template_parm_r): Look into type of PARM_DECL. 1036 10372019-11-06 Jason Merrill <jason@redhat.com> 1038 1039 C++20 NB CA378 - Remove constrained non-template functions. 1040 * decl.c (grokfndecl): Reject constraints on non-templated function. 1041 10422019-11-06 Matthias Kretz <m.kretz@gsi.de> 1043 1044 * parser.c (cp_parser_operator): Parse operator?: as an 1045 attempt to overload the conditional operator. 1046 10472019-11-05 Jason Merrill <jason@redhat.com> 1048 1049 Implement C++20 operator<=>. 1050 * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield. 1051 (DECL_MAYBE_DELETED): New. 1052 (enum special_function_kind): Add sfk_comparison. 1053 (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New. 1054 * call.c (struct z_candidate): Add rewritten and reversed methods. 1055 (add_builtin_candidate): Handle SPACESHIP_EXPR. 1056 (add_builtin_candidates): Likewise. 1057 (add_candidates): Don't add a reversed candidate if the parms are 1058 the same. 1059 (add_operator_candidates): Split out from build_new_op_1. Handle 1060 rewritten and reversed candidates. 1061 (add_candidate): Swap conversions of reversed candidate. 1062 (build_new_op_1): Swap them back. Build a second operation for 1063 rewritten candidates. 1064 (extract_call_expr): Handle rewritten calls. 1065 (same_fn_or_template): New. 1066 (joust): Handle rewritten and reversed candidates. 1067 * class.c (add_implicitly_declared_members): Add implicit op==. 1068 (classtype_has_op, classtype_has_defaulted_op): New. 1069 * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR. 1070 (cxx_eval_constant_expression, potential_constant_expression_1): 1071 Likewise. 1072 * cp-gimplify.c (genericize_spaceship): New. 1073 (cp_genericize_r): Use it. 1074 * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR. 1075 * decl.c (finish_function): Handle deleted function. 1076 * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend. 1077 (mark_used): Check DECL_MAYBE_DELETED. Remove assumption that 1078 defaulted functions are non-static members. 1079 * error.c (dump_expr): Handle SPACESHIP_EXPR. 1080 * method.c (type_has_trivial_fn): False for sfk_comparison. 1081 (enum comp_cat_tag, struct comp_cat_info_t): New types. 1082 (comp_cat_cache): New array variable. 1083 (lookup_comparison_result, lookup_comparison_category) 1084 (is_cat, cat_tag_for, spaceship_comp_cat) 1085 (spaceship_type, genericize_spaceship) 1086 (common_comparison_type, early_check_defaulted_comparison) 1087 (comp_info, build_comparison_op): New. 1088 (synthesize_method): Handle sfk_comparison. Handle deleted. 1089 (get_defaulted_eh_spec, maybe_explain_implicit_delete) 1090 (explain_implicit_non_constexpr, implicitly_declare_fn) 1091 (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison. 1092 * name-lookup.c (get_std_name_hint): Add comparison categories. 1093 * tree.c (special_function_p): Add sfk_comparison. 1094 * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR. 1095 10962019-11-05 Tim van Deurzen <tim@kompiler.org> 1097 1098 Add new tree code for the spaceship operator. 1099 * cp-tree.def: Add new tree code. 1100 * operators.def: New binary operator. 1101 * parser.c: Add new token and tree code. 1102 11032019-09-15 Jason Merrill <jason@redhat.com> 1104 1105 * call.c (build_new_op_1): Don't apply any standard conversions to 1106 the operands of a built-in operator. Don't suppress conversions in 1107 cp_build_unary_op. 1108 * typeck.c (cp_build_unary_op): Do integral promotions for enums. 1109 11102019-11-04 Jason Merrill <jason@redhat.com> 1111 1112 Use vec instead of raw array for built-in candidates. 1113 * call.c (build_builtin_candidate): Take args in a vec. 1114 (add_builtin_candidate, add_builtin_candidates): Likewise. 1115 (build_conditional_expr_1, build_new_op_1): Adjust. 1116 11172019-11-04 Jason Merrill <jason@redhat.com> 1118 1119 * constexpr.c (explain_invalid_constexpr_fn): Show location of fn. 1120 1121 * pt.c (maybe_instantiate_noexcept): Only update clones if we 1122 instantiated. 1123 1124 * typeck.c (contextual_conv_bool): New. 1125 1126 * name-lookup.c (lookup_qualified_name): Add wrapper overload taking 1127 C string rather than identifier. 1128 * parser.c (cp_parser_userdef_numeric_literal): Use it. 1129 * rtti.c (emit_support_tinfos): Use it. 1130 * cp-tree.h (ovl_op_identifier): Change to inline functions. 1131 (build_x_binary_op): Add wrapper with fewer parms. 1132 11332019-11-05 Jason Merrill <jason@redhat.com> 1134 1135 * decl2.c (mark_used): Diagnose use of a function with unsatisfied 1136 constraints here. 1137 * typeck.c (cp_build_function_call_vec): Not here. 1138 11392019-11-05 Nathan Sidwell <nathan@acm.org> 1140 1141 PR c++/92370 1142 * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION 1143 when skipping over version control marker. 1144 11452019-11-05 Jakub Jelinek <jakub@redhat.com> 1146 1147 PR c++/92343 1148 * constexpr.c (potential_constant_expression_1): Return true rather 1149 than false for PREDICT_EXPR. 1150 1151 * decl.c (omp_declare_variant_finalize_one): Call 1152 declare_simd_adjust_this not just on the context, but also on the 1153 variant-id expression for methods. Don't call 1154 cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is 1155 safe cp_get_fndecl_from_callee. Don't try to print as %qD 1156 NULL in diagnostics. 1157 * pt.c (tsubst_attribute): Handle "omp declare variant base" 1158 attribute. 1159 (tsubst_function_decl): Call omp_declare_variant_finalize 1160 if there are any "omp declare variant base" attributes left. 1161 11622019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com> 1163 1164 PR c++/91979 - mangling nullptr expression 1165 * mangle.c (write_template_arg_literal): Handle nullptr 1166 mangling. 1167 11682019-11-04 Jason Merrill <jason@redhat.com> 1169 1170 * typeck.c (check_return_expr): Avoid redundant error. 1171 11722019-11-02 Paolo Carlini <paolo.carlini@oracle.com> 1173 1174 * typeck.c (composite_pointer_type): Add a const op_location_t& 1175 parameter and use it in diagnostics. 1176 (composite_pointer_error): Likewise. 1177 (composite_pointer_type_r): Add a const op_location_t& 1178 parameter and forward it. 1179 (cp_build_binary_op): Adjust calls. 1180 (common_pointer_type): Likewise. 1181 * call.c (add_builtin_candidate): Likewise. 1182 (build_conditional_expr_1): Likewise. 1183 * cp-tree.h (composite_pointer_type): Update declaration. 1184 1185 * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc 1186 in permerror. 1187 (cxx_alignof_expr): Likewise. 1188 (lvalue_or_else): Likewise. 1189 11902019-11-02 Jakub Jelinek <jakub@redhat.com> 1191 1192 * decl.c (omp_declare_variant_finalize_one): Use 1193 omp_get_context_selector instead of c_omp_get_context_selector. 1194 1195 PR c++/89640 1196 * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes 1197 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR. 1198 1199 PR c++/88335 - Implement P1073R3: Immediate functions 1200 * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit. 1201 (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define. 1202 (enum cp_decl_spec): Add ds_consteval. 1203 (fold_non_dependent_expr): Add another tree argument defaulted to 1204 NULL_TREE. 1205 * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p 1206 member. 1207 * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments 1208 for C++11 and C++20 specifiers. Handle RID_CONSTEVAL. 1209 (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment. 1210 (CP_PARSER_FLAGS_CONSTEVAL): New. 1211 (cp_parser_skip_balanced_tokens): New forward declaration. 1212 (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set 1213 current_binding_level->immediate_fn_ctx_p before parsing parameter 1214 list if decl-specifier-seq contains consteval specifier. 1215 (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL. 1216 (cp_parser_explicit_instantiation): Diagnose explicit instantiation 1217 with consteval specifier. 1218 (cp_parser_init_declarator): For consteval or into flags 1219 CP_PARSER_FLAGS_CONSTEVAL. 1220 (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set 1221 current_binding_level->immediate_fn_ctx_p in the sk_function_parms 1222 scope. 1223 (set_and_check_decl_spec_loc): Add consteval entry, formatting fix. 1224 * call.c (build_addr_func): For direct calls to immediate functions 1225 use build_address rather than decay_conversion. 1226 (build_over_call): Evaluate immediate function invocations. 1227 * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P. 1228 * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't 1229 call mark_needed for immediate functions. 1230 * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix. 1231 (cp_build_addr_expr_1): Reject taking address of immediate function 1232 outside of immediate function. 1233 * decl.c (validate_constexpr_redeclaration): Diagnose consteval 1234 vs. non-consteval or vice versa redeclaration. Use 1235 SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function. 1236 (check_tag_decl): Use %qs with keyword string to simplify translation. 1237 Handle ds_consteval. 1238 (start_decl): Adjust diagnostics for static or thread_local variables 1239 in immediate functions. 1240 (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword 1241 to string to simplify translation. Diagnose consteval main. Use 1242 SET_DECL_IMMEDIATE_FUNCTION_P for consteval. 1243 (grokdeclarator): Handle consteval. Use %qs with keyword strings to 1244 simplify translation. Use separate ifs instead of chained else if 1245 for invalid specifiers. For constinit clear constinit_p rather than 1246 constexpr_p. 1247 * constexpr.c (find_immediate_fndecl): New function. 1248 (cxx_eval_outermost_constant_expr): Allow consteval calls returning 1249 void. Diagnose returning address of immediate function from consteval 1250 evaluation. 1251 (fold_non_dependent_expr_template): Add OBJECT argument, pass it 1252 through to cxx_eval_outermost_constant_expr. 1253 (fold_non_dependent_expr): Add OBJECT argument, pass it through to 1254 fold_non_dependent_expr_template. 1255 (fold_non_dependent_init): Adjust fold_non_dependent_expr_template 1256 caller. 1257 * method.c (defaulted_late_check): Adjust diagnostics for consteval. 1258 * lambda.c (maybe_add_lambda_conv_op): Copy over 1259 DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from 1260 callop to both artificial functions. 1261 * init.c (build_value_init): Don't do further processing if 1262 build_special_member_call returned a TREE_CONSTANT. Formatting fix. 1263 1264 PR c++/91369 - Implement P0784R7: constexpr new 1265 * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define. 1266 * init.c (build_new_1, build_vec_delete_1, build_delete): Set 1267 CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions. 1268 * constexpr.c (is_std_allocator_allocate): Only allow 1269 global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P 1270 or in std::allocate<T>::{,de}allocate. 1271 (potential_constant_expression_1): Likewise. 1272 12732019-11-01 Nathan Sidwell <nathan@acm.org> 1274 1275 * class.c (check_field_decls): Refactor. 1276 12772019-10-31 Jakub Jelinek <jakub@redhat.com> 1278 1279 PR c++/90947 1280 * cp-tree.h (type_initializer_zero_p): Declare. 1281 * decl.c (reshape_init_array_1): Formatting fix. 1282 * tree.c (type_initializer_zero_p): New function. Moved from 1283 ../tree.c, use next_initializable_field, formatting fix. Return 1284 false for TYPE_NON_AGGREGATE_CLASS types. 1285 12862019-10-30 Jason Merrill <jason@redhat.com> 1287 1288 PR c++/92268 - hard error satisfying return-type-requirement 1289 * constraint.cc (type_deducible_p): Check for substitution failure. 1290 (diagnose_compound_requirement): Adjust diagnostic. 1291 * pt.c (do_auto_deduction): Don't pass cargs to 1292 constraints_satisfied_p. 1293 12942019-10-30 Jakub Jelinek <jakub@redhat.com> 1295 1296 PR c++/91369 - Implement P0784R7: constexpr new 1297 * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true 1298 for placement new. 1299 (cxx_placement_new_fn, is_std_construct_at): New functions. 1300 (cxx_eval_call_expression): Allow placement new in std::construct_at. 1301 (potential_constant_expression_1): Likewise. 1302 1303 * typeck.c (decl_in_std_namespace_p): Return true also for decls 1304 in inline namespaces inside of std namespace. 1305 13062019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de> 1307 1308 PR c++/92024 1309 * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs 1310 is always a -Wshadow=compatible-local warning, unless 1311 -Wshadow is used. 1312 13132019-10-30 Jason Merrill <jason@redhat.com> 1314 1315 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO. 1316 13172019-10-30 Marek Polacek <polacek@redhat.com> 1318 1319 PR c++/92134 - constinit malfunction in static data member. 1320 * decl2.c (grokfield): Set LOOKUP_CONSTINIT. 1321 13222019-10-30 Jakub Jelinek <jakub@redhat.com> 1323 1324 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare. 1325 * decl.c: Include omp-general.h. 1326 (declare_simd_adjust_this): Add forward declaration. 1327 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New 1328 function. 1329 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize. 1330 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the 1331 variant id-expression and propagate enough information to 1332 omp_declare_variant_finalize_one in the attribute so that it can 1333 finalize it. 1334 * class.c (finish_struct): Call omp_declare_variant_finalize. 1335 * tree.c (build_local_temp): No longer static, remove forward 1336 declaration. 1337 13382019-10-30 Paolo Carlini <paolo.carlini@oracle.com> 1339 1340 * typeck.c (cp_build_modify_expr): Prefer error + inform to 1341 error + error in one place. 1342 (get_delta_difference_1): Likewise. 1343 (get_delta_difference): Likewise, in two places. 1344 13452019-10-29 Paolo Carlini <paolo.carlini@oracle.com> 1346 1347 * typeck.c (build_x_unary_op): Use the location_t argument in 1348 three error_at. 1349 13502019-10-29 Marek Polacek <polacek@redhat.com> 1351 1352 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion. 1353 * call.c (joust): Don't attempt to warn if ->second_conv is null. 1354 13552019-10-29 Jakub Jelinek <jakub@redhat.com> 1356 1357 PR c++/92201 1358 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the 1359 function pointer type, re-add cast to the original one. 1360 13612019-10-29 Marek Polacek <polacek@redhat.com> 1362 1363 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF. 1364 * constexpr.c (cxx_eval_store_expression): Don't call 1365 modifying_const_object_p for ARRAY_REF. 1366 13672019-10-29 Richard Sandiford <richard.sandiford@arm.com> 1368 1369 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare. 1370 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above. 1371 * decl.c (cxx_simulate_enum_decl): New function. 1372 13732019-10-29 Richard Sandiford <richard.sandiford@arm.com> 1374 1375 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare. 1376 * decl.c (cxx_simulate_builtin_function_decl): New function. 1377 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL): 1378 Define to the above. 1379 13802019-10-28 Martin Sebor <msebor@redhat.com> 1381 1382 PR c/66970 1383 * cp-objcp-common.c (names_builtin_p): Define new function. 1384 13852019-10-28 Nathan Sidwell <nathan@acm.org> 1386 1387 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism. 1388 Add tree_check_p flag, use as nested union discriminator. 1389 (struct cp_lexer): Add saved_type & saved_keyword fields. 1390 * parser.c (eof_token): Delete. 1391 (cp_lexer_new_main): Always init last_token to last token of 1392 buffer. 1393 (cp_lexer_new_from_tokens): Overlay EOF token at end of range. 1394 (cp_lexer_destroy): Restore token under the EOF. 1395 (cp_lexer_previous_token_position): No check for eof_token here. 1396 (cp_lexer_get_preprocessor_token): Clear tree_check_p. 1397 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token. 1398 (cp_lexer_consume_token): Assert not CPP_EOF, no check for 1399 eof_token. 1400 (cp_lexer_purge_token): Likewise. 1401 (cp_lexer_purge_tokens_after): No check for EOF token. 1402 (cp_parser_nested_name_specifier, cp_parser_decltype) 1403 (cp_parser_template_id): Set tree_check_p. 1404 14052019-10-24 Jakub Jelinek <jakub@redhat.com> 1406 1407 * decl2.c (cplus_decl_attributes): Add "omp declare target block" 1408 attribute in between declare target and end declare target 1409 pragmas. 1410 1411 * call.c (convert_arg_to_ellipsis): Add missing space in string 1412 literal. 1413 14142019-10-24 Marek Polacek <polacek@redhat.com> 1415 1416 * decl.c (reshape_init_r): Add missing space. 1417 14182019-10-24 Nathan Sidwell <nathan@acm.org> 1419 1420 * pt.c (reduce_template_parm_level): Attach the new TPI to the new 1421 DECL. 1422 (convert_generic_types_to_packs): Pass the copied type to 1423 reduce_templatE_parm_level. 1424 14252019-10-23 Nathan Sidwell <nathan@acm.org> 1426 1427 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete. 1428 (std_identifier): Delete. 1429 (DECL_NAME_SPACE_STD_P): Compare against std_node. 1430 * decl.c (initialize_predefined_identifiers): 'std' is not needed. 1431 (cxx_init_decl_processing): Adjust creation of ::std. Use 1432 {push,pop}_nested_namespace. 1433 (cxx_builtin_function): Use {push,pop}_nested_namespace. 1434 * except.c (init_exception_processing): Likewise. 1435 * rtti.c (init_rtti_processing): Likewise. 1436 14372019-10-23 Jason Merrill <jason@redhat.com> 1438 1439 Implement P1286R2, Contra CWG1778 1440 * method.c (defaulted_late_check): Don't check explicit 1441 exception-specification on defaulted function. 1442 (after_nsdmi_defaulted_late_checks): Remove. 1443 * parser.h (struct cp_unparsed_functions_entry): Remove classes. 1444 * parser.c (unparsed_classes): Remove. 1445 (push_unparsed_function_queues, cp_parser_class_specifier_1): 1446 Adjust. 1447 14482019-10-23 Jakub Jelinek <jakub@redhat.com> 1449 1450 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: 1451 Temporarily change input_location to CLEANUP_STMT location. 1452 14532019-10-22 Jakub Jelinek <jakub@redhat.com> 1454 1455 PR tree-optimization/85887 1456 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire 1457 and __cxa_guard_release. 1458 14592019-10-22 Marc Glisse <marc.glisse@inria.fr> 1460 1461 PR c++/85746 1462 * constexpr.c (cxx_eval_builtin_function_call): Only set 1463 force_folding_builtin_constant_p if manifestly_const_eval. 1464 14652019-10-22 Richard Sandiford <richard.sandiford@arm.com> 1466 1467 * cp-tree.h (STF_USER_VISIBLE): New constant. 1468 (strip_typedefs, strip_typedefs_expr): Take a flags argument. 1469 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise, 1470 updating mutual calls accordingly. When STF_USER_VISIBLE is true, 1471 only look through typedefs if user_facing_original_type_p. 1472 * error.c (dump_template_bindings, type_to_string): Pass 1473 STF_USER_VISIBLE to strip_typedefs. 1474 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set. 1475 14762019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com> 1477 Jason Merrill <jason@redhat.com> 1478 1479 PR c++/83534 - typeinfo of noexcept function 1480 * rtti.c (get_tinfo_decl_dynamic): Do not call 1481 TYPE_MAIN_VARIANT for function. 1482 (get_typeid): Likewise. 1483 14842019-10-21 Paolo Carlini <paolo.carlini@oracle.com> 1485 1486 * parser.c (cp_parser_class_head): Improve error recovery upon 1487 extra qualification error. 1488 14892019-10-21 Jakub Jelinek <jakub@redhat.com> 1490 1491 PR c++/92015 1492 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref): 1493 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts. 1494 14952019-10-21 Marek Polacek <polacek@redhat.com> 1496 1497 PR c++/92062 - ODR-use ignored for static member of class template. 1498 * pt.c (has_value_dependent_address): Strip location wrappers. 1499 15002019-10-21 Marek Polacek <polacek@redhat.com> 1501 1502 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr. 1503 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid 1504 recursing on null initializer and return false instead. 1505 15062019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com> 1507 1508 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR 1509 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard 1510 string message. 1511 (std_attribute_table) Increase nodiscard argument handling 1512 max_length from 0 to 1. 1513 * parser.c (cp_parser_check_std_attribute): Add requirement 1514 that nodiscard only be seen once in attribute-list. 1515 (cp_parser_std_attribute): Check that empty parenthesis lists are 1516 not specified for attributes that have max_length > 0 (e.g. 1517 [[attr()]]). 1518 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to 1519 output, if applicable. 1520 (convert_to_void): Allow constructors to be nodiscard-able (P1771). 1521 15222019-10-18 Nathan Sidwell <nathan@acm.org> 1523 1524 * cp-tree.h (struct lang_type): Remove was_anonymous. 1525 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL & 1526 TYPE_STUB_DECL. 1527 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED. 1528 15292019-10-17 Paolo Carlini <paolo.carlini@oracle.com> 1530 1531 * decl.c (grokfndecl): Remove redundant use of in_system_header_at. 1532 (compute_array_index_type_loc): Likewise. 1533 (grokdeclarator): Likewise. 1534 * error.c (cp_printer): Likewise. 1535 * lambda.c (add_default_capture): Likewise. 1536 * parser.c (cp_parser_primary_expression): Likewise. 1537 (cp_parser_selection_statement): Likewise. 1538 (cp_parser_toplevel_declaration): Likewise. 1539 (cp_parser_enumerator_list): Likewise. 1540 (cp_parser_using_declaration): Likewise. 1541 (cp_parser_member_declaration): Likewise. 1542 (cp_parser_exception_specification_opt): Likewise. 1543 (cp_parser_std_attribute_spec): Likewise. 1544 * pt.c (do_decl_instantiation): Likewise. 1545 (do_type_instantiation): Likewise. 1546 * typeck.c (cp_build_unary_op): Likewise. 1547 1548 * decl.c (check_tag_decl): Pass to in_system_header_at the same 1549 location used for the permerror. 1550 (grokdeclarator): Likewise. 1551 1552 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at. 1553 15542019-10-17 Jason Merrill <jason@redhat.com> 1555 1556 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var. 1557 (gimplify_to_rvalue): Remove default NULL argument. 1558 15592019-10-17 Nathan Sidwell <nathan@acm.org> 1560 1561 * decl.c (builtin_function_1): Merge into ... 1562 (cxx_builtin_function): ... here. Nadger the decl before maybe 1563 copying it. Set the context. 1564 (cxx_builtin_function_ext_scope): Push to top level, then call 1565 cxx_builtin_function. 1566 15672019-10-16 Luis Machado <luis.machado@linaro.org> 1568 1569 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file. 1570 15712019-10-16 Jakub Jelinek <jakub@redhat.com> 1572 1573 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup, 1574 if cleanup is a nop, clear location of its operand too. 1575 15762019-10-15 Andrew Sutton <asutton@lock3software.com> 1577 1578 Finish moving constraint and logic functionality of out pt.c. 1579 Reimplement and re-enable subsumption caching. 1580 1581 * config-lang.in (gtfiles): Add logic.cc. 1582 * constraint.cc (atomic_constraints_identical_p): Add assertions. 1583 (hash_atomic_constraint): Likewise. 1584 (constraints_equivalent_p): New. 1585 (inchash::add_constraint): New. 1586 (iterative_hash_constraint): New. 1587 (decl_constraints): Moved from pt.c. 1588 (get_constraints): Likewise. 1589 (set_constraints): Likewise. 1590 (remove_constraints): Likewise. 1591 * cp-tree.h (CONSTR_P): New. 1592 (init_constraint_processing): Remove. 1593 (constraints_equivalent_p, iterative_hash_constraint): Declare. 1594 * decl.c (cxx_init_decl_processing): Don't initialize constraints. 1595 * logic.cc (subsumption_entry): Moved from pt.c. 1596 (subsumption_hasher): Likewise. 1597 (subsumption_cache): Likewise. 1598 (lookup_subsumption): Likewise. 1599 (save_subsumption): Likewise. 1600 (subsumes_constraints_nonnull): Use subsumption cache. 1601 * pt.c: Move aforementioned declarations out of this file. 1602 (init_constraint_processing): Remove. 1603 16042019-10-15 Andrew Sutton <asutton@lock3software.com> 1605 1606 * parser.c (cp_parser_constructor_declarator_p): Pass an empty 1607 decl-specifier-seq to make sure we parse type constraints as part 1608 of a type-specifier. 1609 16102019-10-15 Nathan Sidwell <nathan@acm.org> 1611 1612 * class.c (build_clones): Break out of clone_function_decl. Just 1613 build the clones. 1614 (clone_function_decl): Call build_clones, then maybe add them to 1615 the method vector. 1616 1617 * class.c (build_clone): Refactor to clarify recursiveness. 1618 16192019-10-14 Jason Merrill <jason@redhat.com> 1620 1621 PR c++/91930 - ICE with constrained inherited default ctor. 1622 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR 1623 for inherited constructor. 1624 16252019-10-14 Paolo Carlini <paolo.carlini@oracle.com> 1626 1627 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION. 1628 16292019-10-14 Jakub Jelinek <jakub@redhat.com> 1630 1631 PR c++/92084 1632 * semantics.c (handle_omp_array_sections_1): Temporarily disable 1633 -fstrong-eval-order also for in_reduction and task_reduction clauses. 1634 1635 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument 1636 into int NESTED, if it is 2, diagnose missing commas in between 1637 clauses. 1638 (cp_parser_omp_context_selector): Pass 2 as last argument to 1639 cp_parser_omp_all_clauses. 1640 16412019-10-12 Jakub Jelinek <jakub@redhat.com> 1642 1643 * parser.c (cp_parser_omp_context_selector): Improve error recovery. 1644 For simd properties, put them directly into TREE_VALUE. 1645 (cp_finish_omp_declare_variant): Add "omp declare variant base" 1646 attribute rather than "omp declare variant". 1647 16482019-10-11 Marek Polacek <polacek@redhat.com> 1649 1650 PR c++/92049 - extra error with -fchecking=2. 1651 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr 1652 with tf_none. 1653 16542019-10-11 Paolo Carlini <paolo.carlini@oracle.com> 1655 1656 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and 1657 LROTATE_EXPR. 1658 * constexpr.c (cxx_eval_constant_expression): Likewise. 1659 (potential_constant_expression_1): Likewise. 1660 * pt.c (tsubst_copy): Likewise. 1661 16622019-10-11 Jason Merrill <jason@redhat.com> 1663 1664 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on 1665 explicitly defaulted functions. 1666 * method.c (synthesize_method): Likewise. 1667 16682019-10-11 Jakub Jelinek <jakub@redhat.com> 1669 1670 PR c++/91987 1671 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref 1672 operands have been swapped and at least one operand has side-effects, 1673 revert the swapping before calling build_array_ref. 1674 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with 1675 side-effects on the index operand, if -fstrong-eval-order use 1676 save_expr around the array operand. 1677 (cp_build_binary_op): For shifts with side-effects in the second 1678 operand, wrap first operand into SAVE_EXPR and evaluate it before 1679 the shift. 1680 * semantics.c (handle_omp_array_sections_1): Temporarily disable 1681 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section 1682 processing. 1683 * cp-gimplify.c (gimplify_to_rvalue): New function. 1684 (cp_gimplify_expr): Use it. 1685 16862019-10-10 Marek Polacek <polacek@redhat.com> 1687 1688 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool. 1689 Use false instead of 0. 1690 16912019-10-10 Jakub Jelinek <jakub@redhat.com> 1692 1693 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member. 1694 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd 1695 and declare variant. 1696 (cp_parser_oacc_all_clauses): Formatting fix. 1697 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate 1698 processing on closing paren and don't skip to end of pragma line. 1699 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also 1700 declare variant. 1701 (omp_construct_selectors, omp_device_selectors, 1702 omp_implementation_selectors, omp_user_selectors): New variables. 1703 (cp_parser_omp_context_selector, 1704 cp_parser_omp_context_selector_specification, 1705 cp_finish_omp_declare_variant): New functions. 1706 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant. 1707 (cp_parser_omp_declare): Handle declare variant. 1708 17092019-10-09 Jason Merrill <jason@redhat.com> 1710 1711 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING. 1712 17132019-10-09 Marek Polacek <polacek@redhat.com> 1714 1715 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound. 1716 PR c++/69531 - DR 1307: Differently bounded array parameters. 1717 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers. 1718 * call.c (build_array_conv): Build ck_identity at the beginning 1719 of the conversion. 1720 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const. 1721 (maybe_warn_array_conv): New. 1722 (convert_like_real): Call it. Add an error message about converting 1723 from arrays of unknown bounds. 1724 (conv_get_original_expr): New. 1725 (nelts_initialized_by_list_init): New. 1726 (conv_binds_to_array_of_unknown_bound): New. 1727 (compare_ics): Implement list-initialization ranking based on 1728 array sizes, as specified in DR 1307 and P0388R. 1729 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration. 1730 (compare_bounds_t): New enum. 1731 * typeck.c (comp_array_types): New bool and compare_bounds_t 1732 parameters. Use them. 1733 (structural_comptypes): Adjust the call to comp_array_types. 1734 (similar_type_p): Handle ARRAY_TYPE. 1735 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const. 1736 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use 1737 comp_array_types to compare array types. Look through arrays as per 1738 DR 330. 1739 (comp_ptr_ttypes_const): Use comp_array_types to compare array types. 1740 Look through arrays as per DR 330. 1741 17422019-10-09 Marek Polacek <polacek@redhat.com> 1743 1744 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type. 1745 * call.c (standard_conversion): When converting an enumeration with 1746 a fixed underlying type to the underlying type, give it the cr_promotion 1747 rank. 1748 (compare_ics): Implement a tiebreaker as per CWG 1601. 1749 17502019-10-08 Andrew Sutton <asutton@lock3software.com> 1751 Jason Merrill <jason@redhat.com> 1752 1753 Update the concepts implementation to conform to the C++20 1754 specification, improve compile times, and generally clean up 1755 the implementation. 1756 * call.c (build_new_function_call): Don't evaluate concepts here. 1757 (constraint_failure): Don't record the template. 1758 (print_z_candidate): Don't extract the template. 1759 * class.c (add_method): When overloading, hide ineligible special 1760 member fns. 1761 (check_methods): Set TYPE_HAS_COMPLEX_* here. 1762 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts. 1763 (maybe_initialize_fundef_copies_table): Remove. 1764 (get_fundef_copy): Use hash_map_safe_get_or_insert. 1765 (clear_cv_and_fold_caches): Clear the satisfaction cache. 1766 * constraint.cc (known_non_bool_p): New. 1767 (parsing_constraint_expression_sentinel): Renamed from 1768 expanding_constraint_sentinel. 1769 (check_constraint_operands): New. 1770 (check_constraint_atom): New. 1771 (finish_constraint_binary_op): New. 1772 (finish_constraint_or_expr): Likewise. 1773 (finish_constraint_and_expr): Likewise. 1774 (finish_constraint_primary_expr): Likewise. 1775 (combine_constraint_expressions): New. 1776 (finish_requires_expr): Add location parm. 1777 (get_concept_definition): Return the initializer of concept definitions. 1778 (get_template_head_requirements): New. 1779 (get_trailing_function_requirements): New. 1780 (deduce_constrained_parameter): Check if the identifier or template-id 1781 is a concept definition. 1782 (resolve_concept_definition_check): Removed. 1783 (resolve_variable_concept_check): Removed. 1784 (resolve_concept_check): New. 1785 (resolve_constraint_check): Handle concept definitions. 1786 converting arguments. 1787 (function_concept_check_p): Removed. 1788 (variable_concept_check_p): Removed. 1789 (unpack_concept_check): New. 1790 (get_concept_check_template): New. 1791 (build_call_check): Moved and renamed to build_function_check. 1792 (build_concept_check_arguments): make static. 1793 (build_function_check): Always do overload resolution 1794 in order to force conversion of template arguments (i.e., actually 1795 check that the use of a concept is valid). 1796 (build_standard_check): Renamed from build_real_concept_check. 1797 (build_real_concept_check): Build checks for C++2a concepts by 1798 (build_wildcard_concept_check): New. 1799 (build_concept_check): Use build_real_concept_check. New overload. 1800 (build_constraints): Save expressions, not normalized constraints. 1801 (build_concept_id): New. Pass tf_warning_or_error. 1802 (build_type_constraint): New. 1803 (finish_type_constraints): New. 1804 (associate_classtype_constraints): Also add constraints to union 1805 types. Note the original declaration in errors. Don't return 1806 error_mark_node in order to avoid an assertion later. 1807 (push_down_pack_expansion): Remove. 1808 (finish_shorthand_constraint): Make fold expressions, not naked 1809 parameter packs. Always apply the constraint to each template argument. 1810 (check_introduction_list): New. Fail if not enough 1811 names are introduced. 1812 (finish_template_introduction): Don't normalize constraints. Pass 1813 tsubst flags. Check for insufficient introductions. 1814 (placeholder_extract_concept_and_args): Handle the template-id case. 1815 Unpack function concept checks correctly. 1816 (tsubst_simple_requirement): Return errors if they occur. Don't 1817 process as a template. 1818 (tsubst_type_requirement): Likewise. 1819 (type_deducible_p): New. Wrap the input expression in parens for the 1820 purpose of deduction. 1821 (expression_convertible_t): New. 1822 (tsubst_compound_requirement): Use new deduction, conversion predicates. 1823 (tsubst_nested_requirement): Return errors if they occur. Don't 1824 process as a template. Instantiate and evaluate the nested requirement. 1825 (tsubst_valid_expression_requirement): New. 1826 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement. 1827 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement. 1828 (check_constaint_variables): New. 1829 (tsubst_constraint_variables): Check that type substitutions are valid. 1830 (tsubst_requires_expr): Likewise. Produce new requires-exprs during 1831 template substitution. Copy the previous local specialization stack, 1832 so references to non-local parameters can be found. Use cp_unevaluated. 1833 (tsubst_constraint): New. Don't evaluate concept checks. 1834 (subst_info): New. 1835 (norm_info): New. Used to build a normalization tree for concept check 1836 diagnostics. 1837 (debug_parameter_mapping): New. 1838 (debug_argument_list): New. 1839 (expand_concept): Removed. 1840 (normalize_logical_operation): Pass subst_info through call. 1841 (normalize_pack_expansion): Remove. 1842 (normalize_simple_requirement): Removed 1843 (normalize_type_requirement): Removed 1844 (normalize_compound_requirement): Removed 1845 (normalize_nested_requirement): Removed 1846 (normalize_requirement): Removed 1847 (normalize_requirements): Removed 1848 (normalize_requires_expression): Removed 1849 (normalize_variable_concept_check): Removed. 1850 (normalize_function_concept_check): Removed. 1851 (normalize_concept_check): Merged all normalize_*_check here. 1852 Substitute through written template arguments before normalizing the 1853 definition. Only substitute the innermost template arguments. 1854 (check_for_logical_overloads): Delete. 1855 (map_arguments): New. Associate template parameters with arguments. 1856 (build_parameter_mapping): New. Extract used parameters. 1857 (normalize_expression): Rewrite. 1858 (normalize_conjunction): Removed 1859 (normalize_disjunction): Removed 1860 (normalize_predicate_constraint): Removed 1861 (normalize_parameterized_constraint): Removed 1862 (normalized_map): New variable. 1863 (get_normalized_constraints): New entry point for normalization. 1864 Establishes a timer. 1865 (get_normalized_constraints_from_info): New. 1866 (get_normalized_constraints_from_decl): New. Turn on template processing 1867 prior to normalization. Handle inheriting ctors. Build the 1868 normalization arguments from the full set of template parameters of the 1869 most general template. This guarantees that we have no concrete arguments 1870 in the parameter mapping (e.g., from template members of class 1871 templates). Cache normalizations. 1872 (normalize_concept_definition): New. Cache normalizations. 1873 (normalize_template_requirements): New. 1874 (normalize_nontemplate_requirements): New. 1875 (normalize_constraint_expression): New. 1876 (tsubst_parameter_mapping): New. 1877 (get_mapped_args): New. 1878 (parameter_mapping_equivalent_p): New. Use template_args_equal. 1879 (atomic_constraints_identical_p): New. 1880 (hash_atomic_constraint): New. 1881 (satisfying_constraint_p): New. Guard against recursive evaluation of 1882 constraints during satisfaction. 1883 (satisfy_conjunction): New. 1884 (satisfy_disjunction): New. 1885 (sat_entry): New class for hashing satisfaction results. 1886 (sat_hasher): New hash traits. 1887 (sat_cache): New. 1888 (get_satisfaction): New. Returns cached satisfaction result. 1889 (save_satisfaction): New. Caches a satisfaction result. 1890 (clear_satisfaction_cache): New. 1891 (satisfaction_cache): New. Helps manage satisfaction cache requests. 1892 (decl_satisfied_cache): New. 1893 (satisfy_atom): New. 1894 (satisfy_constraint_r): New. 1895 (satisfy_constraint): Use new satisfaction algorithm. 1896 (evaluate_concept_check): New. 1897 (evaluate_concept): Removed. 1898 (evaluate_function_concept): Removed. 1899 (evaluate_variable_concept): Removed. 1900 (satisfy_constraint_expression): New. 1901 (constraint_expression_satisfied_p): New. 1902 (constraints_satisfied_p): Use strip_inheriting_ctors. Use 1903 push_/pop_access_scope. 1904 (more_constrained): Normalize before calling out to subsumption. Allow 1905 classes as arguments. 1906 (strictly_subsumes): Allow non-templates as arguments. Accept a new 1907 template argument. 1908 (weakly_subsumes): New. 1909 (at_least_as_constrained): Removed. 1910 (diagnose_other_expression): Removed. 1911 (diagnose_predicate_constraint): Removed. 1912 (diagnose_pack_expansion): Removed. 1913 (diagnose_check_constraint): Removed. 1914 (diagnose_logical_constraint): Removed. 1915 (diagnose_expression_constraint): Removed. 1916 (diagnose_type_constraint): Removed. 1917 (diagnose_implicit_conversion_constraint): Removed. 1918 (diagnose_argument_deduction_constraint): Removed. 1919 (diagnose_exception_constraint): Removed. 1920 (diagnose_parameterized_constraint): Removed. 1921 (diagnose_argument_deduction_constraint): Removed. 1922 (diagnose_argument_deduction_constraint): Removed. 1923 (diagnose_argument_deduction_constraint): Removed. 1924 (diagnose_trait_expr): New. 1925 (diagnose_requires_expr): New. 1926 (diagnose_atomic_constraint): New. 1927 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions. 1928 Don't substitute as if in template decls. This causes substitution 1929 to generate expressions that aren't suitable for use with the noexcept 1930 routines. 1931 (diagnose_valid_type) Likewise. 1932 (diagnose_compound_requirement) Actually emit diagnostics for 1933 the causes of errors.Call force_paren_expr_uneval. 1934 (diagnose_declaration_constraints): Turn on template processing to 1935 suppress certain analyses. 1936 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed. 1937 (cp_get_debug_type): Use hash_map_safe_*. 1938 * cp-tree.h: New function declarations for semantic actions, other 1939 facilities. Remove declaration no longer used or needed. Remove 1940 unused _CONSTR macros. 1941 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL. 1942 (template_info_decl_check): Factor macro check into an inline function. 1943 (DECL_TEMPLATE_INFO): Use new check facility. 1944 (finish_concept_definition): New. Don't invalid concept declarations 1945 with invalid initializers. 1946 (find_template_parameters): New. 1947 (concept_definition_p): New. 1948 (concept_check_p): New. 1949 (variable_concept_check_p): New. 1950 (force_paren_expr_uneval): New. 1951 (ovl_iterator::using_p): A USING_DECL by itself was also 1952 introduced by a using-declaration. 1953 (struct tree_template_info): Use tree_base instead of 1954 tree_common. Add tmpl and args fields. 1955 (TI_TEMPLATE, TI_ARGS): Adjust. 1956 (DECLTYPE_FOR_INIT_CAPTURE): Remove. 1957 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New. 1958 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New. 1959 (struct tree_trait_expr): Add locus field. 1960 (enum tsubst_flags): Add tf_norm as a hint to generate normalization 1961 context when diagnosing constraint failure. 1962 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR 1963 to ATOMIC_CONSTR. 1964 (CONCEPT_DECL): New. 1965 * cxx-pretty-print.c: Remove constraint printing code. 1966 (pp_cxx_concept_definition): New. 1967 (pp_cxx_template_declaration): Print concept definitions. 1968 (pp_cxx_check_constraint): Update printing for concept definitions. 1969 (pp_cxx_nested_name_specifier): Fix a weird 1970 case where we're printing '::::' for concepts. 1971 (simple_type_specifier): Print requirements for placeholder types. 1972 (pp_cxx_constrained_type_spec): Print the associated requirements of 1973 a placeholder type. 1974 (pp_cxx_compound_requirement): Add space before the '->'. 1975 (pp_cxx_parameter_mapping): Print the parameter mapping. 1976 (pp_cxx_atomic_constraint): Use the function above. 1977 * decl.c (redeclaration_error_message): New error for concepts. 1978 (grokdeclarator): Check for and disallow decltype(auto) in parameter 1979 declarations. 1980 (grokfndecl): Don't normalize constraints. Add check for constraints 1981 on declaration. 1982 (grokvardecl): Don't normalize constraints. 1983 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*. 1984 (function_requirements_equivalent_p): New. Compare trailing 1985 requires clauses. Compare combined constraints in pre-C++20 mode. 1986 (decls_match): Compare trailing requires clauses. Compare template 1987 heads for function templates. Remove old constraint comparison. 1988 Simplify comparison of functions, function templates. 1989 (duplicate_function_template_decls): New. Refactor a nasty if 1990 condition into a single predicate. 1991 (require_deduced_type): Don't complain if we already complained about 1992 deduction failure. 1993 (finish_function): Perform auto deduction to ensure that constraints 1994 are checked even when functions contain no return statements. Only do 1995 auto deduction if we haven't previously seen any return statements. 1996 This prevents multiple diagnostics of the same error. 1997 (store_decomp_type): Remove. 1998 (cp_finish_decomp): Use hash_map_safe_put. 1999 * error.c: Remove constraint printing code. 2000 (dump_decl): Dump concept definitions. Handle wildcard declarations. 2001 (dump_template_decl): Likewise. 2002 (dump_type): Print associated requirements for placeholder 2003 types. 2004 (rebuild_concept_check): New. 2005 (maybe_print_single_constraint_context): New. 2006 (maybe_print_constraint_context): Recursively print nested contexts. 2007 * init.c (get_nsdmi): Use hash_map_safe_*. 2008 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed. 2009 (add_capture): Copy parameter packs from init. 2010 (lambda_capture_field_type): Always use auto for init-capture. 2011 * logic.cc: Completely rewrite. 2012 (constraint_hash): New. 2013 (clause/ctor): Save atoms in the hash table. 2014 (replace): Save atoms during replacement. 2015 (insert): Save atoms during insertion. 2016 (contains): Only search the hash table for containment. 2017 (clause): Keep a hash of atomic constraints. 2018 (clause::clause): Explicitly copy the hash table when copying. 2019 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New. 2020 (diagnose_constraint_size): New. 2021 (subsumes_constraints_nonnull): Compare the sizes of normalized formula 2022 to determine the cheapest decomposition. 2023 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with 2024 concepts. 2025 (matching_fn_p): Check constraints. 2026 (push_class_level_binding_1): Move overloaded functions case down, 2027 accept FUNCTION_DECL as target_decl. 2028 * parser.c (enum required_token): New required token for auto. 2029 (make_location): Add overload taking lexer as last parm. 2030 (cp_parser_required_error): Diagnose missing auto. 2031 (cp_parser_diagnose_ungrouped_constraint_plain): New. 2032 (cp_parser_diagnose_ungrouped_constraint_plain): New. 2033 (cp_parser_constraint_primary_expression): New. Tentatively parse the 2034 primary expression. If that fails tentatively parse a lower 2035 precedence expression in order to diagnose the error. 2036 (cp_parser_check_non_logical_constraint): New. Performs a trial 2037 parse of the right-hand-side of non-logical operators in order to 2038 generate good diagnostics. 2039 (cp_parser_constraint_logical_and_expression): New. 2040 (cp_parser_constraint_logical_or_expression): New. 2041 (cp_parser_requires_clause_expression): New. 2042 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression. 2043 (cp_parser_requires_clause_opt): Parse the requires-clause differently 2044 in -fconcepts and -std=c++2a modes. 2045 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq. 2046 Rewrite so that semicolons are parsed 2047 along with requirements, not the sequence. 2048 (cp_parser_simple_requirement): Expect a semicolon at end. 2049 (cp_parser_compound_requirement): Expect a semicolon at end. Only 2050 allow trailing-return-type with -fconcepts-ts. 2051 (cp_parser_nested_requirement): Expect a semicolon at end. Parse 2052 constraint-expressions. 2053 (cp_parser_concept_definition): New. Don't fail parsing the concept 2054 definition if the initializer is ill-formed. Don't declare the concept 2055 before parsing the initializer. 2056 (cp_parser_constraint_expression): Declare earlier. 2057 (cp_parser_type_requirement): Current scope is not valid. 2058 (cp_parser_requires_expression): Commit to the tentative parse. 2059 (cp_parser_decl_specifier_seq): Warn when concept appears to be used 2060 as a decl-specifier. 2061 (cp_parser_template_declaration_after_parameters): Parse concept 2062 definitions. 2063 (cp_parser_template_id): Don't try to resolve a concept template-id yet. 2064 (cp_parser_template_id_expr): Resolve it as a concept check. 2065 (cp_parser_decl_specifier_seq): Warn on 'concept bool'. 2066 (cp_parser_type_parameter): Combine expressions not 2067 constraints. 2068 (cp_parser_explicit_template_declaration): Combine expressions not 2069 constraints. 2070 (cp_parser_maybe_concept_name): Removed. 2071 (cp_parser_simple_type_specifier): Handle an error condition of 2072 a bad constrained type specifier. Expect auto or decltype after 2073 a concept name. Also handle the case where we have a template-id 2074 as a concept check. 2075 (cp_parser_template_introduction): Diagnose errors on invalid 2076 introductions. Give up if it doesn't start with a concept name. 2077 Pedwarn if not -fconcepts-ts. 2078 (synthesize_implicit_template_parm): Don't do consistent binding. 2079 Use a new flag for constrained parameters. Combine expressions, 2080 not constraints. Fail if we get a placeholder in block scope. 2081 Placeholders that do not constrain types are not allowed in parameter 2082 declarations, so don't handle them. 2083 (cp_parser_placeholder_type_specifier): New. Implement parsing of 2084 placeholder type specifiers following a concept name or partial 2085 concept check. Disallow decltype(auto) parameters. 2086 (cp_parser_nested_name_specifier_opt): If the token is already 2087 CPP_NESTED_NAME_SPECIFIER, leave it alone. 2088 (cp_parser_id_expression, cp_parser_unqualified_id): Call 2089 cp_parser_template_id_expr. 2090 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't 2091 expect a WILDCARD_DECL. 2092 (cp_parser_trait_expr): Pass trait_loc down. 2093 (cp_parser_postfix_expression): Do set location of dependent member 2094 call. 2095 * pt.c (finish_concept_definition): New. 2096 (push_template_decl_real): Handle concept definitions. 2097 (start_concept_definition): Let push_template_decl_real handle the 2098 creation of the template. 2099 (get_constraints): Return null if the table hasn't been initialized. 2100 (tsubst_copy_and_build): Build template-id expressions for concept 2101 checks. 2102 [TRAIT_EXPR]: Pass trait_loc down. 2103 (lookup_template_class_1): Add the template name to the constraint 2104 failure diagnostic. 2105 (lookup_and_finish_template_variable): Build concept checks 2106 with the correct arguments. 2107 (tsubst_function_decl): Don't substitute through constraints. 2108 Always associate constraints with functions. 2109 (template_parm_level_and_index): Make non-static. 2110 (for_each_template_parm_r): Handle requires expressions. 2111 (keep_template_parm): New. 2112 (find_template_parameters): New. 2113 (more_specialized_fn): Change how winners and losers are chosen. 2114 (make_constrained_auto): Don't normalize constraints. 2115 (template_parameters_equivalent_p): New. Compare template 2116 parameters. Add a comparison for implicitly vs. explicitly declared 2117 parameters. 2118 (template_parameter_lists_equivalent_p): New. Compare template 2119 parameter lists. 2120 (template_requirements_equivalent_p): New. 2121 (template_heads_equivalent_p): New. Compare template heads. 2122 (template_parameter_constraints_equivalent_p): New. 2123 (is_compatible_template_arg): Use weakly_subsumes. 2124 (maybe_new_partial_specialization): Use new constraint comparison 2125 for finding specializations. 2126 (process_partial_specialization): Pass main template as argument. 2127 (more_specialized_partial_spec): Don't immediately return when 2128 detecting a winner. 2129 (make_constrained_auto): Handle concept definitions. 2130 (do_auto_deduction): Update auto deduction for new concept model. 2131 Extract the function concept correctly; rename constr to check to 2132 reflect the kind of node. 2133 (tsubst): Adjust wildcard argument during substitution. 2134 [DECLTYPE_TYPE]: Remove init-capture handling. 2135 (tsubst_copy_and_build): Build concept checks, not template ids. 2136 Defer checks of function concepts. Handle concepts before variable 2137 templates. Handle calls to function concepts explicitly. 2138 (coerce_template_parms): Use concept_definition_p. Handle a deduction 2139 error where a potentially empty pack can be supplied after the last 2140 parameter of a concept. 2141 (finish_template_variable): Don't process concepts here. 2142 (instantiation_dependent_r): Use concept_check_p. 2143 (tsubst_template_args): Make non-static. 2144 (make_constrained_placeholder_type): New. Refactored from 2145 make_constrained_auto. 2146 (make_constrained_auto) Use make_constrained_placeholder_type. 2147 (make_constrained_decltype_auto) New. 2148 (tsubst_function_parms): New. 2149 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use 2150 concept_definition_p. 2151 (push_access_scope, pop_access_scope): No longer static. 2152 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS. 2153 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for. 2154 (get_underlying_template) Use generic_targs_for. 2155 (uses_parameter_packs): Return tree. 2156 (gen_elem_of_pack_expansion_instantiation): Don't push 2157 local_specialization_stack. 2158 (prepend_one_capture): New. 2159 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch 2160 local_specializations. 2161 (template_parms_level_to_args): No longer static. 2162 (add_outermost_template_args): Likewise. 2163 (find_template_parameter_info): New. Provide context for finding 2164 template parameters. 2165 (keep_template_parm): Don't keep parameters declared at depth levels 2166 greater than those of the template parameters of the source declaration. 2167 Don't propagate cv-qualified types. Return 0, so we find all template 2168 parameters, not the just first. 2169 (any_template_parm_r): New. Handle cases that are mishandled by 2170 for_each_template_parm_r. 2171 (generic_targs_for): Factor out of coerce_template_args_for_ttp. 2172 (tsubst_argument_pack): Factor out of tsubst_template_args. 2173 (constraint_sat_entry): Removed. 2174 (constraint_sat_hasher): Removed. 2175 (concept_spec_entry): Removed. 2176 (concept_spec_hasher): Removed. 2177 (constraint_memos): Removed. 2178 (concept_memos): Removed. 2179 (lookup_constraint_satisfaction): Removed. 2180 (memoize_constraint_satisfaction): Removed. 2181 (lookup_concept_satisfaction): Removed. 2182 (memoize_concept_satisfaction): Removed. 2183 (concept_expansions): Removed. 2184 (get_concept_expansion): Removed. 2185 (save_concept_expansion): Removed. 2186 (init_constraint_processing): Remove initialization of non-existing 2187 resources. 2188 (find_template_requirement): New. Search for the sub-requirement 2189 within the associated constraints. 2190 (convert_generic_types_to_packs): Also transform the associated 2191 constraint and update the current template requirements. 2192 (store_defaulted_ttp, lookup_defaulted_ttp): Remove. 2193 (add_defaults_to_ttp): Use hash_map_safe_*. 2194 * semantics.c (finish_call_expr): Diagnose calls to concepts. 2195 Handle concept checks explicitly. 2196 (finish_id_expression): Evaluate variable concepts as part of 2197 id-expression processing. Don't treat variable concepts as variables, 2198 and don't process function concepts as plain id-expressions. 2199 (force_paren_expr): Add even_uneval parm. 2200 (finish_trait_expr): Add location parm. 2201 * tree.c (special_memfn_p): New. 2202 (cp_expr_location): Handle TRAIT_EXPR. 2203 * typeck.c (check_return_expr): Actually use the diagnostic kind 2204 when performing return-type deduction. 2205 * typeck2.c (build_functional_cast): Don't rely on the location of 2206 'auto'. 2207 22082019-10-09 Paolo Carlini <paolo.carlini@oracle.com> 2209 2210 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION. 2211 * typeck.c (cp_build_binary_op): Use the op_location_t argument 2212 in many error messages. 2213 22142019-10-08 Martin Sebor <msebor@redhat.com> 2215 2216 PR c++/92001 2217 * call.c (maybe_warn_class_memaccess): Handle arrays. 2218 22192019-10-07 Paolo Carlini <paolo.carlini@oracle.com> 2220 2221 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place. 2222 * decl.c (grokdeclarator): Use id_loc in one place. 2223 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION. 2224 * parser.c (cp_parser_delete_expression): Fix the location of the 2225 returned expression. 2226 (cp_parser_throw_expression): Likewise. 2227 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION. 2228 22292019-10-05 Jakub Jelinek <jakub@redhat.com> 2230 2231 PR c++/91369 - Implement P0784R7: constexpr new 2232 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER, 2233 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER. 2234 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier): 2235 Define. 2236 (type_has_constexpr_destructor, build_new_constexpr_heap_type, 2237 cxx_constant_dtor): Declare. 2238 * class.c (type_maybe_constexpr_default_constructor): Make static. 2239 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New 2240 functions. 2241 (finalize_literal_type_property): For c++2a, don't clear 2242 CLASSTYPE_LITERAL_P for types without trivial destructors unless they 2243 have non-constexpr destructors. 2244 (explain_non_literal_class): For c++2a, complain about non-constexpr 2245 destructors rather than about non-trivial destructors. 2246 * constexpr.c: Include stor-layout.h. 2247 (struct constexpr_global_ctx): New type. 2248 (struct constexpr_ctx): Add global field, remove values and 2249 constexpr_ops_count. 2250 (cxx_replaceable_global_alloc_fn): New inline function. 2251 (cxx_eval_call_expression): For c++2a allow calls to replaceable 2252 global allocation functions, for new return address of a heap uninit 2253 var, for delete record its deletion. Change ctx->values->{get,put} to 2254 ctx->global->values.{get,put}. 2255 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit 2256 special diagnostics for heap variables. 2257 (cxx_eval_store_expression): Change ctx->values->{get,put} to 2258 ctx->global->values.{get,put}. 2259 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change 2260 new_ctx.values->remove to ctx->global->values.remove. 2261 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count 2262 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to 2263 ctx->global->values.{get,put}. 2264 <case NOP_EXPR>: Formatting fix. On cast of replaceable global 2265 allocation function to some pointer type, adjust the type of 2266 the heap variable and change name from heap_uninit_identifier 2267 to heap_identifier. 2268 (find_heap_var_refs): New function. 2269 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument, 2270 handle evaluation of constexpr dtors and add tracking of heap 2271 variables. Use tf_no_cleanup for get_target_expr_with_sfinae. 2272 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller. 2273 (cxx_constant_dtor): New function. 2274 (maybe_constant_value, fold_non_dependent_expr_template, 2275 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr 2276 callers. 2277 (potential_constant_expression_1): Ignore clobbers. Allow 2278 COND_EXPR_IS_VEC_DELETE for c++2a. 2279 * decl.c (initialize_predefined_identifiers): Add heap identifiers. 2280 (decl_maybe_constant_destruction): New function. 2281 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables 2282 with non-trivial, but constexpr destructors. 2283 (register_dtor_fn): For constexpr variables with constexpr non-trivial 2284 destructors call cxx_maybe_build_cleanup instead of adding destructor 2285 calls at runtime. 2286 (expand_static_init): For constexpr variables with constexpr 2287 non-trivial destructors call cxx_maybe_build_cleanup. 2288 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting 2289 fix. 2290 (cxx_maybe_build_cleanup): For constexpr variables with constexpr 2291 non-trivial destructors call cxx_constant_dtor instead of adding 2292 destructor calls at runtime. 2293 * init.c: Include stor-layout.h. 2294 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New 2295 functions. 2296 (build_new_1): For c++2a and new[], add cast around the alloc call 2297 to help constexpr evaluation figure out the type of the heap storage. 2298 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR 2299 for it instead of initializing an uninitialized variable. 2300 * method.c: Include intl.h. 2301 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move 2302 definitions earlier. 2303 (process_subob_fn): Add sfk argument, adjust non-constexpr call 2304 diagnostics based on it. 2305 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller. 2306 (synthesized_method_base_walk): Likewise. 2307 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a. 2308 Fix up DR number in comment. 2309 (implicitly_declare_fn): Formatting fix. 2310 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on 2311 initializers of automatic non-constexpr variables in constexpr 2312 functions. 2313 23142019-10-04 Jakub Jelinek <jakub@redhat.com> 2315 2316 PR c++/71504 2317 * constexpr.c (cxx_fold_indirect_ref_1): New function. 2318 (cxx_fold_indirect_ref): Use it. 2319 2320 PR c++/91974 2321 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For 2322 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated 2323 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't 2324 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary. 2325 23262019-10-03 Paolo Carlini <paolo.carlini@oracle.com> 2327 2328 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places. 2329 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION. 2330 (push_class_level_binding_1): Likewise. 2331 (set_decl_namespace): Likewise. 2332 23332019-10-03 Jakub Jelinek <jakub@redhat.com> 2334 2335 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If 2336 not skipping upon entry to body, run cleanup with the same *jump_target 2337 as it started to run the cleanup even if the body returns, breaks or 2338 continues. 2339 (potential_constant_expression_1): Allow CLEANUP_STMT. 2340 2341 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle 2342 const_object_being_modified with array type. 2343 23442019-10-02 Jason Merrill <jason@redhat.com> 2345 2346 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the 2347 value is constant. 2348 23492019-09-30 Jason Merrill <jason@redhat.com> 2350 2351 Use hash_map_safe_* functions. 2352 * constexpr.c (maybe_initialize_fundef_copies_table): Remove. 2353 (get_fundef_copy): Use hash_map_safe_get_or_insert. 2354 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*. 2355 * decl.c (store_decomp_type): Remove. 2356 (cp_finish_decomp): Use hash_map_safe_put. 2357 * init.c (get_nsdmi): Use hash_map_safe_*. 2358 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove. 2359 (add_defaults_to_ttp): Use hash_map_safe_*. 2360 23612019-10-02 Richard Biener <rguenther@suse.de> 2362 2363 PR c++/91606 2364 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member 2365 fat pointer structure members as DECL_NONADDRESSABLE_P. 2366 23672019-09-28 Marek Polacek <polacek@redhat.com> 2368 2369 PR c++/91889 - follow-up fix for DR 2352. 2370 * call.c (involves_qualification_conversion_p): New function. 2371 (direct_reference_binding): Build a ck_qual if the conversion 2372 would involve a qualification conversion. 2373 (convert_like_real): Strip the conversion created by the ck_qual 2374 in direct_reference_binding. 2375 2376 PR c++/91921 - stray warning with -Woverloaded-virtual. 2377 * class.c (warn_hidden): Only emit the second part of 2378 -Woverloaded-virtual if the first part was issued. Use inform instead 2379 warning_at. 2380 2381 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17. 2382 * pt.c (invalid_nontype_parm_type_p): Only emit errors when 2383 tf_error. 2384 23852019-09-27 Jakub Jelinek <jakub@redhat.com> 2386 2387 PR c++/88203 2388 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined 2389 variables. 2390 * semantics.c (finish_omp_clauses): Allow predefined variables in 2391 shared and firstprivate clauses, even when they are predetermined 2392 shared. 2393 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return 2394 OMP_CLAUSE_DEFAULT_SHARED for predefined variables. 2395 23962019-09-27 Jason Merrill <jason@redhat.com> 2397 2398 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p. 2399 (cxx_eval_indirect_ref): Likewise. Improve error location. 2400 2401 * cp-tree.h (class iloc_sentinel): New. 2402 * decl.c (grokdeclarator, finish_enum_value_list): Use it. 2403 * mangle.c (mangle_decl_string): Use it. 2404 * pt.c (perform_typedefs_access_check): Use it. 2405 24062019-09-27 Richard Sandiford <richard.sandiford@arm.com> 2407 2408 * cp-tree.h (build_cxx_call): Take the original function decl 2409 as an optional final parameter. 2410 (cp_build_function_call_vec): Likewise. 2411 * call.c (build_cxx_call): Likewise. Pass all built-in calls to 2412 check_builtin_function_arguments. 2413 * typeck.c (build_function_call_vec): Take the original function 2414 decl as an optional final parameter and pass it to 2415 cp_build_function_call_vec. 2416 (cp_build_function_call_vec): Take the original function 2417 decl as an optional final parameter and pass it to build_cxx_call. 2418 24192019-09-25 Marek Polacek <polacek@redhat.com> 2420 2421 PR c++/91877 - ICE with converting member of packed struct. 2422 * call.c (convert_like_real): Use similar_type_p in an assert. 2423 24242019-09-25 Paolo Carlini <paolo.carlini@oracle.com> 2425 2426 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION. 2427 (check_local_shadow): Use it in three additional places. 2428 24292019-09-24 Jason Merrill <jason@redhat.com> 2430 2431 * parser.c (cp_parser_postfix_expression): Do set location of 2432 dependent member call. 2433 24342019-09-24 Marek Polacek <polacek@redhat.com> 2435 2436 PR c++/91868 - improve -Wshadow location. 2437 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION 2438 instead of input_location. 2439 2440 PR c++/91845 - ICE with invalid pointer-to-member. 2441 * expr.c (mark_use): Use error_operand_p. 2442 * typeck2.c (build_m_component_ref): Check error_operand_p after 2443 calling mark_[lr]value_use. 2444 24452019-09-23 Paolo Carlini <paolo.carlini@oracle.com> 2446 2447 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc. 2448 (process_partial_specialization): Likewise. 2449 (convert_nontype_argument_function): Likewise. 2450 (invalid_tparm_referent_p): Likewise. 2451 (convert_template_argument): Likewise. 2452 (check_valid_ptrmem_cst_expr): Tidy. 2453 24542019-09-23 Jason Merrill <jason@redhat.com> 2455 2456 PR c++/91809 - bit-field and ellipsis. 2457 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for 2458 arithmetic arguments. 2459 24602019-09-23 Marek Polacek <polacek@redhat.com> 2461 2462 PR c++/91844 - Implement CWG 2352, Similar types and reference binding. 2463 * call.c (reference_related_p): Use similar_type_p instead of 2464 same_type_p. 2465 (reference_compatible_p): Update implementation to match CWG 2352. 2466 * cp-tree.h (similar_type_p): Declare. 2467 * typeck.c (similar_type_p): New. 2468 24692019-09-22 Marek Polacek <polacek@redhat.com> 2470 2471 PR c++/91819 - ICE with operator++ and enum. 2472 * call.c (build_new_op_1): Set arg2_type. 2473 24742019-09-17 Jason Merrill <jason@redhat.com> 2475 2476 * parser.c (cp_parser_statement): Handle [[likely]] on 2477 compound-statement. 2478 24792019-09-19 Jason Merrill <jason@redhat.com> 2480 2481 Revert: 2482 * call.c (build_new_op_1): Don't apply any standard conversions to 2483 the operands of a built-in operator. Don't suppress conversions in 2484 cp_build_unary_op. 2485 * typeck.c (cp_build_unary_op): Do integral promotions for enums. 2486 24872019-09-16 Paolo Carlini <paolo.carlini@oracle.com> 2488 2489 * decl.c (grokdeclarator): Use declspecs->locations and 2490 declarator->id_loc in a few error messages. 2491 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION. 2492 (push_template_decl_real): Likewise. 2493 24942019-09-15 Jason Merrill <jason@redhat.com> 2495 2496 PR c++/30277 - int-width bit-field promotion. 2497 PR c++/33819 - long bit-field promotion. 2498 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields 2499 properly. Handle 32-bit non-int bit-fields properly. 2500 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR. 2501 2502 PR c++/82165 - enum bitfields and operator overloading. 2503 * call.c (build_new_op_1): Use unlowered_expr_type. 2504 2505 * call.c (build_new_op_1): Don't apply any standard conversions to 2506 the operands of a built-in operator. Don't suppress conversions in 2507 cp_build_unary_op. 2508 * typeck.c (cp_build_unary_op): Do integral promotions for enums. 2509 25102019-09-15 Marek Polacek <polacek@redhat.com> 2511 2512 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF. 2513 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for 2514 the first operand. 2515 25162019-09-15 Nathan Sidwell <nathan@acm.org> 2517 2518 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using 2519 IDENTIFIER_CDTOR_P, correct documentation. 2520 (DECL_CLONED_FUNCTION): Directly access field. 2521 (decl_cloned_function_p): Delete. 2522 * class.c (decl_cloned_function_p): Delete. 2523 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl. 2524 25252019-09-11 Nathan Sidwell <nathan@acm.org> 2526 2527 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and 2528 correctly mark all C++ nodes. 2529 * decl.c (cp_tree_node_structure): Alphabetize. 2530 25312019-09-10 Marek Polacek <polacek@redhat.com> 2532 2533 PR c++/91673 - ICE with noexcept in alias-declaration. 2534 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag. 2535 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to 2536 cp_parser_exception_specification_opt. 2537 (cp_parser_direct_declarator): Adjust a call to 2538 cp_parser_exception_specification_opt. 2539 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT 2540 to cp_parser_declarator if not processing a friend or typedef 2541 declaration. 2542 (cp_parser_late_noexcept_specifier): Adjust a call to 2543 cp_parser_noexcept_specification_opt. 2544 (cp_parser_noexcept_specification_opt): New parameter for parser flags, 2545 drop the FRIEND_P parameter. Use the new parameter. 2546 (cp_parser_exception_specification_opt): Likewise. 2547 (cp_parser_transaction): Adjust a call to 2548 cp_parser_noexcept_specification_opt. 2549 (cp_parser_transaction_expression): Likewise. 2550 25512019-09-10 Marek Polacek <polacek@redhat.com> 2552 2553 PR c++/91705 - constexpr evaluation rejects ++/-- on floats. 2554 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on 2555 the offset. 2556 25572019-09-10 Paolo Carlini <paolo.carlini@oracle.com> 2558 2559 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc 2560 in error_at. 2561 (build_enumerator): Likewise. 2562 (cp_finish_decl): Use DECL_SOURCE_LOCATION. 2563 (grokdeclarator): Use id_loc in two error_at; change errror 2564 message about constinit together constexpr to use two ranges. 2565 25662019-09-09 Marek Polacek <polacek@redhat.com> 2567 2568 PR c++/84374 - diagnose invalid uses of decltype(auto). 2569 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in 2570 a function declaration. 2571 25722019-09-06 Nathan Sidwell <nathan@acm.org> 2573 2574 PR c++/91125 2575 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete. 2576 (struct lang_decl_base): Remove repo_available_p. 2577 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P. 2578 2579 (Reserve TREE_LANG_FLAG_3 for modules. 2580 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete. 2581 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6. 2582 * class.c (build_ctor_vtbl_group): Don't set 2583 DECL_CONSTRUCTION_VTABLE_P. 2584 * decl2.c (determine_visibility_from_class): Don't check 2585 DECL_CONSTRUCTION_VTABLE_P anymore. 2586 25872019-09-06 Martin Liska <mliska@suse.cz> 2588 2589 PR c++/91125 2590 * Make-lang.in: Remove repo.o. 2591 * config-lang.in: Likewise. 2592 * cp-tree.h (init_repo): Remove declarations 2593 of repo-related functions. 2594 (repo_emit_p): Likewise. 2595 (repo_export_class_p): Likewise. 2596 (finish_repo): Likewise. 2597 * decl2.c (import_export_class): Always 2598 set -1 value/ 2599 (mark_needed): Remove -frepo from comment. 2600 (import_export_decl): Similarly here. 2601 (c_parse_final_cleanups): Remove call of finish_repo. 2602 * lex.c (cxx_init): Remove call to init_repo. 2603 * optimize.c (can_alias_cdtor): Remove dead condition. 2604 * pt.c (push_template_decl_real): Update comment. 2605 (instantiate_decl): Remove dead code used for -frepo. 2606 * repo.c: Remove. 2607 26082019-09-05 Marek Polacek <polacek@redhat.com> 2609 2610 PR c++/91644 - ICE with constinit in function template. 2611 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables. 2612 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for 2613 constinit variables. 2614 26152019-09-05 Nathan Sidwell <nathan@acm.org> 2616 2617 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P. 2618 26192019-09-04 Marek Polacek <polacek@redhat.com> 2620 2621 * call.c (build_over_call): Remove -fdeduce-init-list implementation. 2622 * pt.c (unify): Likewise. 2623 26242019-09-01 Marek Polacek <polacek@redhat.com> 2625 2626 PR c++/91129 - wrong error with binary op in template argument. 2627 * typeck.c (warn_for_null_address): Use fold_for_warn instead of 2628 fold_non_dependent_expr. 2629 (cp_build_binary_op): Likewise. 2630 26312019-08-30 Jason Merrill <jason@redhat.com> 2632 2633 Add source location to TRAIT_EXPR. 2634 * cp-tree.h (TRAIT_EXPR_LOCATION): New. 2635 (struct tree_trait_expr): Add locus field. 2636 * parser.c (cp_parser_trait_expr): Pass trait_loc down. 2637 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise. 2638 * semantics.c (finish_trait_expr): Add location parm. 2639 * tree.c (cp_expr_location): Handle TRAIT_EXPR. 2640 26412019-08-29 Paolo Carlini <paolo.carlini@oracle.com> 2642 2643 * decl.c (check_var_type): Add location_t parameter and use it. 2644 (grokdeclarator): Adjust call. 2645 * pt.c (tsubst_decl): Likewise. 2646 * cp-tree.h: Adjust declaration. 2647 26482019-08-28 Marek Polacek <polacek@redhat.com> 2649 2650 Implement P1152R4: Deprecating some uses of volatile. 2651 PR c++/91361 2652 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE. 2653 * decl.c (grokdeclarator): Warn about a volatile-qualified structured 2654 binding and return type. 2655 (grokparms): Warn about a volatile-qualified function parameter. 2656 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning. 2657 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and 2658 post ++/-- on a volatile operand. 2659 (genericize_compound_lvalue): Use a better location. Don't lose 2660 TREE_THIS_VOLATILE. 2661 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound 2662 assignment whose LHS is volatile-qualified. Build the assignment with 2663 a more precise location. 2664 26652019-08-28 Marek Polacek <polacek@redhat.com> 2666 2667 PR c++/91360 - Implement C++20 P1143R2: constinit. 2668 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define. 2669 (LOOKUP_CONSTINIT): Define. 2670 (enum cp_decl_spec): Add ds_constinit. 2671 * decl.c (check_tag_decl): Give an error for constinit in type 2672 declarations. 2673 (check_initializer): Also check LOOKUP_CONSTINIT. 2674 (cp_finish_decl): Add checking for a constinit declaration. Set 2675 TINFO_VAR_DECLARED_CONSTINIT. 2676 (grokdeclarator): Add checking for a declaration with the constinit 2677 specifier. 2678 * lex.c (init_reswords): Handle D_CXX20. 2679 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location 2680 to warning_at. Warn about C++20 keywords. 2681 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT. 2682 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit. 2683 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to 2684 cp_finish_decl. 2685 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT. 2686 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to 2687 cp_finish_decl. 2688 (set_and_check_decl_spec_loc): Add "constinit". 2689 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT. 2690 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl. 2691 * typeck2.c (store_init_value): If a constinit variable wasn't 2692 initialized using a constant initializer, give an error. 2693 26942019-08-28 Nathan Sidwell <nathan@acm.org> 2695 2696 PR c++/90613 2697 * name-lookup.c (cp_emit_debug_info): Check for builtins during 2698 overload iteration. 2699 27002019-08-27 Marek Polacek <polacek@redhat.com> 2701 2702 PR c++/81676 - bogus -Wunused warnings in constexpr if. 2703 * semantics.c (maybe_mark_exp_read_r): New function. 2704 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE. 2705 2706 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr. 2707 * cp-tree.h (decl_in_std_namespace_p): Declare. 2708 * semantics.c (is_std_constant_evaluated_p): New. 2709 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in 2710 an if-constexpr. 2711 * typeck.c (decl_in_std_namespace_p): No longer static. 2712 27132019-08-26 Jason Merrill <jason@redhat.com> 2714 2715 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P. 2716 27172019-08-26 Marek Polacek <polacek@redhat.com> 2718 2719 PR c++/91545 - ICE in constexpr store evaluation. 2720 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead 2721 of DECL_P. 2722 27232019-08-24 Nathan Sidwell <nathan@acm.org> 2724 2725 * class.c (check_for_overrides): Conversion operators need 2726 checking too. 2727 27282019-08-24 Paolo Carlini <paolo.carlini@oracle.com> 2729 2730 * semantics.c (finish_switch_cond): Improve error message location. 2731 27322019-08-23 Jason Merrill <jason@redhat.com> 2733 2734 * decl2.c (decl_dependent_p): New. 2735 (mark_used): Check it instead of just processing_template_decl. 2736 27372019-08-23 Jason Merrill <jason@redhat.com> 2738 2739 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant 2740 error. 2741 27422019-08-23 Marek Polacek <polacek@redhat.com> 2743 2744 PR c++/91521 - wrong error with operator->. 2745 * decl.c (grokdeclarator): Return error_mark_node for an invalid 2746 trailing return type. 2747 2748 PR c++/79817 - attribute deprecated on namespace. 2749 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare. 2750 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes. 2751 (type_is_deprecated): Likewise. 2752 * decl2.c (cp_warn_deprecated_use_scopes): New function. 2753 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated. 2754 * parser.c (cp_parser_namespace_alias_definition): Call 2755 cp_warn_deprecated_use_scopes. 2756 (cp_parser_using_declaration): Likewise. 2757 (cp_parser_using_directive): Likewise. 2758 * semantics.c (finish_id_expression_1): Likewise. 2759 27602019-08-23 Nathan Sidwell <nathan@acm.org> 2761 2762 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is 2763 sufficient, reorder DECL_OVERRIDE_P check. 2764 27652019-08-23 Iain Sandoe <iain@sandoe.co.uk> 2766 2767 PR pch/61250 2768 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch () 2769 after determining that the first token is not 2770 PRAGMA_GCC_PCH_PREPROCESS. 2771 27722019-08-22 Marek Polacek <polacek@redhat.com> 2773 2774 PR c++/91304 - prefix attributes ignored in condition. 2775 * parser.c (cp_parser_condition): Handle prefix attributes. 2776 27772019-08-21 Richard Sandiford <richard.sandiford@arm.com> 2778 2779 PR c++/91505 2780 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside 2781 the BUILT_IN_NORMAL block rather than afterward. 2782 27832019-08-19 Marek Polacek <polacek@redhat.com> 2784 2785 PR c++/91264 - detect modifying const objects in constexpr. 2786 * constexpr.c (modifying_const_object_error): New function. 2787 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of 2788 a const-qualified object after it's been fully constructed. 2789 (modifying_const_object_p): New function. 2790 (cxx_eval_store_expression): Detect modifying a const object 2791 during constant expression evaluation. 2792 (cxx_eval_increment_expression): Use a better location when building 2793 up the store. 2794 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant 2795 object's constructor TREE_READONLY. 2796 27972019-08-15 Jason Merrill <jason@redhat.com> 2798 2799 PR c++/90393 - ICE with thow in ?: 2800 2801 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?: 2802 * tree.c (lvalue_kind): Handle throw in one arm. 2803 * typeck.c (rationalize_conditional_expr): Likewise. 2804 (cp_build_modify_expr): Likewise. 2805 28062019-08-14 Jason Merrill <jason@redhat.com> 2807 2808 Implement P0848R3, Conditionally Trivial Special Member Functions. 2809 * tree.c (special_memfn_p): New. 2810 * class.c (add_method): When overloading, hide ineligible special 2811 member fns. 2812 (check_methods): Set TYPE_HAS_COMPLEX_* here. 2813 * decl.c (grok_special_member_properties): Not here. 2814 * name-lookup.c (push_class_level_binding_1): Move overloaded 2815 functions case down, accept FUNCTION_DECL as target_decl. 2816 28172019-08-14 Jonathan Wakely <jwakely@redhat.com> 2818 2819 PR c++/91436 2820 * name-lookup.c (get_std_name_hint): Fix min_dialect field for 2821 complex_literals and make_unique entries. 2822 28232019-08-14 Jakub Jelinek <jakub@redhat.com> 2824 Marek Polacek <polacek@redhat.com> 2825 2826 PR c++/91391 - bogus -Wcomma-subscript warning. 2827 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about 2828 a deprecated comma here. Pass warn_comma_subscript down to 2829 cp_parser_expression. 2830 (cp_parser_expression): New bool parameter. Warn about uses of a comma 2831 operator within a subscripting expression. 2832 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state. 2833 (cp_parser_skip_to_closing_square_bracket_1): Remove. 2834 28352019-08-14 Jonathan Wakely <jwakely@redhat.com> 2836 2837 * name-lookup.c (get_std_name_hint): Add more entries. 2838 28392019-08-14 Paolo Carlini <paolo.carlini@oracle.com> 2840 2841 * decl2.c (grok_array_decl): Use the location of the open square 2842 bracket in error message about invalid types. 2843 28442019-08-14 Paolo Carlini <paolo.carlini@oracle.com> 2845 2846 * decl.c (grokdeclarator): Check here for typedef a function 2847 definition or a member function definition. 2848 (start_function): Adjust. 2849 (grokmethod): Likewise. 2850 28512019-08-13 Richard Sandiford <richard.sandiford@arm.com> 2852 2853 PR middle-end/91421 2854 * decl.c (duplicate_decls): Use copy_decl_built_in_function. 2855 * pt.c (declare_integer_pack): Use set_decl_built_in_function. 2856 28572019-08-13 Marek Polacek <polacek@redhat.com> 2858 2859 PR c++/90473 - wrong code with nullptr in default argument. 2860 * call.c (null_ptr_cst_p): Update quote from the standard. 2861 * decl.c (check_default_argument): Don't return nullptr when the arg 2862 has side-effects. 2863 28642019-08-13 Marek Polacek <polacek@redhat.com> 2865 2866 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK. 2867 28682019-08-10 Jakub Jelinek <jakub@redhat.com> 2869 2870 * parser.c (cp_parser_omp_clause_name): Parse device_type. 2871 (cp_parser_omp_clause_device_type): New function. 2872 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE. 2873 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE. 2874 (cp_parser_omp_declare_target): Handle device_type clauses. Remove 2875 diagnostics for declare target with clauses nested in clause-less 2876 declare target declaration-definition-seq. 2877 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE. 2878 28792019-08-09 Jakub Jelinek <jakub@redhat.com> 2880 2881 * parser.c (check_no_duplicate_clause): Simplify using 2882 omp_find_clause. 2883 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data 2884 directive name modifiers. 2885 2886 PR c/91401 2887 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the 2888 check_no_duplicate_clause call, instead emit a warning for duplicate 2889 dist_schedule clauses. 2890 28912019-08-08 Paolo Carlini <paolo.carlini@oracle.com> 2892 2893 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in 2894 a few error messages. 2895 28962019-08-08 Marek Polacek <polacek@redhat.com> 2897 2898 PR c++/87519 - bogus warning with -Wsign-conversion. 2899 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing 2900 the types directly. 2901 2902 * constexpr.c (inline_asm_in_constexpr_error): New. 2903 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it. 2904 (potential_constant_expression_1) <case ASM_EXPR>: Likewise. 2905 29062019-08-08 Jakub Jelinek <jakub@redhat.com> 2907 2908 * semantics.c (finish_omp_clauses): For C_ORT_OMP 2909 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap 2910 instead of generic_head to track duplicates. 2911 29122019-08-07 Marek Polacek <polacek@redhat.com> 2913 2914 PR c++/81429 - wrong parsing of constructor with C++11 attribute. 2915 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario 2916 when a parameter declaration begins with [[attribute]]. 2917 29182019-08-07 Marek Polacek <polacek@redhat.com> 2919 2920 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr. 2921 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR. 2922 (potential_constant_expression_1) <case ASM_EXPR>: Allow. 2923 * cp-tree.h (finish_asm_stmt): Adjust. 2924 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and 2925 use it. Change an error to a pedwarn. Allow asm in C++2a, warn 2926 otherwise. 2927 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt. 2928 * semantics.c (finish_asm_stmt): New location_t parameter. Use it. 2929 29302019-08-07 Jakub Jelinek <jakub@redhat.com> 2931 2932 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause. 2933 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR. 2934 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR. 2935 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR 2936 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no 2937 map or use_device_* clauses. 2938 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR 2939 in OpenMP, require pointer or reference to pointer type rather than 2940 pointer or array or reference to pointer or array type. Handle 2941 OMP_CLAUSE_USE_DEVICE_ADDR. 2942 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR. 2943 29442019-08-06 Jason Merrill <jason@redhat.com> 2945 2946 PR c++/91378 - ICE with noexcept and auto return type. 2947 * pt.c (maybe_instantiate_noexcept): push_to_top_level. 2948 29492019-08-06 Paolo Carlini <paolo.carlini@oracle.com> 2950 2951 * decl.c (check_array_designated_initializer): Use 2952 cp_expr_loc_or_input_loc in one place. 2953 29542019-08-06 Jakub Jelinek <jakub@redhat.com> 2955 2956 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel 2957 clauses and predetermine iterator as lastprivate. 2958 * semantics.c (handle_omp_for_class_iterator): Use 2959 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of 2960 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also 2961 on OMP_LOOP construct. If a clause is missing for class iterator 2962 on OMP_LOOP, add firstprivate clause, and if there is private 2963 clause, turn it into firstprivate too. 2964 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust 2965 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it 2966 uses copy ctor instead of default ctor. 2967 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like 2968 OMP_DISTRIBUTE etc. 2969 (cp_fold_r): Likewise. 2970 (cp_genericize_r): Likewise. 2971 (cxx_omp_finish_clause): Also finish lastprivate clause with 2972 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag. 2973 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND. 2974 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel 2975 clauses and predetermine iterator as lastprivate. 2976 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP 2977 like OMP_DISTRIBUTE etc. 2978 29792019-08-05 Marek Polacek <polacek@redhat.com> 2980 2981 DR 2413 - typename in conversion-function-ids. 2982 * parser.c (cp_parser_conversion_type_id): Call 2983 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL 2984 instead of CP_PARSER_FLAGS_NONE. 2985 29862019-08-05 Paolo Carlini <paolo.carlini@oracle.com> 2987 2988 * cp-tree.h (cp_expr_loc_or_input_loc): New. 2989 (cxx_incomplete_type_diagnostic): Use it. 2990 * call.c (build_converted_constant_expr_internal, convert_like_real, 2991 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call, 2992 build_cxx_call, perform_implicit_conversion_flags, 2993 initialize_reference): Likewise. 2994 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression, 2995 eval_and_check_array_index, cxx_eval_store_expression, 2996 cxx_eval_statement_list, cxx_eval_loop_expr, 2997 cxx_eval_constant_expression, potential_constant_expression_1): 2998 Likewise. 2999 * constraint.cc (check_for_logical_overloads, 3000 satisfy_predicate_constraint): Likewise. 3001 * cp-gimplify.c (cp_gimplify_expr): Likewise. 3002 * cvt.c (cp_convert_to_pointer, convert_to_reference, 3003 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise. 3004 * decl.c (pop_switch): Likewise. 3005 * decl2.c (delete_sanity): Likewise. 3006 * error.c (location_of): Likewise. 3007 * init.c (maybe_warn_list_ctor, build_aggr_init, 3008 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise. 3009 * lex.c (unqualified_name_lookup_error): Likewise. 3010 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond): 3011 Likewise. 3012 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr, 3013 unify_arg_conversion, convert_nontype_argument, 3014 tsubst_copy_and_build, resolve_typename_type): Likewise. 3015 * semantics.c (maybe_convert_cond, finish_call_expr, 3016 cp_build_vec_convert): Likewise. 3017 * typeck.c (decay_conversion, rationalize_conditional_expr, 3018 cp_build_unary_op, build_x_compound_expr_from_list, 3019 maybe_warn_about_returning_address_of_local, 3020 maybe_warn_pessimizing_move): Likewise. 3021 * typeck2.c (check_narrowing, digest_init_r, 3022 process_init_constructor_array): Likewise. 3023 30242019-08-05 Tom Honermann <tom@honermann.net> 3025 3026 * parser.c (cp_parser_template_declaration_after_parameters): Enable 3027 class template argument deduction for non-type template parameters 3028 in literal operator templates. 3029 30302019-08-05 Marek Polacek <polacek@redhat.com> 3031 3032 PR c++/91338 - Implement P1161R3: Deprecate a[b,c]. 3033 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses 3034 of a comma operator within a subscripting expression. 3035 (cp_parser_skip_to_closing_square_bracket_1): New function, made out 3036 of... 3037 (cp_parser_skip_to_closing_square_bracket): ...this. 3038 30392019-08-05 Jason Merrill <jason@redhat.com> 3040 3041 * semantics.c (force_paren_expr): Preserve location. 3042 30432019-08-02 Marek Polacek <polacek@redhat.com> 3044 3045 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda. 3046 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__ 3047 inside a template function value-dependent. 3048 30492019-08-02 Paolo Carlini <paolo.carlini@oracle.com> 3050 3051 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard 3052 applied to a constructor. 3053 30542019-08-02 Martin Liska <mliska@suse.cz> 3055 3056 * decl.c (grok_op_properties): 3057 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators. 3058 30592019-08-01 Martin Sebor <msebor@redhat.com> 3060 3061 PR c++/90947 3062 * decl.c (reshape_init_array_1): Avoid truncating initializer 3063 lists containing string literals. 3064 30652019-08-01 Marek Polacek <polacek@redhat.com> 3066 3067 PR c++/90805 - detect narrowing in case values. 3068 * decl.c (case_conversion): Detect narrowing in case values. 3069 30702019-07-31 Paolo Carlini <paolo.carlini@oracle.com> 3071 3072 * decl2.c (delete_sanity): Improve diagnostic locations, use 3073 cp_expr_loc_or_loc in four places. 3074 30752019-07-31 Jason Merrill <jason@redhat.com> 3076 3077 PR c++/90538 - multiple expansions of capture packs 3078 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove. 3079 * lambda.c (add_capture): Copy parameter packs from init. 3080 (lambda_capture_field_type): Always use auto for init-capture. 3081 * pt.c (uses_parameter_packs): Return tree. 3082 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling. 3083 (gen_elem_of_pack_expansion_instantiation): Don't push 3084 local_specialization_stack. 3085 (prepend_one_capture): New. 3086 (tsubst_lambda_expr): Use it. Don't touch local_specializations. 3087 (do_auto_deduction): Avoid redundant error. 3088 3089 Fix copy_node of TEMPLATE_INFO. 3090 * cp-tree.h (struct tree_template_info): Use tree_base instead of 3091 tree_common. Add tmpl and args fields. 3092 (TI_TEMPLATE, TI_ARGS): Adjust. 3093 30942019-07-30 Martin Liska <mliska@suse.cz> 3095 3096 PR tree-optimization/91270 3097 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument 3098 of delete operator as needed. 3099 31002019-07-25 Martin Liska <mliska@suse.cz> 3101 Dominik Infuhr <dominik.infuehr@theobroma-systems.com> 3102 3103 PR c++/23383 3104 * decl.c (cxx_init_decl_processing): Mark delete operators 3105 with DECL_SET_IS_OPERATOR_DELETE. 3106 31072019-07-25 Martin Liska <mliska@suse.cz> 3108 3109 * decl.c (duplicate_decls): Use new macros 3110 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P). 3111 (cxx_init_decl_processing): Likewise. 3112 (grok_op_properties): Likewise. 3113 * parser.c (cp_parser_lambda_declarator_opt): Likewise. 3114 31152019-07-24 Martin Sebor <msebor@redhat.com> 3116 3117 PR driver/80545 3118 * decl.c (finish_function): Use lang_mask. 3119 31202019-07-20 Jason Merrill <jason@redhat.com> 3121 3122 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also 3123 introduced by a using-declaration. 3124 31252019-07-20 Jason Merrill <jason@redhat.com> 3126 3127 Reduce memory consumption for push/pop_access_scope. 3128 * name-lookup.c (leave_scope): Do add class levels other than 3129 previous_class_level to free_binding_level. 3130 (invalidate_class_lookup_cache): Move from class.c, add to 3131 free_binding_level. 3132 * pt.c (saved_access_scope): Change from list to vec. 3133 31342019-07-20 Jakub Jelinek <jakub@redhat.com> 3135 3136 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK 3137 instead of OMP_LOOP_CHECK. 3138 * parser.c (cp_parser_omp_clause_name): Handle bind clause. 3139 (cp_parser_omp_clause_bind): New function. 3140 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND. 3141 (OMP_LOOP_CLAUSE_MASK): Define. 3142 (cp_parser_omp_loop): New function. 3143 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of 3144 loop combined with parallel or teams. 3145 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP. 3146 (cp_parser_pragma): Likewise. 3147 * pt.c (tsubst_expr): Handle OMP_LOOP. 3148 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND. 3149 31502019-07-19 Jason Merrill <jason@redhat.com> 3151 3152 PR c++/90101 - dependent class non-type parameter. 3153 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type. 3154 31552019-07-18 Jason Merrill <jason@redhat.com> 3156 3157 PR c++/90098 - partial specialization and class non-type parms. 3158 PR c++/90099 3159 PR c++/90101 3160 * call.c (build_converted_constant_expr_internal): Don't copy. 3161 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR 3162 around class non-type parameter. 3163 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals. 3164 31652019-07-16 Jason Merrill <jason@redhat.com> 3166 3167 * parser.c (make_location): Add overload taking cp_lexer* as last 3168 parameter. 3169 3170 * parser.c (cp_parser_simple_type_specifier): Separate tentative 3171 parses for optional type-spec and CTAD. 3172 3173 * parser.c (cp_parser_nested_name_specifier_opt): If the token is 3174 already CPP_NESTED_NAME_SPECIFIER, leave it alone. 3175 31762019-07-12 Jakub Jelinek <jakub@redhat.com> 3177 3178 * parser.c (cp_parser_omp_clause_name): Handle order clause. 3179 (cp_parser_omp_clause_order): New function. 3180 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER. 3181 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add 3182 PRAGMA_OMP_CLAUSE_ORDER. 3183 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER. 3184 * pt.c (tsubst_omp_clauses): Likewise. 3185 31862019-07-10 Paolo Carlini <paolo.carlini@oracle.com> 3187 3188 * decl.c (get_type_quals, 3189 smallest_type_location (const cp_decl_specifier_seq*)): New. 3190 (check_tag_decl): Use smallest_type_location in error_at about 3191 multiple types in one declaration. 3192 (grokdeclarator): Use locations[ds_complex] in error_at about 3193 complex invalid; use locations[ds_storage_class] in error_at 3194 about static cdtor; use id_loc in error_at about flexible 3195 array member in union; use get_type_quals. 3196 31972019-07-09 Martin Sebor <msebor@redhat.com> 3198 3199 PR c++/61339 3200 * cp-tree.h: Change class-key of PODs to struct and others to class. 3201 * search.c: Same. 3202 * semantics.c (finalize_nrv_r): Same. 3203 32042019-07-09 Martin Sebor <msebor@redhat.com> 3205 3206 PR c++/61339 3207 * constexpr.c (cxx_eval_call_expression): Change class-key from class 3208 to struct and vice versa to match convention and avoid -Wclass-is-pod 3209 and -Wstruct-no-pod. 3210 * constraint.cc (get_concept_definition): Same. 3211 * cp-tree.h: Same. 3212 * cxx-pretty-print.h: Same. 3213 * error.c: Same. 3214 * logic.cc (term_list::replace): Same. 3215 * name-lookup.c (find_local_binding): Same. 3216 * pt.c (tsubst_binary_right_fold): Same. 3217 * search.c (field_accessor_p): Same. 3218 * semantics.c (expand_or_defer_fn): Same. 3219 32202019-07-08 Jakub Jelinek <jakub@redhat.com> 3221 3222 PR c++/91110 3223 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for 3224 error_mark_node type. 3225 32262019-07-05 Jakub Jelinek <jakub@redhat.com> 3227 3228 PR c++/67184 3229 PR c++/69445 3230 * call.c (build_new_method_call_1): Remove set but not used variable 3231 binfo. 3232 32332019-07-05 Paolo Carlini <paolo.carlini@oracle.com> 3234 3235 PR c++/67184 (again) 3236 PR c++/69445 3237 * call.c (build_over_call): Devirtualize user-defined operators 3238 coming from a base too. 3239 (build_new_method_call_1): Do not devirtualize here. 3240 32412019-07-04 Marek Polacek <polacek@redhat.com> 3242 3243 DR 1813 3244 PR c++/83374 - __is_standard_layout wrong for a class with repeated 3245 bases. 3246 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if 3247 CLASSTYPE_REPEATED_BASE_P is true. 3248 32492019-07-04 Andrew Stubbs <ams@codesourcery.com> 3250 3251 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype. 3252 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes. 3253 * decl2.c (cp_omp_mappable_type): Move contents to ... 3254 (cp_omp_mappable_type_1): ... here and add note output. 3255 (cp_omp_emit_unmappable_type_notes): New function. 3256 * semantics.c (finish_omp_clauses): Call 3257 cp_omp_emit_unmappable_type_notes in four places. 3258 32592019-07-03 Martin Liska <mliska@suse.cz> 3260 3261 * call.c (build_new_op_1): Remove dead assignemts. 3262 * typeck.c (cp_build_binary_op): Likewise. 3263 32642019-06-27 Jason Merrill <jason@redhat.com> 3265 3266 PR c++/55442 - memory-hog with highly recursive constexpr. 3267 * constexpr.c (push_cx_call_context): Return depth. 3268 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth. 3269 32702019-06-27 Jan Hubicka <jh@suse.cz> 3271 3272 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base 3273 type copy. 3274 32752019-06-27 Martin Liska <mliska@suse.cz> 3276 3277 * class.c (adjust_clone_args): Remove obviously 3278 dead assignments. 3279 (dump_class_hierarchy_r): Likewise. 3280 * decl.c (check_initializer): Likewise. 3281 * parser.c (cp_parser_lambda_expression): Likewise. 3282 * pt.c (unify_bound_ttp_args): Likewise. 3283 (convert_template_argument): Likewise. 3284 * rtti.c (build_headof): Likewise. 3285 * typeck.c (convert_for_initialization): Likewise. 3286 32872019-06-25 Jason Merrill <jason@redhat.com> 3288 3289 PR c++/70462 - unnecessary base ctor variant with final. 3290 * optimize.c (populate_clone_array): Skip base variant if 3291 CLASSTYPE_FINAL. 3292 (maybe_clone_body): We don't need an alias if we are only defining 3293 one clone. 3294 3295 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL. 3296 32972019-06-25 Jakub Jelinek <jakub@redhat.com> 3298 3299 PR c++/90969 3300 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from 3301 vector type if lval. 3302 33032019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com> 3304 3305 * lex.c (init_reswords): Create keyword for "__intN__" type. 3306 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt". 3307 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO 3308 C incompatibility if alternate "__intN__" form is used. 3309 * parser.c (cp_parser_simple_type_specifier): Set 3310 decl_specs->int_n_alt if "__intN__" form is used. 3311 33122019-06-24 Jan Hubicka <jh@suse.cz> 3313 3314 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P. 3315 33162019-06-24 Jason Merrill <jason@redhat.com> 3317 3318 * class.c (layout_class_type): Don't use a separate 3319 CLASSTYPE_AS_BASE if it's the same size. 3320 33212019-06-23 Marek Polacek <polacek@redhat.com> 3322 3323 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of 3324 DEFAULT_ARG. 3325 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse 3326 instead of tree_default_arg. 3327 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE. 3328 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename 3329 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename 3330 tree_default_arg to tree_deferred_parse. 3331 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG. 3332 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to 3333 TS_CP_DEFERRED_PARSE. 3334 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse. 3335 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead 3336 of TS_CP_DEFAULT_ARG. 3337 (defarg_location): Remove declaration. 3338 (defparse_location): Add declaration. 3339 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG. 3340 Call defparse_location instead of defarg_location. 3341 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG. 3342 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead 3343 of TS_CP_DEFAULT_ARG. 3344 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG. 3345 * error.c (dump_expr): Likewise. 3346 (location_of): Likewise. 3347 * init.c (get_nsdmi): Likewise. 3348 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS 3349 instead of DEFARG_TOKENS. 3350 (cp_parser_late_noexcept_specifier): Likewise. 3351 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead 3352 of DEFARG_TOKENS. 3353 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of 3354 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of 3355 DEFARG_INSTANTIATIONS. 3356 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG. 3357 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use 3358 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS. 3359 (defparse_location): Renamed from defarg_location. 3360 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of 3361 DEFAULT_ARG. 3362 (tsubst_arg_types): Likewise. 3363 (dependent_type_p_r): Likewise. 3364 * tree.c (cp_tree_equal): Likewise. 3365 (cp_walk_subtrees): Likewise. 3366 * typeck.c (convert_arguments): Likewise. 3367 33682019-06-22 Marek Polacek <polacek@redhat.com> 3369 3370 PR c++/86476 - noexcept-specifier is a complete-class context. 3371 PR c++/52869 3372 * cp-tree.def (DEFAULT_ARG): Update commentary. 3373 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro. 3374 (tree_default_arg): Use tree_base instead of tree_common. 3375 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare. 3376 * decl.c (do_push_parm_decls): New function, broken out of... 3377 (store_parm_decls): ...here. Call it. 3378 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert. 3379 * parser.c (cp_parser_noexcept_specification_opt, 3380 cp_parser_late_noexcept_specifier, noexcept_override_late_checks): 3381 Forward-declare. 3382 (unparsed_noexcepts): New macro. 3383 (push_unparsed_function_queues): Update initializer. 3384 (cp_parser_direct_declarator): Pass FRIEND_P to 3385 cp_parser_exception_specification_opt. 3386 (inject_parm_decls): New. 3387 (pop_injected_parms): New. 3388 (cp_parser_class_specifier_1): Implement delayed parsing of 3389 noexcept-specifiers. 3390 (cp_parser_save_noexcept): New. 3391 (cp_parser_late_noexcept_specifier): New. 3392 (noexcept_override_late_checks): New. 3393 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call 3394 cp_parser_save_noexcept instead of the normal processing if needed. 3395 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and 3396 pass it to cp_parser_noexcept_specification_opt. 3397 (cp_parser_save_member_function_body): Fix comment. 3398 (cp_parser_save_default_args): Maybe save the noexcept-specifier to 3399 post process. 3400 (cp_parser_transaction): Update call to 3401 cp_parser_noexcept_specification_opt. 3402 (cp_parser_transaction_expression): Likewise. 3403 * parser.h (cp_unparsed_functions_entry): Add new field to carry 3404 a noexcept-specifier. 3405 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression. 3406 * search.c (maybe_check_overriding_exception_spec): New function, broken 3407 out of... 3408 (check_final_overrider): ...here. Call 3409 maybe_check_overriding_exception_spec. 3410 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P. 3411 (cp_tree_equal): Handle DEFAULT_ARG. 3412 3413 PR c++/90881 - bogus -Wunused-value in unevaluated context. 3414 * cvt.c (convert_to_void): Don't emit unused warnings in 3415 an unevaluated context. 3416 34172019-06-22 Paolo Carlini <paolo.carlini@oracle.com> 3418 3419 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and 3420 locations[ds_storage_class] in a few additional places. 3421 34222019-06-21 Paolo Carlini <paolo.carlini@oracle.com> 3423 3424 PR c++/90909 3425 Revert: 3426 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com> 3427 3428 PR c++/67184 3429 PR c++/69445 3430 * call.c (build_over_call): Devirtualize when the final overrider 3431 comes from the base. 3432 34332019-06-21 Marek Polacek <polacek@redhat.com> 3434 3435 PR c++/61490 - qualified-id in friend function definition. 3436 * decl.c (grokdeclarator): Diagnose qualified-id in friend function 3437 definition. Improve location for diagnostics of friend functions. 3438 3439 PR c++/60223 - ICE with T{} in non-deduced context. 3440 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context. 3441 3442 PR c++/64235 - missing syntax error with invalid alignas. 3443 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse 3444 if there's a missing close paren. 3445 3446 PR c++/90490 - fix decltype issues in noexcept-specifier. 3447 * except.c (build_noexcept_spec): Call 3448 instantiate_non_dependent_expr_sfinae before 3449 build_converted_constant_expr instead of calling 3450 instantiate_non_dependent_expr after it. Add 3451 processing_template_decl_sentinel. 3452 34532019-06-21 Jakub Jelinek <jakub@redhat.com> 3454 3455 PR c++/90950 3456 * semantics.c (finish_omp_clauses): Don't reject references to 3457 incomplete types if processing_template_decl. 3458 34592019-06-19 Marek Polacek <polacek@redhat.com> 3460 3461 PR c++/60364 - noreturn after first decl not diagnosed. 3462 * decl.c (duplicate_decls): Give an error when a function is 3463 declared [[noreturn]] after its first declaration. 3464 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn 3465 attribute as equivalent to GNU's. 3466 * tree.c (std_attribute_table): Add noreturn. 3467 34682019-06-19 Jakub Jelinek <jakub@redhat.com> 3469 3470 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE 3471 like OMP_CLAUSE_SHARED. 3472 34732019-06-18 Jason Merrill <jason@redhat.com> 3474 3475 * constexpr.c (cxx_eval_store_expression): Delay target evaluation. 3476 34772019-06-18 Jason Merrill <jason@redhat.com> 3478 3479 * constexpr.c (eval_and_check_array_index): Split out from... 3480 (cxx_eval_array_reference): ...here. 3481 (cxx_eval_store_expression): Use it here, too. 3482 (diag_array_subscript): Take location. Strip location wrapper. 3483 34842019-06-18 Jason Merrill <jason@redhat.com> 3485 3486 * constexpr.c (cxx_eval_constant_expression): Handle conversion from 3487 and then to the same type. 3488 34892019-06-18 Jason Merrill <jason@redhat.com> 3490 3491 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL. 3492 34932019-06-17 Jakub Jelinek <jakub@redhat.com> 3494 3495 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN 3496 set need_copy_assignment. 3497 34982019-06-17 Marek Polacek <polacek@redhat.com> 3499 3500 PR c++/83820 - excessive attribute arguments not detected. 3501 * parser.c (cp_parser_std_attribute): Detect excessive arguments. 3502 35032019-06-17 Nathan Sidwell <nathan@acm.org> 3504 3505 PR c++/90754 3506 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before 3507 checking context. 3508 35092019-06-14 Marek Polacek <polacek@redhat.com> 3510 3511 PR c++/90884 - stray note with -Wctor-dtor-privacy. 3512 * class.c (maybe_warn_about_overly_private_class): Guard the call to 3513 inform. 3514 35152019-06-12 Jason Merrill <jason@redhat.com> 3516 3517 PR c++/85552 - wrong instantiation of dtor for DMI. 3518 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init. 3519 35202019-06-13 Paolo Carlini <paolo.carlini@oracle.com> 3521 3522 * decl.c (grokdeclarator): Use id_loc in five additional places 3523 in the last part of the function. 3524 35252019-06-13 Paolo Carlini <paolo.carlini@oracle.com> 3526 3527 * decl.c (grokdeclarator): Move further up the declaration of 3528 id_loc, use it immediately, update its value after the loop 3529 over declarator, use it again in the final part of function; 3530 improve locations of error messages about multiple data types 3531 and conflicting specifiers. 3532 35332019-06-13 Richard Biener <rguenther@suse.de> 3534 3535 PR c++/90801 3536 * typeck2.c (split_nonconstant_init_1): Properly count 3537 num_split_elts, optimize single constructor elt removal. 3538 35392019-06-12 Marek Polacek <polacek@redhat.com> 3540 3541 PR c++/66999 - 'this' captured by reference. 3542 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use 3543 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token. 3544 3545 PR c++/90825 - endless recursion when evaluating sizeof. 3546 PR c++/90832 - endless recursion when evaluating sizeof. 3547 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the 3548 result of fold_sizeof_expr if is returns a SIZEOF_EXPR. 3549 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand 3550 is instantiation-dependent. 3551 3552 PR c++/90736 - bogus error with alignof. 3553 * constexpr.c (adjust_temp_type): Use cv_unqualified type. 3554 35552019-06-11 Matthew Beliveau <mbelivea@redhat.com> 3556 3557 PR c++/90449 - add -Winaccessible-base option. 3558 * class.c (warn_about_ambiguous_bases): Changed name to: 3559 maybe_warn_about_inaccessible_bases. 3560 (maybe_warn_about_inaccessible_bases): Implemented new 3561 Winaccessible-base warning option for both direct and virtual 3562 base warnings. 3563 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit 3564 new name. 3565 35662019-06-11 Richard Biener <rguenther@suse.de> 3567 3568 PR c++/90801 3569 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove 3570 from CONSTRUCTOR by marking to remove elements and doing all 3571 of them in a O(n) scan. 3572 35732019-06-11 Jakub Jelinek <jakub@redhat.com> 3574 3575 PR c++/90810 3576 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for 3577 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR. 3578 35792019-06-11 Martin Liska <mliska@suse.cz> 3580 3581 PR c++/87847 3582 * pt.c (init_template_processing): Disable hash table 3583 sanitization for decl_specializations and type_specializations. 3584 35852019-06-10 Jason Merrill <jason@redhat.com> 3586 3587 * constexpr.c (free_constructor): New. 3588 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs. 3589 3590 * constexpr.c (unshare_constructor): Only unshare if T is itself a 3591 CONSTRUCTOR. 3592 (cxx_eval_call_expression): Don't call it on the result here. 3593 3594 Reduce constexpr_call memory consumption. 3595 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather 3596 than TREE_LIST. 3597 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call) 3598 (cxx_eval_call_expression): Adjust. 3599 36002019-06-10 Jakub Jelinek <jakub@redhat.com> 3601 3602 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan 3603 reductions. 3604 (cp_parser_omp_scan_loop_body): New function. 3605 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there 3606 are inscan reduction clauses. 3607 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN. 3608 * semantics.c (finish_omp_clauses): Reject mixing inscan with 3609 non-inscan reductions on the same construct, or inscan reductions with 3610 ordered or schedule clauses, or inscan array reductions. 3611 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE. 3612 (tsubst_expr): Handle OMP_SCAN. 3613 36142019-06-07 Jason Merrill <jason@redhat.com> 3615 3616 * constexpr.c (cxx_eval_constant_expression): Call 3617 STRIP_ANY_LOCATION_WRAPPER early. 3618 [CONVERT_EXPR]: Don't build anything for conversion to void. 3619 [ADDR_EXPR]: ggc_free unused ADDR_EXPR. 3620 36212019-06-05 Martin Sebor <msebor@redhat.com> 3622 3623 PR c/90737 3624 * typeck.c (maybe_warn_about_returning_address_of_local): Only 3625 consider functions returning pointers as candidates for 3626 -Wreturn-local-addr. 3627 36282019-06-05 Paolo Carlini <paolo.carlini@oracle.com> 3629 3630 * decl.c (smallest_type_location): New. 3631 (check_special_function_return_type): Use it. 3632 (grokdeclarator): Lkewise. 3633 36342019-06-05 Paolo Carlini <paolo.carlini@oracle.com> 3635 3636 * decl.c (grokdeclarator): Use locations[ds_friend] 3637 in one place. 3638 36392019-06-05 Martin Sebor <msebor@redhat.com> 3640 3641 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation. 3642 (convert_like_real): Same. 3643 (convert_arg_to_ellipsis): Same. 3644 * constexpr.c (diag_array_subscript): Same. 3645 * constraint.cc (diagnose_trait_expression): Same. 3646 * cvt.c (ocp_convert): Same. 3647 * decl.c (start_decl): Same. 3648 (check_for_uninitialized_const_var): Same. 3649 (grokfndecl): Same. 3650 (check_special_function_return_type): Same. 3651 (finish_enum_value_list): Same. 3652 (start_preparsed_function): Same. 3653 * parser.c (cp_parser_decl_specifier_seq): Same. 3654 * typeck.c (cp_build_binary_op): Same. 3655 (build_static_cast_1): Same. 3656 36572019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com> 3658 3659 PR c++/63149 - Wrong auto deduction from braced-init-list. 3660 * pt.c (listify_autos): use non cv qualified auto_node in 3661 std::initializer_list<auto>. 3662 36632019-06-04 Paolo Carlini <paolo.carlini@oracle.com> 3664 3665 * decl.c (grokdeclarator): Use declarator->id_loc in two 3666 additional places. 3667 36682019-06-04 Nathan Sidwell <nathan@acm.org> 3669 3670 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local 3671 and namespace scopes separately. 3672 36732019-06-04 Harald van Dijk <harald@gigawatt.nl> 3674 3675 PR c++/60531 - Wrong error about unresolved overloaded function 3676 * typeck.c (cp_build_binary_op): See if overload can be resolved. 3677 (cp_build_unary_op): Ditto. 3678 36792019-06-04 Jason Merrill <jason@redhat.com> 3680 3681 Reduce accumulated garbage in constexpr evaluation. 3682 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we 3683 don't save. 3684 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after 3685 evaluating it. 3686 36872019-06-04 Jakub Jelinek <jakub@redhat.com> 3688 3689 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_ 3690 instead of only up to linear. 3691 36922019-06-03 Paolo Carlini <paolo.carlini@oracle.com> 3693 3694 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in 3695 five places. 3696 36972019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com> 3698 3699 PR c++/85254 3700 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL. 3701 37022019-05-31 Nathan Sidwell <nathan@acm.org> 3703 3704 * cp-tree.h (IDENTIFIER_LAMBDA_P): New. 3705 (TYPE_ANON_P): New. 3706 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise. 3707 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete. 3708 (make_lambda_name): Don't declare. 3709 * error.c (dump_aggr_type): Check for lambdas before other 3710 anonymous names. 3711 * lambda.c (begin_lambda_type): Use make_anon_name. 3712 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous. 3713 * mangle.c (write_local_name): Likewise. 3714 * name-lookup.c (lambda_cnt, make_lambda_name): Delete. 3715 37162019-05-30 Marek Polacek <polacek@redhat.com> 3717 3718 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo. 3719 37202019-05-31 Paolo Carlini <paolo.carlini@oracle.com> 3721 3722 * decl.c (grokdeclarator): Use declarator->id_loc in five 3723 error_at calls. 3724 37252019-05-29 Jakub Jelinek <jakub@redhat.com> 3726 3727 PR c++/90598 3728 * tree.c (lvalue_kind): Return clk_none for expressions with 3729 with VOID_TYPE_P. 3730 37312019-05-29 Paolo Carlini <paolo.carlini@oracle.com> 3732 3733 PR c++/89875 3734 * parser.c (cp_parser_sizeof_operand): When the type-id production 3735 did not work out commit to the tentative parse. 3736 37372019-05-29 Jakub Jelinek <jakub@redhat.com> 3738 3739 P1091R3 - Extending structured bindings to be more like var decls 3740 P1381R1 - Reference capture of structured bindings 3741 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at 3742 function scope. 3743 (cp_finish_decomp): Copy over various decl properties from decl to 3744 v[i] in the tuple case. 3745 (grokdeclarator): Allow static, thread_local and __thread for C++2a 3746 and use pedwarn instead of error for older standard revisions. 3747 Make other structured binding diagnostic messages more i18n friendly. 3748 37492019-05-28 Nathan Sidwell <nathan@acm.org> 3750 3751 * decl.c (duplicate_decls): Assert a template newdecl has no 3752 specializations. 3753 37542019-05-28 Marek Polacek <polacek@redhat.com> 3755 3756 PR c++/90548 - ICE with generic lambda and empty pack. 3757 * pt.c (tsubst_copy_and_build): Handle pack expansion properly. 3758 37592019-05-28 Nathan Sidwell <nathan@acm.org> 3760 3761 * cp-tree.h (make_anon_name): Drop declaration. 3762 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P. 3763 * cp-lang.c (cxx_dwarf_name): Likewise. 3764 * class.c (find_flexarrays): Likewise. 3765 * decl.c (name_unnamed_type, xref_tag_1): Likewise. 3766 * error.c (dump_aggr_type): Likewise. 3767 * pt.c (push_template_decl_real): Likewise. 3768 * name-lookup.c (consider_binding_level): Likewise. 3769 (anon_cnt, make_anon_name): Delete. 3770 37712019-05-25 Marek Polacek <polacek@redhat.com> 3772 3773 PR c++/90572 - wrong disambiguation in friend declaration. 3774 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing 3775 typename for friend declarations. 3776 37772019-05-23 Jonathan Wakely <jwakely@redhat.com> 3778 3779 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace. 3780 3781 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that 3782 was resolved by r254694. 3783 37842019-05-22 Jason Merrill <jason@redhat.com> 3785 3786 PR c++/20408 - unnecessary code for empty struct. 3787 * call.c (build_call_a): Use simple_empty_class_p. 3788 3789 PR c++/86485 - -Wmaybe-unused with empty class ?: 3790 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR. 3791 37922019-05-21 Paolo Carlini <paolo.carlini@oracle.com> 3793 3794 * parser.c (cp_parser_template_declaration_after_parameters): Use 3795 DECL_SOURCE_LOCATION in literal operator template errors. 3796 37972019-05-21 Paolo Carlini <paolo.carlini@oracle.com> 3798 3799 PR c++/67184 3800 PR c++/69445 3801 * call.c (build_over_call): Devirtualize when the final overrider 3802 comes from the base. 3803 38042019-05-21 Nathan Sidwell <nathan@acm.org> 3805 3806 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P 3807 parameter. Document. 3808 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl 3809 calls. Remove stray FIXME comment. 3810 3811 * name-lookup.h (struct cp_binding_level): Drop usings field. 3812 (finish_namespace_using_decl, finish_local_using_decl): Replace with ... 3813 (finish_nonmember_using_decl): ... this. 3814 * name-lookup.c (push_using_decl_1, push_using_decl): 3815 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement. 3816 (validate_nonmember_using_decl, finish_namespace_using_decl) 3817 (finish_local_using_decl): Replace with ... 3818 (finish_nonmember_using_decl): ... this. Drop DECL parm. 3819 * parser.c (cp_parser_using_declaration): Don't do lookup here. 3820 * pt.c (tsubst_expr): Do not do using decl lookup here. 3821 38222019-05-21 Eric Botcazou <ebotcazou@adacore.com> 3823 3824 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case. 3825 38262019-05-20 Marek Polacek <polacek@redhat.com> 3827 3828 CWG 2094 - volatile scalars are trivially copyable. 3829 PR c++/85679 3830 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for 3831 scalar types. 3832 38332019-05-20 Marek Polacek <polacek@redhat.com> 3834 3835 * pt.c (convert_template_argument): Add a diagnostic for the 3836 [temp.arg]/2 ambiguity case. 3837 3838 * name-lookup.c (finish_using_directive): Don't issue inform() if the 3839 warning didn't trigger. Add quoting. Tweak the inform message. 3840 38412019-05-20 Paolo Carlini <paolo.carlini@oracle.com> 3842 3843 * cp-tree.h: Remove remnants of CONV_NONCONVERTING. 3844 38452019-05-20 Nathan Sidwell <nathan@acm.org> 3846 3847 * name-lookup.c (finish_namespace_using_directive) 3848 (finish_local_using_directive): Merge to ... 3849 (finish_using_directive): ... here. Handle both contexts. 3850 * name-lookup.h (finish_namespace_using_directive) 3851 (finish_local_using_directive): Replace with ... 3852 (finish_using_directive): ... this. 3853 * parser.c (cp_parser_using_directive): Adjust. 3854 * pt.c (tsubst_expr): Likewise. 3855 3856 * cp-tree.h (struct lang_decl_ns): Remove usings field. 3857 (DECL_NAMESPACE_USING): Delete. 3858 * name-lookup.c (name_lookup::search_usings): Use namespace's 3859 binding scope. 3860 (name_lookup::queue_namespae): Likewise. 3861 (finish_namespace_using_directive, push_namespace): Likewise. 3862 (has_using_namespace_std_directive): Just search the entire 3863 binding stack. 3864 38652019-05-20 Jonathan Wakely <jwakely@redhat.com> 3866 3867 PR c++/90532 Ensure __is_constructible(T[]) is false 3868 * method.c (is_xible_helper): Return error_mark_node for construction 3869 of an array of unknown bound. 3870 38712019-05-17 Thomas Schwinge <thomas@codesourcery.com> 3872 3873 PR c++/89433 3874 * parser.c (cp_finalize_oacc_routine): Rework checking if already 3875 marked with an OpenACC 'routine' directive. 3876 3877 PR c++/89433 3878 * parser.c (cp_parser_oacc_routine) 3879 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses. 3880 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses. 3881 3882 PR c++/89433 3883 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine' 3884 clauses from "omp declare target" attribute. 3885 38862019-05-16 Martin Sebor <msebor@redhat.com> 3887 3888 * call.c (print_z_candidate): Wrap diagnostic text in a gettext 3889 macro. Adjust. 3890 (print_z_candidates): Same. 3891 (build_conditional_expr_1): Quote keywords, operators, and types 3892 in diagnostics. 3893 (build_op_delete_call): Same. 3894 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext 3895 macro. 3896 (convert_like_real): Same. 3897 (convert_arg_to_ellipsis): Quote keywords, operators, and types 3898 in diagnostics. 3899 (build_over_call): Same. 3900 (joust): Break up an overlong line. Wrap diagnostic text in a gettext 3901 macro. 3902 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English. 3903 (cxx_eval_constant_expression): Quote keywords, operators, and types 3904 in diagnostics. 3905 (potential_constant_expression_1): Same. 3906 * cp-gimplify.c (cp_genericize_r): Same. 3907 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types 3908 in diagnostics. 3909 (type_promotes_to): Same. 3910 * decl.c (check_previous_goto_1): Same. 3911 (check_goto): Same. 3912 (start_decl): Same. 3913 (cp_finish_decl): Avoid parenthesizing a sentence for consistency. 3914 (grok_op_properties): Quote keywords, operators, and types 3915 in diagnostics. 3916 * decl2.c (grokfield): Same. 3917 (coerce_delete_type): Same. 3918 * except.c (is_admissible_throw_operand_or_catch_parameter): Same. 3919 * friend.c (do_friend): Quote C++ tokens. 3920 * init.c (build_new_1): Quote keywords, operators, and types 3921 in diagnostics. 3922 (build_vec_delete_1): Same. 3923 (build_delete): Same. 3924 * lex.c (parse_strconst_pragma): Same. 3925 (handle_pragma_implementation): Same. 3926 (unqualified_fn_lookup_error): Same. 3927 * mangle.c (write_type): Same. 3928 * method.c (defaulted_late_check): Avoid two consecutive punctuators. 3929 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline. 3930 (pop_everything): Same. 3931 * parser.c (cp_lexer_start_debugging): Quote a macro name. 3932 in a diagnostic 3933 (cp_lexer_stop_debugging): Same. 3934 (cp_parser_userdef_numeric_literal): Quote a C++ header name 3935 in a diagnostic. 3936 (cp_parser_nested_name_specifier_opt): Quote keywords, operators, 3937 and types in diagnostics. 3938 (cp_parser_question_colon_clause): Same. 3939 (cp_parser_asm_definition): Same. 3940 (cp_parser_init_declarator): Same. 3941 (cp_parser_template_declaration_after_parameters): Avoid capitalizing 3942 a sentence in a diagnostic. 3943 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types 3944 in diagnostics. 3945 (cp_parser_transaction): Same. 3946 * pt.c (maybe_process_partial_specialization): Replace second call 3947 to permerror with inform for consistency with other uses. 3948 (expand_integer_pack): Quote keywords, operators, and types 3949 in diagnostics. 3950 * rtti.c (get_typeid): Quote keywords, operators, and types 3951 in diagnostics. 3952 (build_dynamic_cast_1): Same. 3953 * semantics.c (finish_asm_stmt): Same. 3954 (finish_label_decl): Same. 3955 (finish_bases): Same. 3956 (finish_offsetof): Same. 3957 (cp_check_omp_declare_reduction): Same. 3958 (finish_decltype_type): Same. 3959 * tree.c (handle_init_priority_attribute): Same. Add detail 3960 to diagnostics. 3961 (maybe_warn_zero_as_null_pointer_constant): Same. 3962 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types 3963 in diagnostics. 3964 (cp_build_unary_op): Same. 3965 (check_for_casting_away_constness): Same. 3966 (build_static_cast): Same. 3967 (build_const_cast_1): Same. 3968 (maybe_warn_about_returning_address_of_local): Same. 3969 (check_return_expr): Same. 3970 * typeck2.c (abstract_virtuals_error_sfinae): Same. 3971 (digest_init_r): Replace a tab with spaces in a diagnostic. 3972 (build_functional_cast): Quote keywords, operators, and types 3973 in diagnostics. 3974 39752019-05-15 Jakub Jelinek <jakub@redhat.com> 3976 3977 PR debug/90197 3978 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT 3979 before the condition (or if missing or constant non-zero at the end 3980 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression 3981 if any. Don't call protected_set_expr_location on incr if it already 3982 has a location. 3983 39842019-05-15 Marek Polacek <polacek@redhat.com> 3985 3986 CWG 2096 - constraints on literal unions. 3987 * class.c (check_field_decls): Initialize booleans directly. A union 3988 is literal if at least one of its non-static data members is of 3989 non-volatile literal type. 3990 39912019-05-15 Paolo Carlini <paolo.carlini@oracle.com> 3992 3993 * cp-tree.h (REFERENCE_VLA_OK): Remove. 3994 * lambda.c (build_capture_proxy): Remove use of the above. 3995 39962019-05-15 Paolo Carlini <paolo.carlini@oracle.com> 3997 3998 * call.c (perform_overload_resolution, build_new_method_call_1): 3999 Use OVL_P; remove redundant TEMPLATE_DECL checks. 4000 * decl.c (grokfndecl): Likewise. 4001 * mangle.c (write_expression): Likewise. 4002 * parser.c (cp_parser_template_id): Likewise. 4003 * pt.c (resolve_overloaded_unification, type_dependent_expression_p): 4004 Likewise. 4005 * search.c (build_baselink): Likewise. 4006 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise. 4007 40082019-05-14 Paolo Carlini <paolo.carlini@oracle.com> 4009 4010 PR preprocessor/90382 4011 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use 4012 min_location. 4013 40142019-05-13 Jason Merrill <jason@redhat.com> 4015 4016 Use releasing_vec more broadly. 4017 * cp-tree.h (struct releasing_vec): Replace get_ref method with 4018 operator&. 4019 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice): 4020 Forwarding functions for releasing_vec. 4021 (release_tree_vector): Declare but don't define. 4022 * call.c (build_op_delete_call, build_temp, call_copy_ctor) 4023 (perform_direct_initialization_if_possible): Use releasing_vec. 4024 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression): 4025 Likewise. 4026 * cp-gimplify.c (cp_fold): Likewise. 4027 * cvt.c (force_rvalue, ocp_convert): Likewise. 4028 * decl.c (get_tuple_decomp_init): Likewise. 4029 * except.c (build_throw): Likewise. 4030 * init.c (perform_member_init, expand_default_init): Likewise. 4031 * method.c (do_build_copy_assign, locate_fn_flags): Likewise. 4032 * parser.c (cp_parser_userdef_char_literal) 4033 (cp_parser_userdef_numeric_literal) 4034 (cp_parser_userdef_string_literal) 4035 (cp_parser_perform_range_for_lookup) 4036 (cp_parser_range_for_member_function, cp_parser_omp_for_loop) 4037 (cp_parser_omp_for_loop_init): Likewise. 4038 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise. 4039 * semantics.c (calculate_direct_bases, calculate_bases) 4040 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait) 4041 (finish_omp_taskyield, finish_omp_cancel) 4042 (finish_omp_cancellation_point): Likewise. 4043 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr) 4044 (build_min_non_dep_op_overload): Likewise. 4045 * typeck.c (build_function_call_vec, cp_build_function_call_nary) 4046 (cp_build_modify_expr): Likewise. 4047 * typeck2.c (build_functional_cast): Likewise. 4048 40492019-05-11 Paolo Carlini <paolo.carlini@oracle.com> 4050 4051 * typeck.c (cp_build_function_call_vec): When mark_used fails 4052 unconditionally return error_mark_node. 4053 40542019-05-10 Paolo Carlini <paolo.carlini@oracle.com> 4055 4056 * decl.c (grokvardecl): Use an accurate location in error message 4057 about main as a global variable. 4058 40592019-05-10 Paolo Carlini <paolo.carlini@oracle.com> 4060 4061 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P. 4062 * cp-gimplify.c (cp_fold): Likewise. 4063 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise. 4064 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise. 4065 * cvt.c (perform_qualification_conversions): Likewise. 4066 * decl.c (grokdeclarator): Likewise. 4067 * decl2.c (build_memfn_type): Likewise. 4068 * mangle.c (canonicalize_for_substitution, write_type): Likewise. 4069 * parser.c (cp_parser_omp_declare_reduction): Likewise. 4070 * pt.c (check_explicit_specialization, uses_deducible_template_parms, 4071 check_cv_quals_for_unify, dependent_type_p_r): Likewise. 4072 * rtti.c (ptr_initializer): Likewise. 4073 * semantics.c (finish_asm_stmt, finish_offsetof, 4074 cp_check_omp_declare_reduction): Likewise. 4075 * tree.c (cp_build_qualified_type_real, 4076 cp_build_type_attribute_variant, cxx_type_hash_eq, 4077 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise. 4078 * typeck.c (structural_comptypes, convert_arguments, 4079 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast, 4080 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual): 4081 Likewise. 4082 40832019-05-10 Marek Polacek <polacek@redhat.com> 4084 4085 PR c++/78010 - bogus -Wsuggest-override warning on final function. 4086 * class.c (check_for_override): Don't warn for final functions. 4087 40882019-05-10 Jakub Jelinek <jakub@redhat.com> 4089 4090 PR pch/90326 4091 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add 4092 c-family/c-cppbuiltin.c. 4093 40942019-05-09 Paolo Carlini <paolo.carlini@oracle.com> 4095 4096 PR c++/90382 4097 Revert: 4098 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com> 4099 4100 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use 4101 min_location. 4102 41032019-05-08 Nathan Sidwell <nathan@acm.org> 4104 4105 Kill DECL_SAVED_FUNCTION_DATA . 4106 * cp-tree.h (language_function): Remove x_auto_return_pattern. 4107 (current_function_auto_return_pattern): Delete. 4108 (lang_decl_fn): Replace saved_language_function with 4109 saved_auto_return type. 4110 (DECL_SAVED_FUNCTION_DATA): Delete. 4111 (DECL_SAVED_AUTO_RETURN_TYPE): New. 4112 (FNDECL_USED_AUTO): Correct documentation. 4113 * decl.c (duplicate_decls): Adjust AUTO return handling. 4114 (start_preparsed_function): Replace 4115 current_function_auto_return_pattern with 4116 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA 4117 zapping. 4118 (finish_function): Likewise. 4119 (save_function_data): Delete. 4120 (fndecl_declared_return_type): Reimplement. 4121 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE. 4122 * method.c (make_thunk, make_alias_for): Likewise. 4123 * parser.c (cp_parser_jump_statement): Likewise. 4124 * pt.c (do_auto_deduction): Likewise. 4125 * typeck.c (check_return_expr): Likewise. 4126 41272019-05-06 Jason Merrill <jason@redhat.com> 4128 4129 PR c++/90171 - reorganize usual_deallocation_fn_p 4130 * call.c (struct dealloc_info): New. 4131 (usual_deallocation_fn_p): Take a dealloc_info*. 4132 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove. 4133 (build_op_delete_call): Adjust. 4134 41352019-05-07 Jason Merrill <jason@redhat.com> 4136 4137 PR c++/86485 - -Wmaybe-unused with empty class ?: 4138 * typeck.c (build_static_cast_1): Use cp_build_addr_expr. 4139 4140 * pt.c (type_dependent_expression_p): A non-type template parm with 4141 a placeholder type is type-dependent. 4142 41432019-05-06 Marek Polacek <polacek@redhat.com> 4144 4145 PR c++/90265 - ICE with generic lambda. 4146 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last 4147 element in the vector. 4148 41492019-05-03 Martin Liska <mliska@suse.cz> 4150 4151 * call.c (build_aggr_conv): Use is_empty instead of 4152 elements () == 0 (and similar usages). 4153 * parser.c (cp_parser_lambda_introducer): Likewise. 4154 41552019-05-02 Nathan Sidwell <nathan@acm.org> 4156 4157 * semantics.c (finish_id_expression_1): Remove unreachable code. 4158 41592019-05-01 Nathan Sidwell <nathan@acm.org> 4160 4161 * name-lookup.h (get_class_binding_direct): Change final arg to 4162 bool. 4163 (get_class_binding): Likewise. 4164 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS 4165 arg with WANT_TYPE bool. Simplify. 4166 (get_class_binding): Adjust final arg. 4167 * decl.c (reshape_init_class): Adjust get_class_binding calls. 4168 41692019-04-30 Nathan Sidwell <nathan@acm.org> 4170 4171 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR 4172 nodes. Call c_common_init_ts. 4173 41742019-04-29 Nathan Sidwell <nathan@acm.org> 4175 4176 * decl.c (duplicate_decls): Add whitespace, move comments into 4177 conditional blocks. 4178 * method.c (explain_implicit_non_constexpr): Refactor. 4179 * pt.c (check_explicit_specialization): Fix indentation. 4180 * semantics.c (process_outer_var_ref): Reformat. 4181 (finish_id_expression_1): Use STRIP_TEMPLATE. 4182 41832019-04-26 Jonathan Wakely <jwakely@redhat.com> 4184 4185 PR c++/90243 - orphaned note in uninstantiated constexpr function 4186 * decl.c (check_for_uninitialized_const_var): Suppress notes if no 4187 error was shown. 4188 41892019-04-26 Paolo Carlini <paolo.carlini@oracle.com> 4190 4191 PR c++/90173 4192 * decl.c (grokdeclarator): Set type to error_mark_node 4193 upon error about template placeholder type non followed 4194 by a simple declarator-id. 4195 41962019-04-26 Paolo Carlini <paolo.carlini@oracle.com> 4197 4198 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use 4199 min_location. 4200 42012019-04-24 Jason Merrill <jason@redhat.com> 4202 4203 PR c++/90227 - error with template parameter packs. 4204 * pt.c (coerce_template_parms): Do add empty pack when 4205 require_all_args. 4206 42072019-04-24 Richard Biener <rguenther@suse.de> 4208 4209 * call.c (null_ptr_cst_p): Order checks according to expensiveness. 4210 (conversion_null_warnings): Likewise. 4211 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return 4212 early if type1 == type2. 4213 42142019-04-22 Jason Merrill <jason@redhat.com> 4215 4216 PR c++/87366 - wrong error with alias template. 4217 * typeck.c (structural_comptypes): When comparing_specializations, 4218 aliases are unequal. 4219 (comptypes): When comparing_specializations, do structural 4220 comparison. 4221 42222019-04-19 Jason Merrill <jason@redhat.com> 4223 4224 PR c++/90190 - CTAD with list-constructor. 4225 * pt.c (do_class_deduction): Don't try the single element deduction 4226 if the single element is also a braced list. 4227 4228 PR c++/90171 - ICE with destroying delete with size_t parm. 4229 * call.c (sized_deallocation_fn_p): New. Use it instead of 4230 second_parm_is_size_t in most cases. 4231 (second_parm_is_size_t): Don't check for aligned. 4232 42332019-04-19 Paolo Carlini <paolo.carlini@oracle.com> 4234 4235 PR c++/89900 4236 * pt.c (fn_type_unification): When handling null explicit 4237 arguments do not special case non-parameter packs. 4238 42392019-04-19 Jakub Jelinek <jakub@redhat.com> 4240 4241 PR c++/90138 4242 * pt.c (process_template_parm): Set decl to pushdecl result. If 4243 !is_non_type, also set parm to that. 4244 4245 PR c/89888 4246 * decl.c (struct cp_switch): Remove outside_range_p member. 4247 (push_switch): Don't clear it. 4248 (pop_switch): Adjust c_do_switch_warnings caller. 4249 (finish_case_label): Adjust c_add_case_label caller. 4250 4251 PR c++/90108 4252 * decl.c (duplicate_decls): If remove is main variant and 4253 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE 4254 variant that has newdecl as TYPE_NAME if any. 4255 42562019-04-18 Jason Merrill <jason@redhat.com> 4257 4258 PR c++/87554 - ICE with extern template and reference member. 4259 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars. 4260 42612019-04-17 Jason Merrill <jason@redhat.com> 4262 4263 PR c++/90047 - ICE with enable_if alias template. 4264 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the 4265 hash table when we're in SFINAE context. 4266 42672019-04-17 Marek Polacek <polacek@redhat.com> 4268 4269 PR c++/90124 - bogus error with incomplete type in decltype. 4270 * typeck.c (build_class_member_access_expr): Check 4271 cp_unevaluated_operand. 4272 42732019-04-12 Jakub Jelinek <jakub@redhat.com> 4274 4275 PR c/89933 4276 * decl.c (duplicate_decls): When newdecl's type is its main variant, 4277 don't try to remove it from the variant list, but instead assert 4278 it has no variants. 4279 42802019-04-12 Martin Sebor <msebor@redhat.com> 4281 4282 PR c/88383 4283 PR c/89288 4284 * parser.c (cp_parser_has_attribute_expression): Handle assignment 4285 expressions. 4286 42872019-04-12 Jason Merrill <jason@redhat.com> 4288 4289 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR 4290 of PMF type. 4291 42922019-04-12 Marek Polacek <polacek@redhat.com> 4293 4294 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr 4295 instead of perform_implicit_conversion_flags. 4296 4297 PR c++/87603 - constexpr functions are no longer noexcept. 4298 * constexpr.c (is_sub_constant_expr): Remove unused function. 4299 * cp-tree.h (is_sub_constant_expr): Remove declaration. 4300 * except.c (check_noexcept_r): Don't consider a call to a constexpr 4301 function noexcept. 4302 43032019-04-11 Jakub Jelinek <jakub@redhat.com> 4304 4305 PR translation/90035 4306 * parser.h (struct cp_parser): Add 4307 type_definition_forbidden_message_arg member. 4308 * parser.c (cp_debug_parser): Print it. 4309 (cp_parser_check_type_definition): Pass 4310 parser->type_definition_forbidden_message_arg as second argument to 4311 error. 4312 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set 4313 parser->type_definition_forbidden_message_arg and use G_() with 4314 %qs for parser->type_definition_forbidden_message instead of 4315 building untranslatable message using concat. 4316 43172019-04-09 Jakub Jelinek <jakub@redhat.com> 4318 4319 PR translation/90011 4320 * typeck2.c (check_narrowing): Remove trailing space from diagnostics. 4321 43222019-04-08 Marek Polacek <polacek@redhat.com> 4323 4324 * typeck2.c (digest_init_r): Don't condition the object slicing warning 4325 on flag_checking. 4326 43272019-04-08 Paolo Carlini <paolo.carlini@oracle.com> 4328 4329 PR c++/89914 4330 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P 4331 when maybe_instantiate_noexcept fails. 4332 (classtype_has_nothrow_assign_or_copy_p): Likewise. 4333 * method.c (implicitly_declare_fn): Avoid passing error_mark_node 4334 to build_exception_variant. 4335 43362019-04-05 Marek Polacek <polacek@redhat.com> 4337 4338 PR c++/87145 - bogus error converting class type in template arg list. 4339 * pt.c (convert_nontype_argument): Don't call 4340 build_converted_constant_expr if it could involve calling a conversion 4341 function with a instantiation-dependent constructor as its argument. 4342 43432019-04-05 Martin Sebor <msebor@redhat.com> 4344 4345 PR bootstrap/89980 4346 * decl.c (reshape_init_array_1): Avoid treating empty strings 4347 as zeros in array initializers. 4348 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT(). 4349 43502019-04-04 Jason Merrill <jason@redhat.com> 4351 4352 PR c++/89948 - ICE with break in statement-expr. 4353 * constexpr.c (cxx_eval_statement_list): Jumping out of a 4354 statement-expr is non-constant. 4355 43562019-04-04 Jason Merrill <jason@redhat.com> 4357 4358 PR c++/89966 - error with non-type auto tparm. 4359 * pt.c (do_auto_deduction): Clear tf_partial. 4360 43612019-04-04 Jason Merrill <jason@redhat.com> 4362 4363 PR c++/86986 - ICE with TTP with parameter pack. 4364 * pt.c (coerce_template_parameter_pack): Only look at the type of a 4365 non-type parameter pack. 4366 (fixed_parameter_pack_p_1): Don't recurse into the type of a 4367 non-type parameter pack. 4368 (coerce_template_template_parms): Call add_outermost_template_args. 4369 43702019-04-04 Martin Sebor <msebor@redhat.com> 4371 4372 PR c++/89974 4373 PR c++/89878 4374 PR c++/89833 4375 PR c++/47488 4376 * decl.c (reshape_init_array_1): Strip trailing zero-initializers 4377 from arrays of trivial type and known size. 4378 * mangle.c (write_expression): Convert braced initializer lists 4379 to STRING_CSTs. 4380 (write_expression): Trim trailing zero-initializers from arrays 4381 of trivial type. 4382 (write_template_arg_literal): Mangle strings the same as braced 4383 initializer lists. 4384 43852019-04-03 Jason Merrill <jason@redhat.com> 4386 4387 PR c++/81866 - ICE with member template and default targ. 4388 * pt.c (tsubst_template_decl): Handle getting a type from 4389 retrieve_specialization. 4390 4391 PR c++/86586 - -fcompare-debug=-Wsign-compare. 4392 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare. 4393 4394 PR c++/89331 - ICE with offsetof in incomplete class. 4395 * semantics.c (finish_offsetof): Handle error_mark_node. 4396 * typeck.c (build_class_member_access_expr): Call 4397 complete_type_or_maybe_complain before converting to base. 4398 4399 PR c++/89917 - ICE with lambda in variadic mem-init. 4400 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false. 4401 44022019-04-01 Jason Merrill <jason@redhat.com> 4403 4404 PR c++/86946 - ICE with function call in template argument. 4405 DR 1321 4406 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use 4407 dependent_name. 4408 44092019-04-01 Paolo Carlini <paolo.carlini@oracle.com> 4410 4411 PR c++/62207 4412 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable. 4413 44142019-03-31 Marek Polacek <polacek@redhat.com> 4415 4416 PR c++/89852 - ICE with C++11 functional cast with { }. 4417 * constexpr.c (fold_non_dependent_expr_template): New static function 4418 broken out of... 4419 (fold_non_dependent_expr): ...here. 4420 (fold_non_dependent_init): New function. 4421 * cp-tree.h (fold_non_dependent_init): Declare. 4422 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead 4423 of fold_non_dependent_expr. Don't call maybe_constant_init. 4424 44252019-03-30 Jason Merrill <jason@redhat.com> 4426 4427 PR c++/89744 - ICE with specialization of member class template. 4428 * pt.c (lookup_template_class_1): If the partial instantiation is 4429 explicitly specialized, adjust. 4430 (maybe_process_partial_specialization): Also adjust 4431 CLASSTYPE_TI_ARGS. 4432 44332019-03-29 Jakub Jelinek <jakub@redhat.com> 4434 4435 PR sanitizer/89869 4436 * typeck.c: Include gimplify.h. 4437 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it 4438 for second time. Formatting fixes. 4439 44402019-03-29 Marek Polacek <polacek@redhat.com> 4441 4442 PR c++/89876 - ICE with deprecated conversion. 4443 * call.c (convert_like_real): Only give warnings with tf_warning. 4444 44452019-03-28 Marek Polacek <polacek@redhat.com> 4446 4447 PR c++/89612 - ICE with member friend template with noexcept. 4448 * pt.c (maybe_instantiate_noexcept): For function templates, use their 4449 template result (function decl). Don't set up local specializations. 4450 Temporarily turn on processing_template_decl. Update the template type 4451 too. 4452 4453 PR c++/89836 - bool constant expression and explicit conversions. 4454 * call.c (build_converted_constant_expr_internal): New function, 4455 renamed from... 4456 (build_converted_constant_expr): ...this. New. 4457 (build_converted_constant_bool_expr): New. 4458 * cp-tree.h (build_converted_constant_bool_expr): Declare. 4459 * decl.c (build_explicit_specifier): Call 4460 build_converted_constant_bool_expr. 4461 44622019-03-28 Jakub Jelinek <jakub@redhat.com> 4463 4464 PR c++/89785 4465 * constexpr.c (struct check_for_return_continue_data): New type. 4466 (check_for_return_continue): New function. 4467 (potential_constant_expression_1) <case SWITCH_STMT>: Walk 4468 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested 4469 in loop bodies and set *jump_target to that if found. 4470 44712019-03-27 Jason Merrill <jason@redhat.com> 4472 4473 PR c++/89831 - error with qualified-id in const member function. 4474 * semantics.c (finish_non_static_data_member): Use object cv-quals 4475 in scoped case, too. 4476 4477 PR c++/89421 - ICE with lambda in template parameter list. 4478 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a 4479 template parameter list before C++20. 4480 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR. 4481 * semantics.c (begin_class_definition): Restore error about defining 4482 non-lambda class in template parm list. 4483 44842019-03-26 Jason Merrill <jason@redhat.com> 4485 4486 PR c++/86932 - missed SFINAE with empty pack. 4487 * pt.c (coerce_template_parms): Don't add an empty pack if 4488 tf_partial. 4489 (fn_type_unification): Pass tf_partial to coerce_template_parms. 4490 4491 PR c++/86429 - constexpr variable in lambda. 4492 PR c++/82643 4493 PR c++/87327 4494 * constexpr.c (cxx_eval_constant_expression): In a lambda function, 4495 try evaluating the captured variable directly. 4496 44972019-03-26 Jakub Jelinek <jakub@redhat.com> 4498 4499 PR c++/89796 4500 * semantics.c (finish_omp_atomic): Add warning_sentinel for 4501 -Wunused-value around finish_expr_stmt call. 4502 45032019-03-25 Paolo Carlini <paolo.carlini@oracle.com> 4504 4505 PR c++/84661 4506 PR c++/85013 4507 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold 4508 to undo the disabling of warnings. 4509 45102019-03-25 Jason Merrill <jason@redhat.com> 4511 4512 PR c++/87748 - substitution failure error with decltype. 4513 * pt.c (most_specialized_partial_spec): Clear 4514 processing_template_decl. 4515 45162019-03-25 Marek Polacek <polacek@redhat.com> 4517 4518 PR c++/89214 - ICE when initializing aggregates with bases. 4519 * typeck2.c (digest_init_r): Warn about object slicing instead of 4520 crashing. 4521 4522 PR c++/89705 - ICE with reference binding with conversion function. 4523 * call.c (reference_binding): If the result of the conversion function 4524 is a prvalue of non-class type, use the cv-unqualified type. 4525 45262019-03-25 Nathan Sidwell <nathan@acm.org> 4527 4528 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group. 4529 45302019-03-22 Jakub Jelinek <jakub@redhat.com> 4531 4532 PR c++/60702 4533 * cp-tree.h (get_tls_wrapper_fn): Remove declaration. 4534 (maybe_get_tls_wrapper_call): Declare. 4535 * decl2.c (get_tls_wrapper_fn): Make static. 4536 (maybe_get_tls_wrapper_call): New function. 4537 * typeck.c (build_class_member_access_expr): Handle accesses to TLS 4538 variables. 4539 * semantics.c (finish_qualified_id_expr): Likewise. 4540 (finish_id_expression_1): Use maybe_get_tls_wrapper_call. 4541 * pt.c (tsubst_copy_and_build): Likewise. 4542 4543 PR c++/87481 4544 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member. 4545 (cxx_eval_constant_expression): When not skipping, not constant class 4546 or location wrapper, increment *ctx->constexpr_ops_count and if it is 4547 above constexpr_loop_nest_limit, diagnose failure. 4548 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and 4549 initialize ctx.constexpr_ops_count to its address. 4550 (is_sub_constant_expr): Likewise. 4551 45522019-03-21 Jakub Jelinek <jakub@redhat.com> 4553 4554 PR c++/71446 4555 * call.c (filed_in_pset): Change pset from hash_set<tree> * to 4556 hash_set<tree, true> &, adjust uses accordingly. 4557 (build_aggr_conv): Change pset from hash_set<tree> * 4558 to hash_set<tree, true>. Replace goto fail; with return NULL;, 4559 adjust pset uses. 4560 4561 PR c++/89767 4562 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id 4563 variables, check for duplicates in this function. 4564 * lambda.c (add_capture): Don't check for duplicates nor use 4565 IDENTIFIER_MARKED. 4566 (register_capture_members): Don't clear IDENTIFIER_MARKED here. 4567 45682019-03-21 Paolo Carlini <paolo.carlini@oracle.com> 4569 4570 PR c++/89571 4571 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing 4572 error_mark_node to comp_except_specs. 4573 45742019-03-20 Jason Merrill <jason@redhat.com> 4575 4576 PR c++/87480 - decltype of member access in default template arg 4577 * pt.c (type_unification_real): Accept a dependent result in 4578 template context. 4579 45802019-03-19 Martin Sebor <msebor@redhat.com> 4581 4582 PR tree-optimization/89688 4583 * typeck2.c (store_init_value): Call braced_lists_to_string for more 4584 kinds of initializers. 4585 45862019-03-18 Jason Merrill <jason@redhat.com> 4587 4588 PR c++/89630 - ICE with dependent using-decl as template arg. 4589 * tree.c (cp_tree_equal): Always return false for USING_DECL. 4590 4591 PR c++/89761 - ICE with sizeof... in pack expansion. 4592 * pt.c (argument_pack_element_is_expansion_p): Handle 4593 ARGUMENT_PACK_SELECT. 4594 4595 PR c++/89640 - GNU attributes on lambda. 4596 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes. 4597 4598 PR c++/89682 - wrong access error in default argument. 4599 * pt.c (tsubst_default_argument): Don't defer access checks. 4600 46012019-03-18 Paolo Carlini <paolo.carlini@oracle.com> 4602 4603 PR c++/85014 4604 * semantics.c (finish_non_static_data_member): Check return value 4605 of context_for_name_lookup and immediately return error_mark_node 4606 if isn't a type. 4607 46082019-03-17 Jason Merrill <jason@redhat.com> 4609 4610 PR c++/89571 - ICE with ill-formed noexcept on constructor. 4611 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted. 4612 (regenerate_decl_from_template): Use it for noexcept-specs. 4613 46142019-03-14 Jason Merrill <jason@redhat.com> 4615 4616 * parser.c (cp_parser_decl_specifier_seq): Support C++20 4617 concept-definition syntax without 'bool'. 4618 46192019-03-14 Jakub Jelinek <jakub@redhat.com> 4620 4621 PR c++/89512 4622 * semantics.c (finish_qualified_id_expr): Reject variable templates. 4623 4624 PR c++/89652 4625 * constexpr.c (struct constexpr_ctx): Change save_exprs type from 4626 hash_set<tree> to vec<tree>. 4627 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead 4628 of hash_set. 4629 (cxx_eval_loop_expr): Likewise. Truncate the vector after each 4630 removal of SAVE_EXPRs from values. 4631 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push 4632 method on save_exprs instead of add. 4633 46342019-03-13 Jason Merrill <jason@redhat.com> 4635 4636 PR c++/86521 - C++17 copy elision in initialization by constructor. 4637 * call.c (joust_maybe_elide_copy): New. 4638 (joust): Call it. 4639 46402019-03-13 Marek Polacek <polacek@redhat.com> 4641 4642 PR c++/88979 - further P0634 fix for constructors. 4643 * parser.c (cp_parser_decl_specifier_seq): Pass flags to 4644 cp_parser_constructor_declarator_p. 4645 (cp_parser_direct_declarator): Allow missing typename for constructor 4646 parameters. 4647 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to 4648 cp_parser_type_specifier. 4649 4650 PR c++/89686 - mixing init-capture and simple-capture in lambda. 4651 * parser.c (cp_parser_lambda_introducer): Give error when combining 4652 init-capture and simple-capture. 4653 4654 PR c++/89660 - bogus error with -Wredundant-move. 4655 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg 4656 as the std::move's argument. Don't call convert_for_initialization 4657 when warn_redundant_move isn't on. 4658 46592019-03-11 Jason Merrill <jason@redhat.com> 4660 4661 PR c++/86521 - wrong overload resolution with ref-qualifiers. 4662 * call.c (build_user_type_conversion_1): Don't use a conversion to a 4663 reference of the wrong rvalueness for direct binding. 4664 46652019-03-11 Martin Liska <mliska@suse.cz> 4666 4667 * cvt.c (build_expr_type_conversion): Wrap apostrophes 4668 in gcc internal format with %'. 4669 * decl.c (check_no_redeclaration_friend_default_args): Likewise. 4670 (grokfndecl): Likewise. 4671 * name-lookup.c (do_pushtag): Likewise. 4672 * pt.c (unify_parameter_deduction_failure): Likewise. 4673 (unify_template_deduction_failure): Likewise. 4674 46752019-03-11 Martin Liska <mliska@suse.cz> 4676 4677 * call.c (convert_arg_to_ellipsis): Wrap an option name 4678 in a string format message and fix GNU coding style. 4679 (build_over_call): Likewise. 4680 * class.c (check_field_decl): Likewise. 4681 (layout_nonempty_base_or_field): Likewise. 4682 * constexpr.c (cxx_eval_loop_expr): Likewise. 4683 * cvt.c (type_promotes_to): Likewise. 4684 * decl.c (cxx_init_decl_processing): Likewise. 4685 (mark_inline_variable): Likewise. 4686 (grokdeclarator): Likewise. 4687 * decl2.c (record_mangling): Likewise. 4688 * error.c (maybe_warn_cpp0x): Likewise. 4689 * except.c (doing_eh): Likewise. 4690 * mangle.c (maybe_check_abi_tags): Likewise. 4691 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. 4692 (cp_parser_userdef_numeric_literal): Likewise. 4693 (cp_parser_primary_expression): Likewise. 4694 (cp_parser_unqualified_id): Likewise. 4695 (cp_parser_pseudo_destructor_name): Likewise. 4696 (cp_parser_builtin_offsetof): Likewise. 4697 (cp_parser_lambda_expression): Likewise. 4698 (cp_parser_lambda_introducer): Likewise. 4699 (cp_parser_lambda_declarator_opt): Likewise. 4700 (cp_parser_selection_statement): Likewise. 4701 (cp_parser_init_statement): Likewise. 4702 (cp_parser_decomposition_declaration): Likewise. 4703 (cp_parser_function_specifier_opt): Likewise. 4704 (cp_parser_static_assert): Likewise. 4705 (cp_parser_simple_type_specifier): Likewise. 4706 (cp_parser_namespace_definition): Likewise. 4707 (cp_parser_using_declaration): Likewise. 4708 (cp_parser_ctor_initializer_opt_and_function_body): Likewise. 4709 (cp_parser_initializer_list): Likewise. 4710 (cp_parser_type_parameter_key): Likewise. 4711 (cp_parser_member_declaration): Likewise. 4712 (cp_parser_try_block): Likewise. 4713 (cp_parser_std_attribute_spec): Likewise. 4714 (cp_parser_requires_clause_opt): Likewise. 4715 * pt.c (check_template_variable): Likewise. 4716 (check_default_tmpl_args): Likewise. 4717 (push_tinst_level_loc): Likewise. 4718 (instantiate_pending_templates): Likewise. 4719 (invalid_nontype_parm_type_p): Likewise. 4720 * repo.c (get_base_filename): Likewise. 4721 * rtti.c (typeid_ok_p): Likewise. 4722 (build_dynamic_cast_1): Likewise. 4723 * tree.c (maybe_warn_parm_abi): Likewise. 4724 47252019-03-08 Jakub Jelinek <jakub@redhat.com> 4726 4727 PR other/80058 4728 * parser.c (cp_parser_template_declaration_after_parameters): Avoid 4729 one space before " at the end of line and another after " on another 4730 line in a string literal. 4731 4732 PR tree-optimization/89550 4733 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if 4734 warning_at returned true. 4735 * decl2.c (c_parse_final_cleanups): Likewise. 4736 * typeck.c (convert_for_assignment): Likewise. 4737 * decl.c (finish_function): Likewise. 4738 4739 PR c++/89585 4740 * parser.c (cp_parser_asm_definition): Just warn instead of error 4741 on volatile qualifier outside of function body. 4742 4743 PR c++/89599 4744 * constexpr.c (potential_constant_expression_1): Reject 4745 REINTERPRET_CAST_P NOP_EXPRs. 4746 4747 PR c++/89622 4748 * call.c (joust): Call print_z_candidate only if pedwarn returned 4749 true. 4750 47512019-03-07 Jason Merrill <jason@redhat.com> 4752 4753 PR c++/88123 - lambda and using-directive. 4754 * name-lookup.c (op_unqualified_lookup) 4755 (maybe_save_operator_binding, discard_operator_bindings) 4756 (push_operator_bindings): New. 4757 * typeck.c (build_x_binary_op, build_x_unary_op): Call 4758 maybe_save_operator_binding. 4759 * decl.c (start_preparsed_function): Call push_operator_bindings. 4760 * tree.c (cp_free_lang_data): Call discard_operator_bindings. 4761 4762 PR c++/88820 - ICE with CTAD and member template used in DMI. 4763 * pt.c (do_class_deduction): Handle parm used as its own arg. 4764 47652019-03-07 Jakub Jelinek <jakub@redhat.com> 4766 4767 PR c++/89585 4768 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even 4769 at toplevel, but diagnose them. 4770 47712019-03-06 Jason Merrill <jason@redhat.com> 4772 4773 PR c++/89381 - implicit copy and using-declaration. 4774 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider 4775 op= brought in by a using-declaration. 4776 47772019-03-06 Jakub Jelinek <jakub@redhat.com> 4778 4779 PR c++/87148 4780 * init.c (build_value_init_noctor): Ignore flexible array members. 4781 47822019-03-06 Jason Merrill <jason@redhat.com> 4783 4784 PR c++/89576 - if constexpr of lambda capture. 4785 * semantics.c (maybe_convert_cond): Do convert a non-dependent 4786 condition in a template. 4787 * typeck.c (condition_conversion): Handle being called in a 4788 template. 4789 47902019-03-06 Marek Polacek <polacek@redhat.com> 4791 4792 PR c++/87378 - bogus -Wredundant-move warning. 4793 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue 4794 overload resolution would actually succeed. 4795 47962019-03-05 Jason Merrill <jason@redhat.com> 4797 4798 * class.c (is_really_empty_class): Add ignore_vptr parm. 4799 (trivial_default_constructor_is_constexpr): Pass it. 4800 * call.c (build_over_call): Pass it. 4801 * constexpr.c (cxx_eval_constant_expression): Pass it instead of 4802 checking TYPE_POLYMORPHIC_P. 4803 (cxx_eval_component_reference, potential_constant_expression_1): 4804 Pass it. 4805 * cp-gimplify.c (simple_empty_class_p): Pass it. 4806 * init.c (expand_aggr_init_1): Pass it. 4807 48082019-03-04 Paolo Carlini <paolo.carlini@oracle.com> 4809 4810 PR c++/84605 4811 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too. 4812 48132019-03-04 Jakub Jelinek <jakub@redhat.com> 4814 4815 PR c++/71446 4816 * call.c (field_in_pset): New function. 4817 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly. 4818 48192019-03-02 Jakub Jelinek <jakub@redhat.com> 4820 4821 PR c++/71446 4822 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define. 4823 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list 4824 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT. 4825 (cp_parser_initializer_list): Add designated parameter, set *designated 4826 to a bool whether any designators were parsed. 4827 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if 4828 needed. 4829 * pt.c (tsubst_copy_and_build): Likewise. 4830 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT, 4831 don't call build_list_conv, nor build_complex_conv, nor attempt to 4832 convert a single element initializer to scalar. 4833 48342019-03-01 Marek Polacek <polacek@redhat.com> 4835 4836 PR c++/89537 - missing location for error with non-static member fn. 4837 * call.c (resolve_args): Use EXPR_LOCATION. 4838 * typeck.c (build_class_member_access_expr): Use input_location. 4839 4840 PR c++/89532 - ICE with incomplete type in decltype. 4841 * semantics.c (finish_compound_literal): Return error_mark_node 4842 if digest_init_flags returns error_mark_node. 4843 48442019-03-01 Jakub Jelinek <jakub@redhat.com> 4845 4846 Implement P1002R1, Try-catch blocks in constexpr functions 4847 PR c++/89513 4848 * parser.c (cp_parser_ctor_initializer_opt_and_function_body): 4849 Diagnose constexpr ctor or function with function-try-block with 4850 pedwarn for c++17 and earlier. Formatting fix. 4851 (cp_parser_try_block): Use pedwarn instead of error and only for 4852 c++17 and earlier when try block appears in constexpr function. 4853 * constexpr.c (build_constexpr_constructor_member_initializers): 4854 Handle TRY_BLOCK here instead of erroring on it. 4855 48562019-02-28 Jason Merrill <jason@redhat.com> 4857 4858 PR c++/88183 - ICE with .* fold-expression. 4859 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling. 4860 4861 PR c++/86969 - ICE with constexpr if and recursive generic lambdas. 4862 * class.c, lambda.c, pt.c: Revert earlier change. 4863 * lambda.c (add_capture): Don't special-case capture of dependent 4864 VLA. 4865 4866 * name-lookup.c (print_binding_level): Print this_entity. 4867 48682019-02-27 Marek Polacek <polacek@redhat.com> 4869 4870 PR c++/88857 - ICE with value-initialization of argument in template. 4871 * call.c (convert_like_real): Don't call build_value_init in template. 4872 48732019-02-27 Jason Merrill <jason@redhat.com> 4874 4875 PR c++/86969 - ICE with constexpr if and recursive generic lambdas. 4876 * semantics.c (process_outer_var_ref): Do capture dependent vars. 4877 * class.c (finish_struct): Only add TAG_DEFN if T is in 4878 current_function_decl. 4879 * lambda.c (vla_capture_type): Force the capture type out into the 4880 lambda's enclosing function. 4881 (add_capture): Pass in the lambda. 4882 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type. 4883 48842019-02-27 Marek Polacek <polacek@redhat.com> 4885 4886 PR c++/89511 - ICE with using-declaration and unscoped enumerator. 4887 * parser.c (cp_parser_using_declaration): For an unscoped enum 4888 only use its context if it's not a function declaration. 4889 48902019-02-27 Paolo Carlini <paolo.carlini@oracle.com> 4891 4892 PR c++/89488 4893 * method.c (process_subob_fn): When maybe_instantiate_noexcept 4894 returns false don't call merge_exception_specifiers. 4895 48962019-02-27 Paolo Carlini <paolo.carlini@oracle.com> 4897 4898 PR c++/88987 4899 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE 4900 for a non-constant parsed expression. 4901 49022019-02-26 Jakub Jelinek <jakub@redhat.com> 4903 4904 PR c++/89481 4905 * constexpr.c (cxx_eval_store_expression): When changing active union 4906 member, set no_zero_init. 4907 49082019-02-23 Marek Polacek <polacek@redhat.com> 4909 4910 PR c++/88294 - ICE with non-constant noexcept-specifier. 4911 * pt.c (maybe_instantiate_noexcept): Set up the list of local 4912 specializations. Set current_class_{ptr,ref}. 4913 49142019-02-22 David Malcolm <dmalcolm@redhat.com> 4915 4916 PR c++/89390 4917 * parser.c (cp_parser_unqualified_id): Capture and use locations 4918 for destructors. 4919 49202019-02-22 Marek Polacek <polacek@redhat.com> 4921 4922 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier. 4923 * decl.c (build_explicit_specifier): Don't check 4924 processing_template_decl. Call instantiation_dependent_expression_p 4925 instead of value_dependent_expression_p. Call 4926 instantiate_non_dependent_expr_sfinae before 4927 build_converted_constant_expr instead of calling 4928 instantiate_non_dependent_expr after it. Add 4929 processing_template_decl_sentinel. 4930 49312019-02-22 Thomas Schwinge <thomas@codesourcery.com> 4932 4933 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal 4934 parameter, move loc formal parameter to the front. Adjust all 4935 users. 4936 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust 4937 all users. 4938 49392019-02-21 Jason Merrill <jason@redhat.com> 4940 4941 PR c++/87685 - generic lambda 'this' capture error. 4942 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int. 4943 (maybe_generic_this_capture): Pass -1. 4944 4945 PR c++/88394 - ICE with VLA init-capture. 4946 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE. 4947 4948 PR c++/88869 - C++17 ICE with CTAD and explicit specialization. 4949 * pt.c (do_class_deduction): Don't include explicit specialization 4950 args in outer_args. 4951 4952 PR c++/89422 - ICE with -g and lambda in default arg in template. 4953 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner. 4954 49552019-02-21 Jason Merrill <jason@redhat.com> 4956 4957 PR c++/88419 - C++17 ICE with class template arg deduction. 4958 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after 4959 CLASS_PLACEHOLDER_TEMPLATE. 4960 49612019-02-21 Jakub Jelinek <jakub@redhat.com> 4962 4963 PR c++/89285 4964 * constexpr.c (struct constexpr_fundef): Add parms and result members. 4965 (retrieve_constexpr_fundef): Adjust for the above change. 4966 (register_constexpr_fundef): Save constexpr body with copy_fn, 4967 temporarily set DECL_CONTEXT on DECL_RESULT before that. 4968 (get_fundef_copy): Change FUN argument to FUNDEF with 4969 constexpr_fundef * type, grab body and parms/result out of 4970 constexpr_fundef struct and temporarily change it for copy_fn calls 4971 too. 4972 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily 4973 adjust current_function_decl from ctx->call context. Test 4974 !potential_constant_expression instead of !is_constant_expression. 4975 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo 4976 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing. 4977 (cxx_eval_call_expression): Adjust get_fundef_copy caller. 4978 (cxx_eval_conditional_expression): For IF_STMT, allow then or else 4979 operands to be NULL. 4980 (label_matches): Handle BREAK_STMT and CONTINUE_STMT. 4981 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT. 4982 (cxx_eval_switch_expr): Add support for SWITCH_STMT. 4983 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT, 4984 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT. 4985 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore 4986 DECL_EXPR with USING_DECL operand. 4987 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using 4988 build_int_cst to make it a valid constant expression. 4989 49902019-02-20 Jason Merrill <jason@redhat.com> 4991 4992 PR c++/88690 - C++17 ICE with empty base in aggregate. 4993 * typeck2.c (process_init_constructor_record): Skip trivial 4994 initialization of an empty base. 4995 49962019-02-21 Richard Biener <rguenther@suse.de> 4997 4998 PR middle-end/89392 4999 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not 5000 make symtab process new functions here. 5001 50022019-02-20 Jason Merrill <jason@redhat.com> 5003 5004 PR c++/87921 - wrong error with inline static data member. 5005 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P 5006 for a non-template inline variable. Do nothing for an 5007 already-instantiated variable. 5008 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without 5009 DECL_INLINE_VAR_P. 5010 * decl.c (check_initializer): Likewise. 5011 (make_rtl_for_nonlocal_decl): Likewise. 5012 * pt.c (instantiate_decl): Likewise. 5013 * typeck2.c (store_init_value): Likewise. 5014 50152019-02-20 Jakub Jelinek <jakub@redhat.com> 5016 5017 PR c++/89403 5018 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting 5019 for flag_syntax_only from here... 5020 * semantics.c (expand_or_defer_fn_1): ... here. 5021 5022 PR c++/89405 5023 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and 5024 DECL_COMMON, set DECL_INTERFACE_KNOWN. 5025 5026 PR c++/89336 5027 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active 5028 union member for -std=c++17 and earlier. 5029 50302019-02-19 Jason Merrill <jason@redhat.com> 5031 5032 PR c++/87513 - 'sorry' mangling PMF template-id. 5033 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK. 5034 50352019-02-19 Jason Merrill <jason@redhat.com> 5036 5037 PR c++/88380 - wrong-code with flexible array and NSDMI. 5038 * typeck2.c (process_init_constructor_record): Skip flexarrays. 5039 50402019-02-20 will wray <wjwray@gmail.com> 5041 5042 PR c++/88572 - wrong handling of braces on scalar init. 5043 * decl.c (reshape_init_r): Allow braces around scalar initializer 5044 within aggregate init. Reject double braced-init of scalar 5045 variable. 5046 50472019-02-20 Paolo Carlini <paolo.carlini@oracle.com> 5048 5049 PR c++/84536 5050 * pt.c (tsubst_init): Diagnose an initializer expanding to an 5051 empty list of expressions; tweak wrt dependent types. 5052 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init 5053 instead of tsubst_expr. 5054 50552019-02-19 Jason Merrill <jason@redhat.com> 5056 5057 PR c++/88368 - wrong 'use of deleted function' 5058 * method.c (walk_field_subobs): Remember errors from get_nsdmi. 5059 (get_defaulted_eh_spec): Call push_tinst_level. 5060 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node. 5061 * typeck2.c (merge_exception_specifiers): Handle error_mark_node. 5062 50632019-02-19 Chung-Lin Tang <cltang@codesourcery.com> 5064 5065 PR c/87924 5066 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait 5067 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments. 5068 50692019-02-19 Jakub Jelinek <jakub@redhat.com> 5070 5071 PR c++/89387 5072 * lambda.c (maybe_generic_this_capture): Don't check 5073 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs. 5074 5075 PR c++/89391 5076 * typeck.c (build_reinterpret_cast_1): Don't handle void to 5077 && conversion go through build_target_expr_with_type. 5078 5079 PR c++/89390 5080 * error.c (qualified_name_lookup_error): Only call 5081 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE. 5082 50832019-02-19 Tom Honermann <tom@honermann.net> 5084 5085 * name-lookup.c (get_std_name_hint): Added u8string as a name hint. 5086 50872019-02-18 Jason Merrill <jason@redhat.com> 5088 5089 PR c++/89336 - multiple stores in constexpr stmt. 5090 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or 5091 assigned value. 5092 5093 * pt.c (check_explicit_specialization): If the declarator is a 5094 template-id, only check whether the arguments are dependent. 5095 5096 Improve duplicate [[likely]] diagnostic. 5097 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it 5098 to process_stmt_hotness_attribute. 5099 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc. 5100 (genericize_if_stmt): Use likely/unlikely instead of predictor_name. 5101 51022019-02-17 Marek Polacek <polacek@redhat.com> 5103 5104 PR c++/89217 - ICE with list-initialization in range-based for loop. 5105 * constexpr.c (unshare_constructor): No longer static. 5106 * cp-tree.h (unshare_constructor): Declare. 5107 * semantics.c (finish_compound_literal): When dealing with a 5108 non-dependent expression in a template, return the original 5109 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags. 5110 51112019-02-13 Marek Polacek <polacek@redhat.com> 5112 5113 PR c++/89297 - ICE with OVERLOAD in template. 5114 * semantics.c (finish_compound_literal): Call 5115 instantiate_non_dependent_expr_sfinae. 5116 51172019-02-13 Alexandre Oliva <aoliva@redhat.com> 5118 5119 PR c++/86379 5120 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type. 5121 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE. 5122 * search.c (protected_accessible_p): Follow USING_DECL_DECLS. 5123 (shared_member_p): Likewise. 5124 (lookup_member): Likewise. 5125 * decl.c (grok_special_member_properties): Skip USING_DECLs. 5126 * semantics.c (finish_omp_declare_simd_methods): Likewise. 5127 (finish_qualified_id_expr): Do not call shared_member_p with 5128 a dependent expr. 5129 5130 PR c++/87322 5131 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting. 5132 Move cp_evaluated resetting before signature tsubsting. 5133 (gen_elem_of_pack_expansion_instantiation): Separate local 5134 specializations per index. 5135 51362019-02-13 David Malcolm <dmalcolm@redhat.com> 5137 5138 PR c++/89036 5139 * class.c (add_method): Drop destructor assertion. 5140 51412019-02-13 Paolo Carlini <paolo.carlini@oracle.com> 5142 5143 PR c++/88986 5144 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as 5145 context (the first argument). 5146 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION 5147 as context. 5148 51492019-02-12 Jason Merrill <jason@redhat.com> 5150 5151 PR c++/89144 - link error with constexpr initializer_list. 5152 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary 5153 array for an empty list. 5154 * typeck2.c (store_init_value): Don't use cxx_constant_init in a 5155 template. 5156 51572019-02-11 Jason Merrill <jason@redhat.com> 5158 5159 PR c++/89241 - ICE with __func__ in lambda in template. 5160 * pt.c (enclosing_instantiation_of): Also check 5161 instantiated_lambda_fn_p for the template context. 5162 51632019-02-11 Marek Polacek <polacek@redhat.com> 5164 5165 PR c++/89212 - ICE converting nullptr to pointer-to-member-function. 5166 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for 5167 null member pointer value. 5168 51692019-02-11 Jakub Jelinek <jakub@redhat.com> 5170 5171 PR c++/88977 5172 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval 5173 to maybe_constant_value calls. 5174 51752019-02-11 Marek Polacek <polacek@redhat.com> 5176 5177 * typeck2.c (digest_init_r): Remove commented code. 5178 51792019-02-11 Martin Sebor <msebor@redhat.com> 5180 5181 PR c++/87996 5182 * decl.c (compute_array_index_type_loc): Preserve signed sizes 5183 for diagnostics. Call valid_array_size_p instead of error. 5184 * init.c (build_new_1): Compute size for diagnostic. Call 5185 invalid_array_size_error 5186 (build_new): Call valid_array_size_p instead of error. 5187 51882019-02-07 Alexandre Oliva <aoliva@redhat.com> 5189 5190 PR c++/86218 5191 * call.c (compare_ics): Deal with ck_aggr in either cs. 5192 51932019-02-06 David Malcolm <dmalcolm@redhat.com> 5194 5195 PR c++/71302 5196 * call.c (get_location_for_expr_unwinding_for_system_header): New 5197 function. 5198 (conversion_null_warnings): Use it when getting locations for 5199 EXPR, effectively adding a call to 5200 get_location_for_expr_unwinding_for_system_header for 5201 -Wconversion-null and making use of EXPR_LOCATION for 5202 -Wzero-as-null-pointer-constant. 5203 52042019-02-05 Jakub Jelinek <jakub@redhat.com> 5205 5206 PR c++/89187 5207 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on 5208 PARM_DECLs of the thunk. 5209 * lambda.c (maybe_add_lambda_conv_op): Likewise. 5210 52112019-02-05 Marek Polacek <polacek@redhat.com> 5212 5213 PR c++/89158 - by-value capture of constexpr variable broken. 5214 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read 5215 instead of mark_rvalue_use. 5216 52172019-02-05 Alexandre Oliva <aoliva@redhat.com> 5218 5219 PR c++/87770 5220 * pt.c (instantiates_primary_template_p): New. 5221 (type_dependent_expression_p): Use it. 5222 52232019-02-01 Jason Merrill <jason@redhat.com> 5224 5225 PR c++/88761 - ICE with reference capture of constant. 5226 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for 5227 non-proxy decls. 5228 52292019-02-01 Marek Polacek <polacek@redhat.com> 5230 5231 PR c++/88325 - ICE with invalid out-of-line template member definition. 5232 * parser.c (cp_parser_class_name): Don't call make_typename_type 5233 for overloads. 5234 52352019-02-01 Jakub Jelinek <jakub@redhat.com> 5236 5237 PR c++/87175 5238 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false 5239 if require_open failed. 5240 52412019-01-31 Marek Polacek <polacek@redhat.com> 5242 5243 PR c++/89083, c++/80864 - ICE with list initialization in template. 5244 * constexpr.c (adjust_temp_type): Use copy_node and change the type 5245 instead of using build_constructor. 5246 * decl.c (reshape_init_r): Don't reshape a digested initializer. 5247 Return the initializer for COMPOUND_LITERAL_P. 5248 5249 PR c++/88983 - ICE with switch in constexpr function. 5250 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY. 5251 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the 5252 label in the else branch if we found it in the then branch. 5253 52542019-01-30 Jason Merrill <jason@redhat.com> 5255 5256 PR c++/88752 - ICE with lambda and constexpr if. 5257 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New. 5258 * pt.c (tsubst_lambda_expr): Set it. 5259 (instantiated_lambda_fn_p): Check it. 5260 (enclosing_instantiation_of): Use it. 5261 52622019-01-31 Jakub Jelinek <jakub@redhat.com> 5263 5264 PR libstdc++/88170 5265 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as 5266 a C cast in pp_c_flag_gnu_v3 mode. 5267 52682019-01-30 Jakub Jelinek <jakub@redhat.com> 5269 5270 PR c++/88988 5271 * lambda.c (is_capture_proxy): Don't return true for 5272 DECL_OMP_PRIVATIZED_MEMBER artificial vars. 5273 52742019-01-30 Marek Polacek <polacek@redhat.com> 5275 5276 PR c++/89119 - ICE with value-initialization in template. 5277 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR. 5278 52792019-01-29 Jason Merrill <jason@redhat.com> 5280 5281 PR c++/86943 - wrong code converting lambda to function pointer. 5282 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the 5283 call. Only forward parms for decltype. 5284 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P 5285 specially. 5286 * typeck.c (check_return_expr): Don't mess with a thunk call. 5287 52882019-01-28 Jason Merrill <jason@redhat.com> 5289 5290 PR c++/89089 - ICE with [[no_unique_address]]. 5291 PR c++/88865 - wrong layout with [[no_unique_address]]. 5292 * class.c (check_field_decls): A potentially-overlapping field makes 5293 the class non-layout-POD, but not non-empty. 5294 (end_of_class): Always consider empty data members. 5295 (layout_class_type): Set DECL_SIZE for empty fields. 5296 52972019-01-28 Marek Polacek <polacek@redhat.com> 5298 5299 PR c++/88358 - name wrongly treated as type. 5300 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id 5301 in parameter-list is a type if the function's declarator-id is not 5302 qualified. 5303 53042019-01-27 Marek Polacek <polacek@redhat.com> 5305 5306 PR c++/88815 - narrowing conversion lost in decltype. 5307 PR c++/78244 - narrowing conversion in template not detected. 5308 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New. 5309 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with 5310 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent. 5311 * semantics.c (finish_compound_literal): When the compound literal 5312 isn't instantiation-dependent and the type isn't type-dependent, 5313 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT. 5314 5315 PR c++/89024 - ICE with incomplete enum type. 5316 * call.c (standard_conversion): When converting an 5317 ARITHMETIC_TYPE_P to an incomplete type, return NULL. 5318 53192019-01-25 Paolo Carlini <paolo.carlini@oracle.com> 5320 5321 PR c++/88969 5322 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1). 5323 * decl2.c (coerce_delete_type): Use build_pointer_type instead 5324 of TYPE_POINTER_TO. 5325 53262019-01-24 Jason Merrill <jason@redhat.com> 5327 5328 PR c++/89001 - mangling of reference temporaries 5329 * cp-tree.h (struct saved_scope): Add ref_temp_count. 5330 (current_ref_temp_count): New macro. 5331 * mangle.c (mangle_ref_init_variable): Use it. 5332 * typeck2.c (store_init_value): Clear it. 5333 * call.c (make_temporary_var_for_ref_to_temp): Copy public and 5334 comdat. 5335 53362019-01-24 Jakub Jelinek <jakub@redhat.com> 5337 5338 PR c++/88976 5339 * semantics.c (finish_omp_cancel): Diagnose more than one if 5340 on #pragma omp cancel with different modifiers. Use 5341 maybe_convert_cond when not in template or build_x_binary_op 5342 otherwise. 5343 53442019-01-23 Marek Polacek <polacek@redhat.com> 5345 5346 PR c++/88757 - qualified name treated wrongly as type. 5347 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids 5348 in parameter-list as types if name lookup for declarator-id didn't 5349 find one or more function templates. 5350 53512019-01-23 Jakub Jelinek <jakub@redhat.com> 5352 5353 PR c/44715 5354 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only 5355 after genericizing cond and incr expressions. 5356 5357 PR c++/88984 5358 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization 5359 before the begin_bc_block call. 5360 53612019-01-21 Jason Merrill <jason@redhat.com> 5362 5363 PR c++/87893 - constexpr ctor ICE on ARM. 5364 PR c++/88293 - ICE with comma expression. 5365 * constexpr.c (initialized_type): Don't shortcut non-void type. 5366 Handle COMPOUND_EXPR. 5367 (cxx_eval_outermost_constant_expr): Return early for void type. 5368 53692019-01-21 Jakub Jelinek <jakub@redhat.com> 5370 5371 PR c++/88949 5372 * optimize.c (cxx_copy_decl): New function. 5373 (clone_body): Use it instead of copy_decl_no_change. 5374 5375 PR sanitizer/88901 5376 * typeck.c (cp_build_binary_op): Don't instrument 5377 SANITIZE_POINTER_COMPARE if processing_template_decl. 5378 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT. 5379 53802019-01-18 Jason Merrill <jason@redhat.com> 5381 5382 PR c++/88875 - error with explicit list constructor. 5383 * call.c (reference_binding): Don't modify EXPR. Set 5384 need_temporary_p on the ck_user conversion for a temporary. 5385 (convert_like_real): Check it. 5386 53872019-01-18 H.J. Lu <hongjiu.lu@intel.com> 5388 5389 PR c/51628 5390 PR c/88664 5391 * call.c (convert_for_arg_passing): Upate the 5392 warn_for_address_or_pointer_of_packed_member call. 5393 * typeck.c (convert_for_assignment): Likewise. 5394 53952019-01-17 Jason Merrill <jason@redhat.com> 5396 5397 PR c++/86205 - ICE with ?: of throw and template-id. 5398 * pt.c (resolve_nondeduced_context_or_error): Split out from... 5399 * typeck.c (decay_conversion): ...here. 5400 * call.c (build_conditional_expr_1): Use it. 5401 5402 PR c++/86740, ICE with constexpr if and nested generic lambdas. 5403 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR. 5404 54052019-01-17 Paolo Carlini <paolo.carlini@oracle.com> 5406 5407 * decl.c (grokdeclarator): Use typespec_loc in error messages 5408 about 'auto' and trailing return type. 5409 54102019-01-17 David Malcolm <dmalcolm@redhat.com> 5411 5412 PR c++/88699 5413 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on 5414 USING_DECLs. 5415 54162019-01-17 Nathan Sidwell <nathan@acm.org> 5417 5418 PR c++/86610 5419 * semantics.c (process_outer_var_ref): Only skip dependent types 5420 in templates. 5421 54222019-01-17 Alexandre Oliva <aoliva@redhat.com> 5423 5424 PR c++/87768 5425 * cp-tree.h (saved_scope): Add suppress_location_wrappers. 5426 * name-lookup.c (do_push_to_top_level): Save and reset it. 5427 (do_pop_from_top_level): Restore it. 5428 5429 PR c++/86648 5430 * pt.c (make_template_placeholder): Use auto_identifier. 5431 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test. 5432 * error.c (dump_type): Handle template placeholders. 5433 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise. 5434 5435 PR c++/88146 5436 * cvt.c (convert_to_void): Handle all cdtor calls as if 5437 returning void. 5438 54392019-01-16 Paolo Carlini <paolo.carlini@oracle.com> 5440 5441 * decl.c (grokdeclarator): Use locations[ds_storage_class] in 5442 error messages about ill-formed uses of mutable. 5443 54442019-01-16 Marek Polacek <polacek@redhat.com> 5445 5446 PR c++/78244 - narrowing conversion in template not detected. 5447 * call.c (perform_implicit_conversion_flags): Set 5448 IMPLICIT_CONV_EXPR_BRACED_INIT. 5449 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New. 5450 * pt.c (tsubst_copy_and_build): Use it. 5451 54522019-01-15 David Malcolm <dmalcolm@redhat.com> 5453 5454 PR c++/88795 5455 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types 5456 fails. 5457 54582019-01-15 Paolo Carlini <paolo.carlini@oracle.com> 5459 5460 * decl.c (start_decl): Improve error location. 5461 * decl2.c (grokfield): Likewise. 5462 54632019-01-15 Paolo Carlini <paolo.carlini@oracle.com> 5464 5465 * decl.c (grokdeclarator): Move further up the location_t loc 5466 declaration and use the location when building a TYPE_DECL for 5467 a typedef name. 5468 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error 5469 about an ill-formed bit-field as typedef. 5470 54712019-01-14 Marek Polacek <polacek@redhat.com> 5472 5473 PR c++/88830 - ICE with abstract class. 5474 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR. 5475 Fix formatting. 5476 5477 PR c++/88825 - ICE with bogus function return type deduction. 5478 * typeck.c (can_do_nrvo_p): Check error_mark_node. 5479 54802019-01-14 Tom Honermann <tom@honermann.net> 5481 5482 Implement P0482R5, char8_t: A type for UTF-8 characters and strings 5483 * cvt.c (type_promotes_to): Handle char8_t promotion. 5484 * decl.c (grokdeclarator): Handle invalid type specifier 5485 combinations involving char8_t. 5486 * lex.c (init_reswords): Add char8_t as a reserved word. 5487 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du). 5488 * parser.c (cp_keyword_starts_decl_specifier_p) 5489 (cp_parser_simple_type_specifier): Recognize char8_t as a simple 5490 type specifier. 5491 (cp_parser_string_literal): Use char8_array_type_node for the type 5492 of CPP_UTF8STRING. 5493 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system 5494 headers. 5495 * rtti.c (emit_support_tinfos): type_info support for char8_t. 5496 * tree.c (char_type_p): Recognize char8_t as a character type. 5497 * typeck.c (string_conv_p): Handle conversions of u8 string 5498 literals of char8_t type. 5499 (check_literal_operator_args): Handle UDLs with u8 string literals 5500 of char8_t type. 5501 * typeck2.c (ordinary_char_type_p): New. 5502 (digest_init_r): Disallow initializing a char array with a u8 string 5503 literal. 5504 55052019-01-14 Martin Liska <mliska@suse.cz> 5506 5507 PR gcov-profile/88263 5508 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION 5509 as location of the TLS wrapper. 5510 55112019-01-12 Paolo Carlini <paolo.carlini@oracle.com> 5512 5513 * decl.c (cp_finish_decl): Improve error location. 5514 * decl2.c (grokfield): Likewise, improve two locations. 5515 55162019-01-11 Marek Polacek <polacek@redhat.com> 5517 5518 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this. 5519 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't 5520 ADDR_EXPR. 5521 55222019-01-11 Jason Merrill <jason@redhat.com> 5523 5524 PR c++/88312 - pack expansion of decltype. 5525 * pt.c (instantiation_dependent_r): A template non-type parameter 5526 pack is instantiation-dependent. 5527 55282019-01-11 Jason Merrill <jason@redhat.com> 5529 5530 PR c++/88613 - ICE with use of const var in lambda. 5531 * expr.c (mark_use): Fix location wrapper handling. 5532 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use. 5533 55342019-01-11 Tobias Burnus <burnus@net-b.de> 5535 5536 PR C++/88114 5537 * decl2.c (maybe_emit_vtables): If needed, generate code for 5538 the destructor of an abstract class. 5539 (mark_used): Update comment for older function-name change. 5540 55412019-01-11 Paolo Carlini <paolo.carlini@oracle.com> 5542 5543 * decl.c (start_decl): Improve error location. 5544 (grokdeclarator): Likewise, improve two locations. 5545 55462019-01-09 Sandra Loosemore <sandra@codesourcery.com> 5547 5548 PR other/16615 5549 5550 * cp-tree.h: Mechanically replace "can not" with "cannot". 5551 * parser.c: Likewise. 5552 * pt.c: Likewise. 5553 55542019-01-08 Paolo Carlini <paolo.carlini@oracle.com> 5555 5556 * decl.c (grok_reference_init): Improve error location. 5557 (grokdeclarator): Likewise, improve two locations. 5558 55592019-01-08 Marek Polacek <polacek@redhat.com> 5560 5561 PR c++/88538 - braced-init-list in template-argument-list. 5562 * parser.c (cp_parser_template_argument): Handle braced-init-list when 5563 in C++20. 5564 5565 PR c++/88548 - this accepted in static member functions. 5566 * parser.c (cp_debug_parser): Adjust printing of 5567 local_variables_forbidden_p. 5568 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false. 5569 (cp_parser_primary_expression): When checking 5570 local_variables_forbidden_p, use THIS_FORBIDDEN or 5571 LOCAL_VARS_FORBIDDEN. 5572 (cp_parser_lambda_body): Update the type of 5573 local_variables_forbidden_p. Set it to 0 rather than false. 5574 (cp_parser_condition): Adjust call to cp_parser_declarator. 5575 (cp_parser_explicit_instantiation): Likewise. 5576 (cp_parser_init_declarator): Likewise. 5577 (cp_parser_declarator): New parameter. Use it. 5578 (cp_parser_direct_declarator): New parameter. Use it to set 5579 local_variables_forbidden_p. Adjust call to cp_parser_declarator. 5580 (cp_parser_type_id_1): Adjust call to cp_parser_declarator. 5581 (cp_parser_parameter_declaration): Likewise. 5582 (cp_parser_default_argument): Update the type of 5583 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN 5584 rather than true. 5585 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw 5586 'static' or 'friend'. 5587 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator. 5588 (cp_parser_late_parsing_default_args): Update the type of 5589 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN 5590 rather than true. 5591 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator. 5592 (cp_parser_objc_class_ivars): Likewise. 5593 (cp_parser_objc_struct_declaration): Likewise. 5594 (cp_parser_omp_for_loop_init): Likewise. 5595 * parser.h (cp_parser): Change the type of local_variables_forbidden_p 5596 to unsigned char. 5597 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN): 5598 Define. 5599 56002019-01-08 Paolo Carlini <paolo.carlini@oracle.com> 5601 5602 * decl.c (start_decl): Improve permerror location. 5603 56042019-01-08 Jonathan Wakely <jwakely@redhat.com> 5605 Jakub Jelinek <jakub@redhat.com> 5606 5607 PR c++/88554 5608 * decl.c (finish_function): For -Wreturn-type don't add a return *this; 5609 fixit hint if current_class_ref is NULL. Use a single if instead of 5610 two nested ones. 5611 56122019-01-07 Paolo Carlini <paolo.carlini@oracle.com> 5613 5614 * decl.c (start_decl): Improve two error_at locations. 5615 (expand_static_init): Likewise. 5616 56172019-01-07 Marek Polacek <polacek@redhat.com> 5618 5619 PR c++/88741 - wrong error with initializer-string. 5620 * decl.c (cp_complete_array_type): Strip any location wrappers. 5621 56222019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de> 5623 5624 PR c++/88261 5625 PR c++/69338 5626 PR c++/69696 5627 PR c++/69697 5628 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value. 5629 * typeck2.c (digest_init_r): Raise an error for non-static 5630 initialization of a flexible array member. 5631 (process_init_constructor, massage_init_elt, 5632 process_init_constructor_array, process_init_constructor_record, 5633 process_init_constructor_union, process_init_constructor): Add the 5634 flags parameter and pass it thru. 5635 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to 5636 digest_init_flags for static decls. 5637 56382019-01-07 Jakub Jelinek <jakub@redhat.com> 5639 5640 PR c++/85052 5641 * cp-tree.h (cp_build_vec_convert): Declare. 5642 * parser.c (cp_parser_postfix_expression): Parse 5643 __builtin_convertvector. 5644 * constexpr.c: Include fold-const-call.h. 5645 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT. 5646 (potential_constant_expression_1): Likewise. 5647 * semantics.c (cp_build_vec_convert): New function. 5648 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to 5649 IFN_VEC_CONVERT. 5650 56512019-01-03 Jakub Jelinek <jakub@redhat.com> 5652 5653 PR c++/88636 5654 * decl.c (builtin_function_1): Return result of pushdecl_top_level 5655 or pushdecl rather than decl. 5656 56572019-01-03 Paolo Carlini <paolo.carlini@oracle.com> 5658 5659 * tree.c (handle_nodiscard_attribute): Improve warning location. 5660 56612019-01-02 Marek Polacek <polacek@redhat.com> 5662 5663 PR c++/88612 - ICE with -Waddress-of-packed-member. 5664 * call.c (convert_for_arg_passing): Only give warnings with tf_warning. 5665 * typeck.c (convert_for_assignment): Likewise. 5666 5667 PR c++/88631 - CTAD failing for value-initialization. 5668 * typeck2.c (build_functional_cast): Try deducing the template 5669 arguments even if there are no arguments to deduce from. 5670 56712019-01-01 Jakub Jelinek <jakub@redhat.com> 5672 5673 Update copyright years. 5674 5675Copyright (C) 2019-2020 Free Software Foundation, Inc. 5676 5677Copying and distribution of this file, with or without modification, 5678are permitted in any medium without royalty provided the copyright 5679notice and this notice are preserved. 5680