1 2017-11-19 Jakub Jelinek <jakub@redhat.com>
5 * cp-gimplify.c (c_fully_fold): Add LVAL argument, call
6 cp_fold_maybe_rvalue instead of cp_fold_rvalue and pass it !LVAL.
8 2017-11-16 Jason Merrill <jason@redhat.com>
10 PR c++/79092 - non-type args of different types are different
11 * tree.c (cp_tree_equal): Check the type of constants.
12 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Handle UNIFY_ALLOW_INTEGER
13 when comparing to previously deduced argument.
14 (maybe_convert_nontype_argument): New.
15 (convert_nontype_argument): Call it.
16 (tsubst_copy_and_build): Handle partial instantiation of
18 (unify): Ignore type when deducing from array bound.
19 (dependent_type_p_r): Handle DEFERRED_NOEXCEPT.
20 (value_dependent_expression_p): Any type-dependent expression is
21 value-dependent. Handle IMPLICIT_CONV_EXPR.
22 * cp-tree.h (IMPLICIT_CONV_EXPR_NONTYPE_ARG): New.
23 * mangle.c (write_template_arg): Strip IMPLICIT_CONV_EXPR.
25 2017-11-16 Nathan Sidwell <nathan@acm.org>
29 * cp-objcp-common.h (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME):
31 * cp-tree.h (overwrite_mangling): Declare.
32 * decl2.c (struct mangled_decl_hash): Entries are deletable.
33 (overwrite_mangling): New.
36 * decl.c (xref_tag_1): Push lambda into current scope.
37 * name-lookup.c (do_pushtag): Don't deal with ts_lambda here.
39 2017-11-15 Nathan Sidwell <nathan@acm.org>
42 * lambda.c (lambda_capture_field_type): Function references are
43 always catured by reference.
45 2017-11-15 Martin Liska <mliska@suse.cz>
47 * decl.c (begin_destructor_body): Use cp_build_fold_indirect_ref
48 instead of cp_build_indirect_ref.
50 2017-11-15 Martin Liska <mliska@suse.cz>
52 * decl.c (begin_destructor_body): In case of VPTR sanitization
53 (with disabled recovery), zero vptr in order to catch virtual calls
54 after lifetime of an object.
56 2017-11-14 Jason Merrill <jason@redhat.com>
58 Use GTY((cache)) on some hash tables.
59 * decl.c (decomp_type_table): Use tree_cache_map.
60 * init.c (nsdmi_inst): Likewise.
61 * pt.c (defarg_ints): Likewise.
62 * cp-objcp-common.c (cp_get_debug_type): Likewise.
64 2017-11-13 Jason Merrill <jason@redhat.com>
66 Capture adjustments for P0588R1.
67 * semantics.c (process_outer_var_ref): Capture variables when
68 they are named; complain about non-capture uses when odr-used.
69 * expr.c (mark_use): Rvalue use looks through capture proxy.
70 * constexpr.c (potential_constant_expression_1): Improve error about
71 use of captured variable.
72 * lambda.c (need_generic_capture, dependent_capture_r)
73 (do_dependent_capture, processing_nonlambda_template): Remove.
74 * call.c (build_this): Remove uses of the above.
75 * decl.c (cp_finish_decl): Likewise.
76 * semantics.c (maybe_cleanup_point_expr)
77 (maybe_cleanup_point_expr_void, finish_goto_stmt)
78 (maybe_convert_cond): Likewise.
79 * typeck.c (check_return_expr): Likewise.
82 * typeck.c (cp_build_fold_indirect_ref): New.
83 (cp_build_indirect_ref_1): Split out from cp_build_indirect_ref.
85 * cp-tree.h: Declare cp_build_fold_indirect_ref.
86 * call.c, class.c, cp-ubsan.c, decl.c, except.c, init.c, lambda.c,
87 parser.c, rtti.c, tree.c, typeck.c, typeck2.c: Use it.
88 * parser.c (do_range_for_auto_deduction): Use RO_UNARY_STAR.
89 (cp_convert_range_for): Likewise.
90 * typeck2.c (build_x_arrow): Use RO_ARROW.
92 * cp-ubsan.c (cp_ubsan_check_member_access_r): Fix handling of
93 INDIRECT_REF of ADDR_EXPR.
95 PR c++/82360 - ICE with static_cast in template.
96 * call.c (perform_direct_initialization_if_possible): Check
97 processing_template_decl.
98 * typeck.c (build_static_cast_1): Likewise.
100 2017-11-13 Ville Voutilainen <ville.voutilainen@gmail.com>
102 Remove the null check from placement new in all modes
103 * init.c (build_new_1): Don't do a null check for
104 a namespace-scope non-replaceable placement new
105 in any mode unless -fcheck-new is provided.
107 2017-11-07 Boris Kolpackov <boris@codesynthesis.com>
109 * Make-lang.in (CP_PLUGIN_HEADERS): Add operators.def since included
112 2017-11-07 Jakub Jelinek <jakub@redhat.com>
115 * cp-gimplify.c (cxx_omp_clause_apply_fn): For methods pass i - 1 to
116 convert_default_arg instead of i.
118 2017-11-06 Jason Merrill <jason@redhat.com>
120 P0704R1 - fixing const-qualified pointers to members
121 * typeck2.c (build_m_component_ref): Also accept in lower stds with
124 2017-11-06 Paolo Carlini <paolo.carlini@oracle.com>
127 * decl2.c (finish_static_data_member_decl): If there's an initializer,
128 complete the type and re-apply the quals.
130 2017-11-06 Martin Liska <mliska@suse.cz>
133 * constexpr.c (cxx_eval_builtin_function_call): Handle
134 __builtin_unreachable call.
135 (get_function_named_in_call): Declare function earlier.
136 (constexpr_fn_retval): Skip __builtin_unreachable.
137 * cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
139 (cp_maybe_instrument_return): ... this.
140 (cp_genericize): Call the function unconditionally.
142 2017-11-03 Nathan Sidwell <nathan@acm.org>
145 * decl.c (grokdeclarator): Protect MAYBE_CLASS things from paren
148 2017-11-02 Paolo Carlini <paolo.carlini@oracle.com>
151 * pt.c (make_pack_expansion): Add tsubst_flags_t parameter.
152 (expand_integer_pack, convert_template_argument, coerce_template_parms,
153 gen_elem_of_pack_expansion_instantiation, tsubst_pack_expansion,
154 unify): Adjust calls.
155 * tree.c (cp_build_qualified_type_real): Likewise.
156 * cp-tree.h (make_pack_expansion): Adjust declaration.
158 2017-11-02 Nathan Sidwell <nathan@acm.org>
160 * cp-tree.h (IDENTIFIER_NEWDEL_OP_P): Restore, adjust.
161 (IDENTIFIER_NEW_OP_P): New.
162 * decl.c (grokdeclarator): Restore IDENTIFIER_NEWDEL_OP_P use.
163 * pt.c (push_template_decl_real): Likewise.
164 * typeck.c (check_return_expr): Use IDENTIFIER_NEW_OP_P.
167 * decl.c (grokdeclarator): Don't warn when parens protect a return
168 type from a qualified name.
170 2017-11-01 Nathan Sidwell <nathan@acm.org>
172 * cp-tree.h (enum cp_identifier_kind): Delete cik_newdel_op.
173 Renumber and reserve udlit value.
174 (IDENTIFIER_NEWDEL_OP_P): Delete.
175 (IDENTIFIER_OVL_OP_P): New.
176 (IDENTIFIER_ASSIGN_OP_P): Adjust.
177 (IDENTIFIER_CONV_OP_P): Adjust.
178 (IDENTIFIER_OVL_OP_INFO): Adjust.
179 (IDENTIFIER_OVL_OP_FLAGS): New.
180 * decl.c (grokdeclarator): Use IDENTIFIER_OVL_OP_FLAGS.
181 * lex.c (get_identifier_kind_name): Adjust.
182 (init_operators): Don't special case new/delete ops.
183 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_P.
184 * pt.c (push_template_decl_real): Use IDENTIFIER_OVL_OP_FLAGS.
185 * typeck.c (check_return_expr): Likewise.
187 * cp-tree.h (assign_op_identifier, call_op_identifier): Use
189 (struct lang_decl_fn): Use compressed operator code.
190 (DECL_OVERLOADED_OPERATOR_CODE): Replace with ...
191 (DECL_OVERLOADED_OPERATOR_CODE_RAW): ... this.
192 (DECL_OVERLOADED_OPERATOR_CODE_IS): Use it.
193 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE_RAW.
194 (build_library_fn): Likewise.
195 (grok_op_properties): Likewise.
196 * mangle.c (write_unqualified_name): Likewise.
197 * method.c (implicitly_declare_fn): Likewise.
198 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_IS.
200 * cp-tree.h (IDENTIFIER_CP_INDEX): Define.
201 (enum ovl_op_flags): Add OVL_OP_FLAG_AMBIARY.
202 (enum ovl_op_code): New.
203 (struct ovl_op_info): Add ovl_op_code field.
204 (ovl_op_info): Size by OVL_OP_MAX.
205 (ovl_op_mapping, ovl_op_alternate): Declare.
206 (OVL_OP_INFO): Adjust for mapping array.
207 (IDENTIFIER_OVL_OP_INFO): New.
208 * decl.c (ambi_op_p, unary_op_p): Delete.
209 (grok_op_properties): Use IDENTIFIER_OVL_OP_INFO and
211 * lex.c (ovl_op_info): Adjust and static initialize.
212 (ovl_op_mappings, ovl_op_alternate): Define.
213 (init_operators): Iterate over ovl_op_info array and init mappings
215 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO.
216 * operators.def (DEF_OPERATOR): Remove KIND parm.
217 (DEF_SIMPLE_OPERATOR): Delete.
218 (OPERATOR_TRANSITION): Expand if defined.
220 2017-10-31 David Malcolm <dmalcolm@redhat.com>
222 * pt.c (listify): Use %< and %> for description of #include.
224 2017-10-31 David Malcolm <dmalcolm@redhat.com>
226 * class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
228 * name-lookup.c (suggest_alternatives_for): Update for renaming of
230 (maybe_suggest_missing_header): Likewise.
231 (suggest_alternative_in_explicit_scope): Likewise.
232 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
233 renaming of error_at_rich_loc.
234 (cp_parser_string_literal): Likewise.
235 (cp_parser_nested_name_specifier_opt): Likewise.
236 (cp_parser_cast_expression): Likewise for renaming of
238 (cp_parser_decl_specifier_seq): Likewise for renaming of
239 error_at_rich_loc and warning_at_rich_loc.
240 (cp_parser_elaborated_type_specifier): Likewise for renaming of
242 (cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
244 (cp_parser_virt_specifier_seq_opt): Likewise.
245 (cp_parser_class_specifier_1): Likewise.
246 (cp_parser_class_head): Likewise.
247 (cp_parser_member_declaration): Likewise for renaming of
248 pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
249 (cp_parser_enclosed_template_argument_list): Likewise for renaming
250 of error_at_rich_loc.
251 (set_and_check_decl_spec_loc): Likewise.
252 * pt.c (listify): Likewise.
253 * rtti.c (typeid_ok_p): Likewise.
254 * semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
256 * typeck.c (access_failure_info::maybe_suggest_accessor): Update
257 for renaming of inform_at_rich_loc.
258 (finish_class_member_access_expr): Likewise for renaming of
261 2017-10-31 Nathan Sidwell <nathan@acm.org>
263 * cp-tree.h (struct operator_name_info_t): Rename to ...
264 (struct ovl_op_info_t): ... here. Add tree_code field.
265 (operator_name_info, assignment_operator_name_info): Delete.
266 (ovl_op_info): Declare.
267 (OVL_OP_INFO): Adjust.
268 * decl.c (grok_op_properties): Use ovl_op_flags.
269 * lex.c (operator_name_info, assignment_operator_name_info):
271 (ovl_op_info): Define.
272 (set_operator_ident): Adjust.
273 (init_operators): Set tree_code.
274 * mangle.c (write_unqualified_id): Adjust operator array scan.
276 * lex.c (init_operators): Allow NULL operator name. Don't add
278 * operators.def: Use NULL for mangling only operators. Move to
279 after regular operators but move assignment operators last.
281 * cp-tree.h (enum ovl_op_flags): New.
282 (struct operator_name_info_t): Rename arity to flags.
283 * lex.c (set_operator_ident): New.
284 (init_operators): Use it. Adjust for flags.
285 * mangle.c (write_unqualified_id): Adjust for flags.
286 * operators.def: Replace arity with flags.
288 * cp-tree.h (ovl_op_identifier): New.
289 (assign_op_identifier, call_op_identifier): Adjust.
290 (cp_operator_id, cp_assignment_operator_ide): Delete.
291 (SET_OVERLOADED_OPERATOR_CODE): Delete.
293 * call.c (op_error): Use OVL_OP_INFO.
294 (build_conditional_expr_1): Use ovl_op_identifier.
295 (build_new_op_1): Use OVL_OP_INFO & ovl_op_identifier.
296 (build_op_delete_call): Likewise.
297 * class.c (type_requires_array_cookie): Use ovl_op_identifier.
298 * decl.c (duplicate_decls): Directly copy operator code.
299 (builtin_function_1): Do not set operator code.
300 (build_library_fn): Directly set operator code.
301 (push_cp_library_fn): Use ovl_op_identifier.
302 (grok_op_properties): Directly set operator code.
303 * decl2.c (maybe_warn_sized_delete): Use ovl_op_identifier.
304 * error.c (dump_expr): Use OVL_OP_INFO.
305 (op_to_string): Add assop arg. Use OVL_OP_INFO.
306 (assop_to_string): Delete.
307 (args_to_string): Adjust.
308 * init.c (build_new_1): Use ovl_op_identifier.
309 * mangle.c (write_unqualified_name): Use OVL_OP_INFO.
310 (write_expression): Likewise.
311 * method.c (synthesized_method_walk): Use ovl_op_identifier.
312 (implicitly_declare_fn): Use assign_op_identifier. Directly set
314 * name-lookup.c (get_class_binding): Use assign_op_identifier.
315 * parser.c (cp_parser_operator): Use ovl_op_identifier.
316 (cp_parser_omp_clause_reduction): Likewise.
317 * semantics.c (omp_reduction_id): Likewise.
318 * typeck.c (cxx_sizeof_or_alignof_type): Use OVL_OP_INFO.
320 * cp-tree.h (assign_op_identifier, call_op_identifier): Define.
321 (LAMBDA_FUNCTION_P): Use DECL_OVERLOADED_OPERATOR_IS.
322 (DECL_OVERLOADED_OPERATOR_P): Just retuurn true/false.
323 (DECL_OVERLOADED_OPERATOR_CODE, DECL_OVERLOADED_OPERATOR_IS): Define.
324 * call.c (add_function_candidate): Use
325 DECL_OVERLOADED_OPERATOR_IS.
326 (build_op_call_1): Use call_op_identifier &
327 DECL_OVERLOADED_OPERATOR_IS.
328 (build_over_call): Likewise.
329 (has_trivial_copy_assign_p): Use assign_op_identifier.
330 (build_special_member_call): Likewise.
331 * class.c (dfs_declare_virt_assop_and_dtor): Likewise.
332 (vbase_has_user_provided_move_assign,
333 classtype_has_move_assign_or_move_ctor_p): Likewise.
334 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE.
335 (grok_special_member_properties): Use assign_op_identifier.
336 (start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS.
337 * decl2.c (mark_used): Use DECL_CONV_FN_P.
338 * dump.c (dump_access): Delete prototype.
340 (cp_dump_tree): Don't call it.
341 * lambda.c (lambda_function): Use call_op_identifier.
342 (maybe_add_lambda_conv_op): Not an overloaded operator. Remove
344 * mangle.c (write_unqualified_name): Use DECL_OVERLOADED_OPERTOR_CODE.
345 * method.c (do_build_copy_assign): Use assign_op_identifier.
346 (synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS.
347 (get_copy_assign): Use assign_op_identifier.
348 (synthesized_method_walk): Likewise.
349 (defaultable_fn_check): Use DECL_OVERLOADED_OPERATOR_IS.
350 * parser.c (cp_parser_lambda_declarator_opt): Use
352 * semanitics.c (classtype_has_nothrow_assign_or_copy_p): Use
353 assign_op_identifier.
354 * tree.c (special_function_p): Use DECL_OVERLOADED_OPERATOR_IS.
355 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_CODE.
356 (check_return_expr): Use assign_op_identifier.
358 2017-10-30 Paolo Carlini <paolo.carlini@oracle.com>
361 * pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
362 unconditionally call convert_from_reference.
364 2017-10-30 Nathan Sidwell <nathan@acm.org>
366 * call.c (build_op_call_1): Test for FUNCTION_DECL in same manner
367 as a few lines earlier.
368 * cp-tree.h (PACK_EXPANSION_PATTERN): Fix white space.
369 * decl.c (grokfndecl): Fix indentation.
370 (compute_array_index_type): Use processing_template_decl_sentinel.
371 (grok_op_properties): Move warnings to end. Reorder other checks
372 to group similar entities. Tweak diagnostics.
373 * lex.c (unqualified_name_lookup_error): No need to check name is
374 not ERROR_MARK operator.
375 * parser.c (cp_parser_operator): Select operator code before
377 * typeck.c (check_return_expr): Fix indentation and line wrapping.
379 2017-10-27 Paolo Carlini <paolo.carlini@oracle.com>
381 * pt.c (invalid_nontype_parm_type_p): Return a bool instead of an int.
383 2017-10-26 Nathan Sidwell <nathan@acm.org>
385 * decl.c (sort_labels): Restore function.
386 (pop_labels): Sort labels
387 (identify_goto): Add translation markup.
389 2017-10-25 Nathan Sidwell <nathan@acm.org>
391 Kill IDENTIFIER_LABEL_VALUE.
392 * cp-tree.h (lang_identifier): Delete label_value slot.
393 (IDENTIFIER_LABEL_VALUE, SET_IDENTIFIER_LABEL_VALUE): Delete.
394 (struct named_label_hasher): Rename to ...
395 (struct named_label_hash): ... here. Reimplement.
396 (struct language_function): Adjust x_named_labels.
397 * name-lookup.h (struct cp_label_binding): Delete.
398 (struct cp_binding_level): Delete shadowed_labels slot.
399 * decl.c (struct named_label_entry): Add name and outer slots.
400 (pop_label): Rename to ...
401 (check_label_used): ... here. Don't pop.
402 (note_label, sort_labels): Delete.
403 (pop_labels, pop_local_label): Reimplement.
404 (poplevel): Pop local labels as any other decl. Remove
405 shadowed_labels handling.
406 (named_label_hash::hash, named_label_hash::equal): New.
407 (make_label_decl): Absorb into ...
408 (lookup_label_1): ... here. Add making_local_p arg, reimplement.
409 (lookup_label, declare_local_label): Adjust.
410 (check_goto, define_label): Adjust.
411 * lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE.
412 * ptree.c (cxx_print_identifier): Don't print identifier binding.
414 * decl.c (identifier_goto): Reduce duplication.
415 (check_previous_goto_1): Likewise.
416 (check_goto): Move var decls to initialization.
417 (check_omp_return, define_label_1, define_label): Likewise.
419 2017-10-25 Jakub Jelinek <jakub@redhat.com>
422 * decl.c (duplicate_decls): Copy "omp declare simd" attributes from
423 newdecl to corresponding __builtin_ if any.
425 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
428 * decl.c (duplicate_decls): Warn for built-in functions declared as
429 non-function, use OPT_Wbuiltin_declaration_mismatch.
431 * decl.c (duplicate_decls): Avoid redundant '+' in warning_at.
433 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
436 * pt.c (value_dependent_expression_p, [TRAIT_EXPR]): Handle
437 a TREE_LIST as TRAIT_EXPR_TYPE2.
439 2017-10-24 Mukesh Kapoor <mukesh.kapoor@oracle.com>
440 Paolo Carlini <paolo.carlini@oracle.com>
443 * cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped
444 enumeration type whose underlying type is fixed.
446 2017-10-23 Paolo Carlini <paolo.carlini@oracle.com>
449 * semantics.c (finish_compound_literal): Check do_auto_deduction
450 return value for error_mark_node.
452 2017-10-23 Jason Merrill <jason@redhat.com>
454 PR c++/77369 - wrong noexcept handling in C++14 and below
455 * tree.c (strip_typedefs): Canonicalize TYPE_RAISES_EXCEPTIONS.
457 2017-10-20 Nathan Sidwell <nathan@acm.org>
459 * class.c (layout_class_type): Cleanup as-base creation, determine
461 (finish_struct_1): ... not here.
463 2017-10-19 Jakub Jelinek <jakub@redhat.com>
466 * typeck.c (check_return_expr): Don't call
467 maybe_warn_about_returning_address_of_local in templates.
469 2017-10-17 Nathan Sidwell <nathan@acm.org>
472 * call.c (build_over_call): Don't pass tf_no_cleanup to nested
476 * cp-objcp-common.c (cp_tree_size): Reformat. Adjust returns size
479 2017-10-13 Jason Merrill <jason@redhat.com>
481 PR c++/82357 - bit-field in template
482 * tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.
484 2017-10-13 David Malcolm <dmalcolm@redhat.com>
486 * cp-tree.h (maybe_show_extern_c_location): New decl.
487 * decl.c (grokfndecl): When complaining about literal operators
488 with C linkage, issue a note giving the location of the
490 * parser.c (cp_parser_new): Initialize new field
491 "innermost_linkage_specification_location".
492 (cp_parser_linkage_specification): Store the location
493 of the linkage specification within the cp_parser.
494 (cp_parser_explicit_specialization): When complaining about
495 template specializations with C linkage, issue a note giving the
496 location of the extern "C".
497 (cp_parser_explicit_template_declaration): Likewise for templates.
498 (maybe_show_extern_c_location): New function.
499 * parser.h (struct cp_parser): New field
500 "innermost_linkage_specification_location".
502 2017-10-12 Nathan Sidwell <nathan@acm.org>
504 * cp-tree.h (cp_expr): Add const operator * and operator->
506 (cp_tree_node_structure_enum): Delete TS_CP_BINDING,
507 TS_CP_WRAPPER, LAST_TS_CP_ENUM.
509 2017-10-12 David Malcolm <dmalcolm@redhat.com>
511 * parser.c (get_required_cpp_ttype): New function.
512 (cp_parser_error_1): Call it, using the result to call
513 maybe_suggest_missing_token_insertion.
515 2017-10-12 David Malcolm <dmalcolm@redhat.com>
517 * parser.c (get_matching_symbol): Move to before...
518 (cp_parser_error): Split out into...
519 (cp_parser_error_1): ...this new function, merging in content
521 (cp_parser_required_error): ...here. Eliminate partial duplicate
522 of body of cp_parser_error in favor of a call to the new
523 cp_parser_error_1 helper function.
525 2017-10-11 Nathan Sidwell <nathan@acm.org>
527 * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
528 (record_mangling): Likewise.
530 2017-10-10 Nathan Sidwell <nathan@acm.org>
532 * name-lookup.c (extern_c_fns): Rename to ...
533 (extern_c_decls): ... here.
534 (check_extern_c_conflict, extern_c_linkage_bindings): Update.
535 (do_pushdecl): Check extern-c fns and vars.
537 * cp-tree.h (default_hash_traits <lang_identifier *>): Delete
540 * decl2.c (struct mangled_decl_hash): New hash traits.
541 (mangled_decls): Make hash_table<mangled_decl_hash>.
542 (generate_mangling_alias, record_mangling): Adjust.
544 2017-10-10 Jason Merrill <jason@redhat.com>
546 More delayed lambda capture fixes.
547 * call.c (add_function_candidate): Use build_address.
548 (build_op_call_1): Call mark_lvalue_use early.
549 (build_over_call): Handle error from build_this.
550 * constexpr.c (cxx_bind_parameters_in_call): Use build_address.
551 (cxx_eval_increment_expression): Don't use rvalue().
552 * cvt.c (convert_to_void): Use mark_discarded_use.
553 * expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR. Fix
554 reference handling. Don't copy the expression.
555 (mark_discarded_use): New.
556 * lambda.c (insert_capture_proxy): Add some sanity checking.
557 (maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
558 * pt.c (register_local_specialization): Add sanity check.
559 * semantics.c (process_outer_var_ref): Fix check for existing proxy.
560 * typeck.c (cp_build_addr_expr_1): Handle error from
562 (cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
565 Handle generic lambda capture in dependent expressions.
566 * lambda.c (need_generic_capture, dependent_capture_r)
567 (do_dependent_capture): New.
568 * pt.c (processing_nonlambda_template): Use need_generic_capture.
569 * semantics.c (maybe_cleanup_point_expr)
570 (maybe_cleanup_point_expr_void, finish_goto_stmt)
571 (maybe_convert_cond): Call do_dependent_capture.
572 * typeck.c (build_static_cast): Remove dependent capture handling.
574 * typeck.c (condition_conversion): Assert !processing_template_decl.
575 * semantics.c (finish_omp_clauses): Don't
576 fold_build_cleanup_point_expr if processing_template_decl.
577 (outer_var_p): A temporary can't be from an outer scope.
578 * pt.c (type_dependent_expression_p): Fix dependency checking of
579 functions without DECL_TEMPLATE_INFO.
580 (instantiate_decl): Use lss_copy.
581 * constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
583 * typeck.c (check_return_expr): Check non-dependent conversion in
585 * constraint.cc (check_function_concept): Don't complain about an
586 empty concept if seen_error.
588 2017-10-10 Richard Sandiford <richard.sandiford@linaro.org>
590 * cvt.c (ignore_overflows): Use wi::to_wide when
591 operating on trees as wide_ints.
592 * decl.c (check_array_designated_initializer): Likewise.
593 * mangle.c (write_integer_cst): Likewise.
594 * semantics.c (cp_finish_omp_clause_depend_sink): Likewise.
596 2017-10-10 Nathan Sidwell <nathan@acm.org>
598 * name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
600 2017-10-06 Paolo Carlini <paolo.carlini@oracle.com>
603 * decl.c (finish_function): Take a bool intead of an int; adjust.
604 * cp-tree.h (finish_function): Adjust declaration.
605 * decl2.c (generate_tls_wrapper, finish_objects,
606 finish_static_storage_duration_function): Adjust calls.
607 * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
609 * method.c (synthesize_method): Likewise.
610 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
611 * pt.c (instantiate_decl): Likewise.
612 * parser.c (cp_parser_function_definition_after_declarator,
613 cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
615 (cp_parser_ctor_initializer_opt,
616 cp_parser_ctor_initializer_opt_and_function_body,
617 cp_parser_function_try_block,
618 cp_parser_function_definition_after_declarator,
619 cp_parser_function_transaction): Return void; adjust declarations.
621 2017-10-06 Nathan Sidwell <nathan@acm.org>
624 * name-lookup.c (check_local_shadow): Don't try and convert
627 2017-10-06 Jakub Jelinek <jakub@redhat.com>
630 * decl.c (reshape_init): Suppress warn_useless_cast for direct enum
632 * typeck.c (convert_for_assignment): Likewise.
634 P0704R1 - fixing const-qualified pointers to members
635 * typeck2.c (build_m_component_ref): For -std=c++2a allow
636 pointer to const & qualified method on rvalue.
638 2017-10-06 Nathan Sidwell <nathan@acm.org>
640 Use hash_table for extern "C" names
641 * name-lookup.c (extern_c_fns): Use hash_table.
642 (check_extern_c_conflict): Adjust.
643 (c_linkage_bindings): Adjust.
645 Use hash_table for namespace bindings
646 * cp-tree.h (struct named_decl_hash): New.
647 (lang_decl_ns): Change type of bindings field.
648 * lex.c (maybe_add_lang_decl_raw): Adjust.
649 * name-lookup.c (find_namespace_slot): Adjust.
650 (do_pushdecl): Push NULL-named namespace.
651 (do_push_nested_namespace): Adjust.
652 (push_namespace): Push anonymous namespace as NULL name.
654 2017-10-05 Jason Merrill <jason@redhat.com>
656 Pass variadic class objects exactly like named by-value args.
657 * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
659 2017-10-05 Nathan Sidwell <nathan@acm.org>
661 Warn on MVP declarations
662 * cp-tree.h (struct cp_declarator): Add parenthesized field.
663 * decl.c (grokdeclarator): Warn about unnecessary parens.
664 * parser.c (make_declarator): Init parenthesized field.
665 (cp_parser_direct_declarator): Set parenthesized field.
667 Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE
668 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
669 SET_IDENTIFIER_GLOBAL_VALUE): Delete.
670 * name-lookup.h (set_global_binding): Remove NAME parm.
671 (get_global_binding): New inline fn.
672 * name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
673 (identifier_global_value): Move to ...
674 * cp-objcp-common.c (identifier_global_value): ... here.
675 * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
676 * decl.c (record_builtin_type, expand_static_init,
677 grokdeclarator): Adjust.
678 * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
679 get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
680 * except.c (declare_library_fn, build_throw): Adjust.
681 * init.c (throw_bad_array_length): Adjust.
682 * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.
684 * decl2.c (record_mangling): Fix spello and formatting from
687 2017-10-04 Nathan Sidwell <nathan@acm.org>
689 Give builtin types the correct name.
690 * name-lookup.c (set_global_binding): Assert name is DECL_NAME.
691 * decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for
694 2017-10-04 Paolo Carlini <paolo.carlini@oracle.com>
695 Andrew Pinski <apinski@cavium.com>
698 * parser.c (cp_parser_lambda_body): Set parser->in_function_body.
700 2017-10-04 Nathan Sidwell <nathan@acm.org>
702 Move mangling aliases out of global namespace.
703 * cp-tree.h (record_mangling): New.
704 (maybe_remove_implicit_alias): Delete.
705 * decl2.c (mangled_decls): New hash map.
706 (generate_mangling_alias): Reimplement using mangled_decls.
707 (record_mangling): New.
708 * mangle.c (decl_implicit_alias_p,
709 maybe_remove_implicit_alias): Delete.
710 (mangle_decl): Use record_mangling.
711 * name-lookup.c (supplement_binding_1): Remove
712 maybe_remove_implicit_alias check.
714 2017-10-04 Jakub Jelinek <jakub@redhat.com>
717 * error.c (dump_function_decl): If show_return, call dump_type_suffix
718 on the same return type dump_type_prefix has been called on.
720 2017-10-04 Jason Merrill <jason@redhat.com>
722 PR c++/81525 - broken handling of auto in generic lambda.
723 * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
725 2017-10-04 Nathan Sidwell <nathan@acm.org>
727 * call.c (convert_arg_to_ellipsis): Correct comment about passing
730 2017-10-02 Richard Sandiford <richard.sandiford@linaro.org>
732 * constexpr.c (cxx_eval_store_expression): Use wi::to_widest
733 when comparing the array bounds with an ARRAY_REF index.
735 2017-09-30 Paolo Carlini <paolo.carlini@oracle.com>
738 * method.c (defaulted_late_check): Early return if the defaulted
739 declaration does not match the expected signature.
741 2017-09-29 Jakub Jelinek <jakub@redhat.com>
743 P0683R1 - default member initializers for bit-fields
744 * cp-tree.h (grokbitfield): Add INIT parameter.
745 * parser.c (cp_parser_constant_expression): Add STRICT_P argument,
746 if true, parse a conditional-expression rather than
747 assignment-expression.
748 (cp_parser_member_declaration): For C++11 and later pass true
749 as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield
750 NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for
752 (cp_parser_objc_class_ivars): Adjust grokbitfield caller.
753 * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
754 (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
755 * decl2.c (grokbitfield): Add INIT parameter, pass it to
757 * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
760 * class.c (check_bitfield_decl): Retrieve and clear width from
761 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
762 (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
764 (remove_zero_width_bit_fields): Adjust comment.
765 * decl2.c (grokbitfield): Stash width into
766 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
767 * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr
768 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width.
770 * parser.c (cp_parser_member_declaration): Parse attributes before
771 colon of a bitfield in addition to after colon.
773 * Make-lang.in (check-c++-all): Test also c++2a.
775 2017-09-28 Jason Merrill <jason@redhat.com>
777 PR c++/56973, DR 696 - capture constant variables only as needed.
778 * expr.c (mark_use): Split out from mark_rvalue_use and
779 mark_lvalue_use. Handle lambda capture of constant variables.
780 (mark_lvalue_use_nonread): New.
781 * semantics.c (process_outer_var_ref): Don't capture a constant
782 variable until forced.
783 * pt.c (processing_nonlambda_template): New.
784 * call.c (build_this): Check it.
785 * decl2.c (grok_array_decl): Call mark_rvalue_use and
786 mark_lvalue_use_nonread.
787 * init.c (constant_value_1): Don't call mark_rvalue_use.
788 * typeck.c (build_static_cast): Handle lambda capture.
790 Use local_specializations to find capture proxies.
791 * cp-tree.h (DECL_CAPTURED_VARIABLE): New.
792 * lambda.c (build_capture_proxy): Set it.
793 (add_capture): Pass initializer to build_capture_proxy.
794 (start_lambda_function): Likewise.
795 (insert_capture_proxy): Use register_local_specialization.
796 (is_lambda_ignored_entity): Always ignore proxies.
797 * name-lookup.c (qualify_lookup): Don't check
798 is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
799 * semantics.c (process_outer_var_ref): Use
800 retrieve_local_specialization.
801 * parser.c (cp_parser_lambda_body): Push local_specializations.
802 * pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
803 (tsubst_lambda_expr): Push local_specializations sooner.
804 (tsubst_copy_and_build): Don't register_local_specialization.
806 * call.c (build_special_member_call): Use the return value of
808 * decl.c (compute_array_index_type): Likewise.
809 * parser.c (cp_parser_oacc_wait_list): Likewise.
810 * lambda.c (is_normal_capture_proxy): Handle *this capture.
811 (add_capture): Clarify internal_error message.
813 2017-09-22 Eric Botcazou <ebotcazou@adacore.com>
816 * cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
818 2017-09-22 Jakub Jelinek <jakub@redhat.com>
821 * tree.c (struct replace_placeholders_t): Add pset field.
822 (replace_placeholders_r): Call cp_walk_tree with d->pset as
823 last argument instead of NULL. Formatting fix.
824 (replace_placeholders): Add pset variable, add its address
825 into data. Pass &pset instead of NULL to cp_walk_tree.
827 2017-09-22 David Malcolm <dmalcolm@redhat.com>
829 * call.c (get_fndecl_argument_location): New function.
830 (convert_like_real): Use it when complaining about argument type
832 * cp-tree.h (struct cp_parameter_declarator): Add "loc" field.
833 * parser.c (make_parameter_declarator): Add "loc" param and use
834 it to initialize the new field.
835 (cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of
836 the "no_parameters" parameter.
837 (cp_parser_parameter_declaration_list): Set the location of the
838 result of grokdeclarator to be the parameter's loc, assuming no
840 (cp_parser_parameter_declaration): Generate a location for the
841 parameter and pass to make_parameter_declarator.
843 2017-09-20 Nathan Sidwell <nathan@acm.org>
845 * name-lookup.c (member_name_cmp): Use DECL_UID for final
848 2017-09-20 Jakub Jelinek <jakub@redhat.com>
850 P0409R2 - allow lambda capture [=, this]
851 * parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on
854 2017-09-18 Jason Merrill <jason@redhat.com>
856 PR c++/82069 - ICE with lambda in template
857 * semantics.c (process_outer_var_ref): Check uses_template_parms
858 instead of any_dependent_template_arguments_p.
860 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
861 Paolo Carlini <paolo.carlini@oracle.com>
864 * decl2.c (finish_anon_union): Complain about "anonymous union with
865 no members" with a pedwarn.
867 2017-09-15 Bernd Edlinger <bernd.edlinger@hotmail.de>
869 * typeck.c (build_reinterpret_cast_1,
870 build_const_cast_1): Implement -Wcast-align=strict.
872 2017-09-15 Jakub Jelinek <jakub@redhat.com>
874 * decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
875 adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
876 to C++17 or -std=gnu++17 or -std=c++17. Adjust comments.
877 (cxx_init_decl_processing, next_initializable_field,
878 is_direct_enum_init, check_initializer, cp_finish_decl,
879 mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
880 finish_function): Likewise.
881 * cp-tree.h (DECL_INLINE_VAR_P): Likewise.
882 * pt.c (mark_template_parm, convert_nontype_argument,
883 instantiate_class_template_1, type_unification_real, unify,
884 get_partial_spec_bindings, dependent_type_p_r): Likewise.
885 * typeck.c (cp_build_unary_op): Likewise.
886 * constexpr.c (var_in_maybe_constexpr_fn): Likewise.
887 * call.c (build_user_type_conversion_1, build_over_call,
888 build_special_member_call): Likewise.
889 * lambda.c (begin_lambda_type): Likewise.
890 * typeck2.c (process_init_constructor_record): Likewise.
891 * class.c (build_base_field, finalize_literal_type_property,
892 explain_non_literal_class): Likewise.
893 * parser.c (cp_parser_diagnose_invalid_type_name,
894 cp_parser_primary_expression, cp_parser_lambda_introducer,
895 cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
896 cp_convert_range_for, cp_parser_perform_range_for_lookup,
897 cp_parser_decomposition_declaration, cp_parser_linkage_specification,
898 cp_parser_static_assert, cp_parser_simple_type_specifier,
899 cp_parser_namespace_definition, cp_parser_using_declaration,
900 cp_parser_init_declarator, cp_parser_type_parameter_key,
901 cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
902 cp_parser_constructor_declarator_p): Likewise.
903 * mangle.c (struct globals): Rename need_cxx1z_warning to
905 (write_exception_spec, start_mangling, mangle_decl): Likewise.
906 * Make-lang.in (check-c++1z): Rename to check-c++17, depend on
908 (check-c++17): New goal. Use 17 instead of 1z.
909 (check-c++-all): Use 17 instead of 1z.
911 2017-09-14 Jakub Jelinek <jakub@redhat.com>
914 * cp-gimplify.c (omp_var_to_track): Look through references.
915 (omp_cxx_notice_variable): Likewise.
917 2017-09-13 Nathan Sidwell <nathan@acm.org>
919 Conv-op identifers not in identifier hash table
920 * lex.c (conv_type_hasher): Make member fns inline.
921 (make_conv_op_name): Directly clone conv_op_identifier.
923 Rename CLASSTYPE_METHOD_VEC to CLASSTYPE_MEMBER_VEC.
924 * cp-tree.h (struct lang_type): Rename methods to members.
925 (CLASSTYPE_METHOD_VEC): Rename to ...
926 (CLASSTYPE_MEMBER_VEC): ... this.
927 * name-lookup.h (get_method_slot): Rename to ...
928 (get_member_slot): ... this.
929 (resort_type_method_vec): Rename to ...
930 (resort_type_member_vec): ... this.
931 * class.c (add_method, warn_hidden): Adjust.
932 * search.c (dfs_locate_field_accessor_pre): Adjust.
933 * name-lookup.c (method_vec_binary_search): Rename to ...
934 (member_vec_binary_search): ... this and adjust.
935 (method_vec_linear_search): Rename to ...
936 (member_vec_linear_search): ... this and adjust.
937 (fields_linear_search, get_class_binding_direct): Adjust.
938 (get_method_slot): Rename to ...
939 (get_member_slot): ... this and adjust.
940 (method_name_slot): Rename to ...
941 (member_name_slot): ... this and adjust.
942 (resort_type_method_vec): Rename to ...
943 (resort_type_member_vec): ... this and adjust.
944 (method_vec_append_class_fields): Rename to ...
945 (member_vec_append_class_fields): ... this and adjust.
946 (method_vec_append_enum_values): Rename to ...
947 (member_vec_append_enum_values): ... this and adjust.
948 (method_vec_dedup): Rename to ...
949 (member_vec_dedup): ... this and adjust.
950 (set_class_bindings, insert_late_enum_def_bindings): Adjust.
952 2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
955 * decl.c (start_decl): Early return error_mark_node if duplicate_decls
956 returns it; avoid misleading error message.
958 2017-09-12 Nathan Sidwell <nathan@acm.org>
960 Kill CLASSTYPE_SORTED_FIELDS.
961 * cp-tree.h (struct lang_type): Lose sorted_fields member.
962 (CLASSTYPE_SORTED_FIELDS): Delete.
963 * name-lookup.h (set_class_bindings): Add EXTRA arg.
964 * name-lookup.c (fields_linear_search): New, broken out of ...
965 (lookup_field_1): ... here. Delete remainder of function.
966 (get_class_binding_direct): Reimplement without sorted_fields.
967 (get_class_binding): Rename TYPE arg to KLASS, for consistency.
968 (get_method_slot): Call set_class_binding when creating method_vec
970 (method_name_cmp): Order identically named slots.
971 (sorted_fields_type_new): Delete.
972 (field_vc_append_class_fields): Rename to ...
973 (method_vec_append_class_fields): ... here. Adjust.
974 (field_vec_append_enum_values): Renme to ...
975 (method_vec_append_enum_values): ... here. Adjust.
976 (method_vec_dedup): New.
977 (set_class_bindings): Reimplement.
978 (insert_late_enum_def_bindings): Reimplement.
980 * name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for
982 (restort_data): Move later.
983 (method_name_cmp, resort_method_name_cmp): Simplify.
984 (resort_type_method_vec): Reformat.
986 2017-09-09 Jason Merrill <jason@redhat.com>
988 * constexpr.c (reduced_constant_expression_p): If
989 CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized.
991 2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
994 * cp-objcp-common.c (struct debug_type_hasher): New class.
995 (debug_type_hash): New variable.
996 (cp_get_debug_type): Associate the OFFSET_TYPEs with the types.
998 2017-09-08 Jason Merrill <jason@redhat.com>
1000 PR c++/70029 - ICE with ref-qualifier and -flto
1001 * tree.c (cxx_copy_lang_qualifiers): New.
1002 * cp-tree.h: Declare it.
1003 * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
1005 2017-09-06 Jason Merrill <jason@redhat.com>
1007 PR c++/82053 - ICE with default argument in lambda in template
1008 * pt.c (tsubst_arg_types): Substitute default arguments for lambdas
1010 (retrieve_specialization): Use lambda_fn_in_template_p.
1011 * cp-tree.h: Declare it.
1013 PR c++/82070 - error with nested lambda capture
1014 * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
1015 register_local_specialization.
1017 2017-09-06 Nathan Sidwell <nathan@acm.org>
1019 * name-lookup.h (lookup_field_1): Delete.
1020 (get_class_binding_direct, get_class_binding): Add type_or_fns arg.
1021 * name-lookup.c (lookup_field_1): make static
1022 (method_vec_binary_search, method_vec_linear_search): New. Broken
1024 (get_class_binding_direct): ... here. Add TYPE_OR_FNS argument.
1025 Do complete search of this level.
1026 (get_class_binding): Adjust.
1027 * decl.c (reshape_init_class): Call get_class_binding.
1028 * search.c (lookup_field_r): Move field searching into
1029 get_class_binding_direct.
1031 * class.c (warn_hidden): Don't barf on non-functions.
1032 * decl2.c (check_classfn): Likewise. Check template match earlier.
1034 * name-lookup.c (count_fields): Rename to ...
1035 (count_class_fields): ... here. Take a class, don't count
1037 (add_fields_to_record_type): Rename to ...
1038 (field_vec_append_class_fields): ... here. Take a class, don't
1039 add NULL-named fields.
1040 (add_enum_fields_to_record_type): Rename to ...
1041 (field_vec_append_enum_values): ... here.
1042 (set_class_bindings): Adjust, assert we added expected number.
1043 (insert_late_enum_def_bindings): Reimplement. Create vector if
1044 there are now sufficient entries.
1046 * name-lookup.h (lookup_fnfields_slot_nolazy,
1047 lookup_fnfields_slot): Rename to ...
1048 (get_class_binding_direct, get_class_binding): ... here.
1049 * name-lookup.c (lookup_fnfields_slot_nolazy,
1050 lookup_fnfields_slot): Rename to ...
1051 (get_class_binding_direct, get_class_binding): ... here.
1052 * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust.
1053 * call.c (build_user_type_conversion_1): Adjust.
1054 (has_trivial_copy_assign_p): Adjust.
1055 (has_trivial_copy_p): Adjust.
1056 * class.c (get_basefndecls) Adjust.
1057 (vbase_has_user_provided_move_assign) Adjust.
1058 (classtype_has_move_assign_or_move_ctor_p): Adjust.
1059 (type_build_ctor_call, type_build_dtor_call): Adjust.
1060 * decl.c (register_dtor_fn): Adjust.
1061 * decl2.c (check_classfn): Adjust.
1062 * pt.c (retrieve_specialization): Adjust.
1063 (check_explicit_specialization): Adjust.
1064 (do_class_deduction): Adjust.
1065 * search.c (lookup_field_r): Adjust.
1066 (look_for_overrides_here, lookup_conversions_r): Adjust.
1067 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust.
1068 * tree.c (type_has_nontrivial_copy_init): Adjust.
1069 * method.c (lazily_declare_fn): Adjust comment.
1071 2017-09-05 Nathan Sidwell <nathan@acm.org>
1073 * name-lookup.c (do_class_using_decl): Elide read-once temps.
1074 Move declarations to initializations.
1076 * class.c (add_method): Move slot search and insertion to ...
1077 * name-lookup.c (get_method_slot): ... this new function.
1078 (lookup_fnfields_slot_nolazy): Cope with NULL slot.
1079 * name-lookup.h (get_method_slot): Declare.
1080 * decl.c (cxx_init_decl_processinng): Give conv_op_marker a more
1082 (grok_special_member_properties): Set
1083 TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness.
1084 Improve TYPE_HAS_CONSTEXPR_CTOR setting.
1086 * cp-tree.h (lang_decl_base): Rename template_conv_p to
1088 (DECL_CONV_FN_P): Don't check NULL DECL_NAME.
1089 (DECL_CONV_FN_TYPE): FN must be conv op.
1090 (DECL_TEMPLATE_CONV_FN_P): Delete.
1091 (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): Adjust.
1092 * pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P
1095 * class.c (unreverse_member_declarations): Remove extraneous if.
1096 * pt.c (push_template_decl_real): Use string concatenation, not
1097 \<newline>. Add %<..%>.
1099 2017-09-05 Paolo Carlini <paolo.carlini@oracle.com>
1102 * cp-tree.h (LABEL_DECL_CDTOR): Add and document.
1103 * decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
1104 creating cdtor_label.
1105 * constexpr.c (returns): Add the case of a constructor/destructor
1106 returning via a LABEL_DECL_CDTOR label.
1107 (cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
1109 2017-09-01 Nathan Sidwell <nathan@acm.org>
1111 * cp-tree.h (resort_type_method_vec): Move declaration to ...
1112 * name-lookup.h (resort_type_method_vec): ... here.
1113 (set_class_bindings): Lose 2nd arg.
1114 * class.c (finish_struct_1, finish_struct): Adjust
1115 set_class_bindings call. Don't call finish_struct_methods.
1116 (resort_data, method_name_cmp, resort_method_name_cmp,
1117 resort_type_method_vec, finish_struct_methods): Move to ...
1118 * name-lookup.c (resort_data, method_name_cmp,
1119 resort_method_name_cmp, resort_type_method_vec): ... here.
1120 (set_class_bindings): Lose fields arg. Swallow finish_struct_methods.
1122 * class.c (finish_struct): Call set_class_bindings for the
1125 * class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here.
1126 Don't call maybe_warn_about_overly_private_class here.
1127 (warn_hidden): Cleanup declarations and comments.
1128 (type_has_user_provided_constructor): No need to check
1129 CLASSTYPE_METHOD_VEC.
1130 (type_has_user_provided_or_explicit_constructor): Likewise.
1131 (classtype_has_move_assign_or_move_ctor_p): Likewise.
1132 (check_bases_and_members): Don't call finish_struct_methods here.
1133 (finish_struct_1): Call finish_struct_methods and
1134 set_class_bindings immediately after layout. Clear DECL_IN_AGGR_P
1136 (finish_struct): For templates process USING_DECLS and clear
1137 DECL_IN_AGGR_P before calling finish_struct_methods. Call
1138 maybe_warn_about_overly_private_class here.
1140 Revert 2017-08-28 Nathan Sidwell <nathan@acm.org>
1141 Restore sorted_fields vector.
1142 * cp-tree.h (lang_type): Restore sorted_fields vector.
1143 (CLASSTYPE_SORTED_FIELDS): Restore.
1144 (CLASSTYPE_BINDINGS): Delete.
1145 * name-lookup.c (lookup_field_1): Restore binary search.
1146 (sorted_fields_type_new, count_fields,
1147 add_fields_to_record_type, add_enum_fields_to_record_type): Restore
1148 (set_class_bindings): Revert.
1149 (insert_late_enum_def_binding): Restore field_vec insertion.
1151 2017-09-01 Jakub Jelinek <jakub@redhat.com>
1154 * parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.
1156 2017-09-01 Marek Polacek <polacek@redhat.com>
1159 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
1161 2017-08-30 Jason Merrill <jason@redhat.com>
1163 PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
1164 * pt.c (enclosing_instantiation_of, lambda_fn_in_template_p)
1165 (regenerated_lambda_fn_p): New.
1166 (tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of.
1167 (tsubst_copy) [VAR_DECL]: Likewise.
1169 PR c++/82030 - ICE inheriting from multiple lambdas
1171 * call.c (compare_ics): Handle null candidate.
1173 2017-08-30 Ville Voutilainen <ville.voutilainen@gmail.com>
1175 Make taking the address of an overloaded function a non-deduced context
1177 * pt.c (unify_overload_resolution_failure): Remove.
1178 (unify_one_argument): Adjust.
1180 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1181 Alan Hayward <alan.hayward@arm.com>
1182 David Sherwood <david.sherwood@arm.com>
1184 * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE.
1186 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1187 Alan Hayward <alan.hayward@arm.com>
1188 David Sherwood <david.sherwood@arm.com>
1190 * cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE.
1192 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1193 Alan Hayward <alan.hayward@arm.com>
1194 David Sherwood <david.sherwood@arm.com>
1196 * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE
1197 instead of TYPE_MODE.
1199 2017-08-29 Jason Merrill <jason@redhat.com>
1201 PR c++/81236 - ICE with template-id in generic lambda
1202 * semantics.c (finish_id_expression): Remove special dependent case.
1203 Avoid some later pieces when dependent.
1204 (finish_qualified_id_expr): Do normal BASELINK handling in a
1205 template. Always build a SCOPE_REF for a destructor BIT_NOT_EXPR.
1206 (parsing_default_capturing_generic_lambda_in_template): Remove.
1207 * parser.c (cp_parser_postfix_dot_deref_expression): Always give an
1208 error for types that will never be complete.
1209 * mangle.c (write_expression): Add sanity check.
1210 * tree.c (build_qualified_name): Add sanity check.
1211 (cp_walk_subtrees): Walk into the class context of a BASELINK.
1212 * lambda.c (add_capture): Improve diagnostic for generic lambda
1214 * call.c (build_new_method_call_1): Print the right constructor
1217 Reimplement handling of lambdas in templates.
1218 * cp-tree.h (LAMBDA_FUNCTION_P): Check DECL_DECLARES_FUNCTION_P.
1219 * decl.c (start_preparsed_function): Call start_lambda_scope.
1220 (finish_function): Call finish_lambda_scope.
1221 * init.c (get_nsdmi): Call start/finish_lambda_scope.
1222 * lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function.
1223 * parser.c (cp_parser_function_definition_after_declarator): Don't
1224 call start/finish_lambda_scope.
1225 * pt.c (retrieve_specialization): Ignore lambda functions in
1227 (find_parameter_packs_r): Ignore capture proxies. Look into
1229 (check_for_bare_parameter_packs): Allow bare packs in lambdas.
1230 (tsubst_default_argument): Call start/finish_lambda_scope.
1231 (tsubst_function_decl): Handle lambda functions differently.
1232 (tsubst_template_decl): Likewise.
1233 (tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture
1235 (tsubst_lambda_expr): Create a new closure rather than instantiate
1236 the one from the template.
1237 (tsubst_copy_and_build): Don't register a specialization of a pack.
1238 (regenerate_decl_from_template): Call start/finish_lambda_scope.
1239 (instantiate_decl): Remove special lambda function handling.
1240 * semantics.c (process_outer_var_ref): Remove special generic lambda
1241 handling. Don't implicitly capture in a lambda in a template. Look
1242 for an existing proxy.
1243 * class.c (current_nonlambda_class_type): Use decl_type_context.
1245 * cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE.
1246 (LAMBDA_EXPR_RETURN_TYPE): Remove.
1247 (struct tree_lambda_expr): Remove closure and return_type fields.
1248 * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE.
1249 * pt.c (tsubst_copy_and_build): Likewise.
1250 * parser.c (cp_parser_lambda_declarator_opt): Track return type.
1251 (cp_parser_lambda_body): Adjust unspecified return type check.
1252 * ptree.c (cxx_print_lambda_node): Don't print closure or
1255 PR c++/80935 - wrong C++17 error with lambda
1256 * decl.c (check_for_uninitialized_const_var): Check
1257 is_instantiation_of_constexpr.
1258 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
1259 is_instantiation_of_constexpr.
1260 (potential_constant_expression_1): Check var_in_maybe_constexpr_fn.
1262 * lambda.c (build_lambda_object): Check for error_mark_node.
1263 * pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type
1265 (tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters.
1266 (tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node.
1268 PR c++/80767 - unnecessary instantiation of generic lambda
1269 * call.c (convert_like_real): Call build_user_type_conversion_1 if
1271 (add_conv_candidate): Build a ck_user conversion with no candidate.
1273 Fix lambdas in template default argument of inherited ctor.
1274 * method.c (synthesized_method_base_walk): Replace an inherited
1275 template with its specialization.
1276 (synthesized_method_walk): Make inheriting_ctor a pointer.
1277 (maybe_explain_implicit_delete, explain_implicit_non_constexpr)
1278 (deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
1280 * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
1281 template, not the function.
1282 (template_guide_p): Adjust.
1284 Support copying local_specializations.
1285 * cp-tree.h (enum lss_policy): New.
1286 (local_specialization_stack): Add policy parameter to default ctor.
1287 * pt.c (local_specialization_stack): Copy local_specializations if
1290 * constexpr.c (potential_constant_expression_1): Add "now" parm.
1291 (is_constant_expression, require_constant_expression): New.
1292 (is_static_init_expression, is_nondependent_constant_expression)
1293 (is_nondependent_static_init_expression): Drop "potential".
1294 * except.c (build_must_not_throw_expr): Do type conversion on
1295 value-dependent argument.
1296 * pt.c, semantics.c, typeck2.c: Use variants without "potential".
1298 Instantiate default arguments/member initializers once.
1299 * init.c (get_nsdmi): Remember NSDMI instantiations.
1300 * parser.c (inject_this_parameter): Be more picky about
1302 * pt.c (tsubst_copy): Simplify 'this' handling.
1303 (tsubst_default_argument): Remember default argument
1304 instantiations. Take parameter number.
1305 (tsubst_default_arguments): Pass it.
1306 * call.c (convert_default_arg): Likewise.
1308 Fix default argument conversion failure and SFINAE.
1309 * call.c (build_over_call): Check convert_default_arg result for
1311 * parser.c (cp_parser_late_parsing_default_args): Remember
1314 2017-08-28 Nathan Sidwell <nathan@acm.org>
1316 * cp-tree.h (lang_type): Replace sorted_fields vector with
1318 (CLASSTYPE_SORTED_FIELDS): Delete.
1319 (CLASSTYPE_BINDINGS): New.
1320 * decl.c (finish_enum_value_list): Swap args of
1321 insert_late_enum_def_bindings.
1322 * name-lookup.c (lookup_field_1): Replace binary search of sorted
1323 fields with map->get.
1324 (sorted_fields_type_new, count_fields,
1325 add_fields_to_record_type, add_enum_fields_to_record_type): Delete.
1326 (add_class_member, add_class_members): New.
1327 (set_class_bindings): Create map and insert.
1328 (insert_late_enum_def_binding): Swap parms. Use add_clasS_member.
1329 * ptree.c (cxx_print_type): Delete sorted fields printing.
1331 * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
1333 * name-lookup.h (set_class_bindings,
1334 insert_late_enum_def_bindings): Declare.
1335 * decl.c (finish_enum_value_list): Adjust for
1336 insert_late_enum_def_bindings name change.
1337 * class.c (finish_struct_1): Call set_class_bindings.
1338 (count_fields, add_fields_to_record_type,
1339 add_enum_fields_to_record_type, sorted_fields_type_new,
1340 insert_into_classtype_sorted_fields,
1341 insert_late_enum_def_into_classtype_sorted_fields): Move to ...
1342 * name-lookup.h (count_fields, add_fields_to_record_type,
1343 add_enum_fields_to_record_type, sorted_fields_type_new,
1344 set_class_bindings, insert_late_enum_def_bindings): ... here.
1346 2017-08-25 Nathan Sidwell <nathan@acm.org>
1348 * class.c (method_name_cmp, resort_method_name_cmp): Methods
1351 Conversion operators have a special name
1352 * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New.
1353 (conv_op_marker, conv_op_identifier): New.
1354 (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete.
1355 * decl.c (initialize_predefined_identifiers): Add
1357 (cxx_init_decl_processing): Create conv_op_marker.
1358 * decl2.c (check_classfn): Lookup conv-ops by name.
1359 * class.c (add_method): Use conv_op_identifier & conv_op_marker.
1360 (resort_type_method_vec): Don't skip conv-ops.
1361 (finish_struct_methods, warn_hidden): Likewise.
1362 * name-lookup.h (lookup_all_conversions): Delete.
1363 * name-lookup.c (lookup_conversion_operator): Replace with ...
1364 (extract_conversion_operator): ... this.
1365 (lookup_fnfields_slot_nolazy): Find conv-ops by name.
1366 (lookup_all_conversions): Delete.
1367 * pt.c (check_explicit_specialization): Find conv-ops by name.
1368 * search.c (lookup_conversions_r): Likewise.
1370 2017-08-24 Nathan Sidwell <nathan@acm.org>
1372 Conversion operators kept on single overload set
1373 * class.c (add_method): Keep all conv-ops on one slot.
1374 * name-lookup.c (lookup_conversion_operator): Pull the desired
1375 conv op out of overload set.
1376 * search.c (lookup_conversions_r): Lose template/non-template
1378 (lookup_conversions): Likewise.
1380 2017-08-23 Nathan Sidwell <nathan@acm.org>
1382 * cp-tree.h (lookup_field_1, lookup_fnfields_slot,
1383 lookup_fnfields_slot_nolazy, lookup_all_conversions): Move
1385 * name-lookup.h (lookup_field_1, lookup_fnfields_slot,
1386 lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here.
1387 * search.c (lookup_conversion_operator,
1388 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1389 lookup_all_conversions): Move to ...
1390 * name-lookup.c (lookup_conversion_operator,
1391 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1392 lookup_all_conversions): ... here.
1394 * semantics.c (finish_member_declaration): Move USING_DECL check
1395 earlier. Always set C++ linkage. Commonize TYPE_FIELD and
1396 template decl list insertion.
1398 * cp-tree.h (maybe_version_functions): Declare.
1399 * decl.c (decls_match): Break function versioning check to
1400 separate function. Call it.
1401 (maybe_version_functions): Broken out of decls_match.
1402 * class.c (add_method): Use maybe_version_functions.
1404 * cp-tree.h (print_search_statistics,
1405 reinit_search_statistics): Don't declare.
1406 * search.c (n_fields_searched, n_calls_lookup_field,
1407 n_calls_lookup_field_1, n_calls_lookup_fnfields,
1408 n_calls_lookup_fnfields_1, n_calls_get_base_type,
1409 n_outer_fields_searched, n_contexts_saved): Delete.
1410 (lookup_field_1, lookup_member,
1411 lookup_fnfields_slot_nolazy): Remove stat gathering.
1412 (print_search_statistics, reinit_search_statistics): Delete.
1413 * tree.c (cxx_print_statistics): Don't print search stats.
1415 2017-08-21 Nathan Sidwell <nathan@acm.org>
1417 * search.c (lookup_field_r): Remove obsolete code for type-named
1420 * search.c (lookup_field_1): Assert TYPE is a class and VFIELD
1422 (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
1423 (lookup_field_fuzzy_r): Adjust.
1425 2017-08-21 David Malcolm <dmalcolm@redhat.com>
1427 * call.c (build_over_call): Pass NULL for new parameter to
1428 check_function_arguments.
1429 * typeck.c (cp_build_function_call_vec): Likewise.
1431 2017-08-21 Nathan Sidwell <nathan@acm.org>
1434 * pt.c (instantiate_class_template_1):
1435 BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected.
1437 2017-08-18 David Malcolm <dmalcolm@redhat.com>
1440 * name-lookup.c (maybe_suggest_missing_header): Convert return
1441 type from void to bool; return true iff a suggestion was offered.
1442 (suggest_alternative_in_explicit_scope): Move call to
1443 maybe_suggest_missing_header to before use of best_match, and
1444 return true if the former offers a suggestion.
1446 2017-08-18 H.J. Lu <hongjiu.lu@intel.com>
1449 * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN.
1450 * decl2.c (grokbitfield): Don't allow bit-field with
1451 warn_if_not_aligned type.
1453 2017-08-17 Nathan Sidwell <nathan@acm.org>
1455 * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment.
1456 * cp-tree.h (ENUM_TEMPLATE_INFO): Delete.
1457 (TYPE_TEMPLATE_INFO): Simplify.
1458 (SET_TYPE_TEMPLATE_INFO): Simplify.
1460 * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs
1461 don't need lang_type.
1462 (cxx_make_type): Use maybe_add_lang_type_raw return value.
1463 * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on
1466 * cp-tree.h (struct lang_type): Remove template_info field.
1467 (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
1468 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
1470 2017-08-14 Martin Sebor <msebor@redhat.com>
1473 * error.c (cp_printer): Handle 'G'.
1475 2017-08-11 Martin Liska <mliska@suse.cz>
1477 * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
1478 TARGET_SUPPORTS_ALIASES.
1479 (handle_tls_init): Likewise.
1480 (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for
1482 * optimize.c (can_alias_cdtor): Likewise.
1484 2017-08-11 Jason Merrill <jason@redhat.com>
1486 PR c++/81671 - nullptr_t template parameter
1487 * pt.c (convert_nontype_argument): Fix nullptr_t check.
1489 2017-08-10 Jason Merrill <jason@redhat.com>
1491 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1492 * method.c (synthesized_method_walk): Don't diagnose lack of
1495 PR c++/80452 - Core 1579, implicit move semantics on return/throw
1496 * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
1497 tentatively changed the lvalue to an rvalue.
1498 * call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling.
1499 (build_over_call): If LOOKUP_PREFER_RVALUE, check that the first
1500 parameter is an rvalue reference.
1501 * except.c (build_throw): Do maybe-rvalue overload resolution twice.
1502 * typeck.c (check_return_expr): Likewise.
1504 2017-08-10 David Malcolm <dmalcolm@redhat.com>
1506 * parser.c (cp_parser_error): Update for new param to
1508 (class token_pair): New class.
1509 (struct matching_paren_traits): New struct.
1510 (matching_parens): New typedef.
1511 (struct matching_brace_traits): New struct.
1512 (matching_braces): New typedef.
1513 (cp_parser_statement_expr): Convert explicit parsing of
1514 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of
1515 class matching_parens, so that the pertinent open parenthesis is
1516 highlighted when there are problems locating the close
1518 (cp_parser_primary_expression): Likewise.
1519 (cp_parser_compound_literal_p): Remove consumption of opening
1521 (cp_parser_postfix_expression): Convert explicit parsing of
1522 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as
1523 above. Use it to consume the opening paren previously consumed by
1524 cp_parser_compound_literal_p.
1525 (cp_parser_parenthesized_expression_list): Likewise.
1526 (cp_parser_unary_expression): Likewise.
1527 (cp_parser_new_expression): Likewise.
1528 (cp_parser_cast_expression): Likewise.
1529 (cp_parser_builtin_offsetof): Likewise.
1530 (cp_parser_trait_expr): Likewise.
1531 (cp_parser_lambda_declarator_opt): Likewise.
1532 (cp_parser_lambda_body): Likewise, for matching_braces.
1533 (cp_parser_compound_statement): Likewise.
1534 (cp_parser_selection_statement): Likewise, for matching_parens.
1535 (cp_parser_iteration_statement): Likewise.
1536 (cp_parser_already_scoped_statement): Likewise, for
1538 (cp_parser_linkage_specification): Likewise.
1539 (cp_parser_static_assert): Likewise, for matching_parens.
1540 (cp_parser_decltype): Likewise.
1541 (cp_parser_operator): Likewise.
1542 (cp_parser_enum_specifier): Likewise.
1543 (cp_parser_namespace_definition): Likewise.
1544 (cp_parser_direct_declarator): Likewise.
1545 (cp_parser_braced_list): Likewise.
1546 (cp_parser_class_specifier_1): Likewise, for matching_braces.
1547 (cp_parser_constant_initializer): Likewise.
1548 (cp_parser_noexcept_specification_opt): Likewise, for
1550 (cp_parser_exception_specification_opt): Likewise.
1551 (cp_parser_handler): Likewise.
1552 (cp_parser_asm_specification_opt): Likewise.
1553 (cp_parser_asm_operand_list): Likewise.
1554 (cp_parser_gnu_attributes_opt): Likewise.
1555 (cp_parser_std_attribute_spec): Likewise.
1556 (cp_parser_requirement_parameter_list): Likewise.
1557 (cp_parser_requirement_body): Likewise, for matching_braces.
1558 (cp_parser_compound_requirement): Likewise.
1559 (cp_parser_template_introduction): Likewise.
1560 (cp_parser_sizeof_pack): Likewise, for matching_parens.
1561 (cp_parser_sizeof_operand): Likewise; use it to consume the
1562 opening paren previously consumed by cp_parser_compound_literal_p.
1563 (get_matching_symbol): New function.
1564 (cp_parser_required_error): Add param "matching_location". Remove
1565 calls to cp_parser_error, instead setting a non-NULL gmsgid, and
1566 handling it if set by calling c_parse_error, potentially with a
1567 secondary location if matching_location was set.
1568 (cp_parser_require): Add param "matching_location", with a default
1569 value of UNKNOWN_LOCATION.
1570 (cp_parser_require_keyword): Update for new param of
1571 cp_parser_required_error.
1572 (cp_parser_objc_encode_expression): Update to class matching_parens
1574 (cp_parser_objc_defs_expression): Likewise.
1575 (cp_parser_objc_protocol_expression): Likewise.
1576 (cp_parser_objc_selector_expression): Likewise.
1577 (cp_parser_objc_typename): Likewise.
1578 (cp_parser_objc_superclass_or_category): Likewise.
1579 (cp_parser_objc_try_catch_finally_statement): Likewise.
1580 (cp_parser_objc_synchronized_statement): Likewise.
1581 (cp_parser_objc_at_property_declaration): Likewise.
1582 (cp_parser_oacc_single_int_clause): Likewise.
1583 (cp_parser_oacc_shape_clause): Likewise.
1584 (cp_parser_omp_clause_collapse): Likewise.
1585 (cp_parser_omp_clause_default): Likewise.
1586 (cp_parser_omp_clause_final): Likewise.
1587 (cp_parser_omp_clause_if): Likewise.
1588 (cp_parser_omp_clause_num_threads): Likewise.
1589 (cp_parser_omp_clause_num_tasks): Likewise.
1590 (cp_parser_omp_clause_grainsize): Likewise.
1591 (cp_parser_omp_clause_priority): Likewise.
1592 (cp_parser_omp_clause_hint): Likewise.
1593 (cp_parser_omp_clause_defaultmap): Likewise.
1594 (cp_parser_omp_clause_ordered): Likewise.
1595 (cp_parser_omp_clause_schedule): Likewise.
1596 (cp_parser_omp_clause_num_teams): Likewise.
1597 (cp_parser_omp_clause_thread_limit): Likewise.
1598 (cp_parser_omp_clause_aligned): Likewise.
1599 (cp_parser_omp_clause_linear): Likewise.
1600 (cp_parser_omp_clause_safelen): Likewise.
1601 (cp_parser_omp_clause_simdlen): Likewise.
1602 (cp_parser_omp_clause_depend): Likewise.
1603 (cp_parser_omp_clause_device): Likewise.
1604 (cp_parser_omp_clause_dist_schedule): Likewise.
1605 (cp_parser_oacc_clause_async): Likewise.
1606 (cp_parser_omp_critical): Likewise.
1607 (cp_parser_omp_for_loop): Likewise.
1608 (cp_parser_omp_sections_scope): Likewise.
1609 (cp_parser_omp_declare_reduction_exprs): Likewise.
1610 Update for new param to cp_parser_required_error.
1611 (cp_parser_oacc_routine): Likewise.
1612 (cp_parser_transaction_expression): Likewise.
1613 (cp_parser_cilk_simd_vectorlength): Likewise.
1615 2017-08-09 Jason Merrill <jason@redhat.com>
1617 PR c++/81525 - wrong constant value with generic lambda
1618 * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
1619 (tsubst_copy) [VAR_DECL]: Handle auto.
1621 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1622 * init.c (get_nsdmi): Add complain parm.
1623 * typeck2.c (digest_nsdmi_init): Add complain parm.
1624 (process_init_constructor_record): Pass complain to get_nsdmi.
1625 * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool.
1626 * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into
1627 synthesized_method_walk.
1628 (synthesized_method_walk): Adjust.
1629 (walk_field_subobs): Pass complain to get_nsdmi.
1630 (defaulted_late_check): Skip other checks if deleted.
1631 * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept.
1632 * call.c (build_aggr_conv): Pass complain to get_nsdmi.
1633 * parser.c (defarg_location): New.
1634 * error.c (location_of): Use it.
1636 2017-08-09 Marek Polacek <polacek@redhat.com>
1638 * parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0.
1639 * typeck.c (build_binary_op): Change the type of a parameter to bool.
1640 (cp_truthvalue_conversion): Use true instead of 1.
1642 2017-08-08 Marek Polacek <polacek@redhat.com>
1645 * cp-gimplify.c (cp_fold): If folding exposed a branch of
1646 a COND_EXPR, convert it to the original type of the COND_EXPR, if
1649 2017-08-08 Martin Liska <mliska@suse.cz>
1651 * call.c: Include header files.
1652 * cp-gimplify.c: Likewise.
1653 * cp-ubsan.c: Likewise.
1656 * search.c: Likewise.
1657 * semantics.c: Likewise.
1658 * typeck.c: Likewise.
1660 2017-08-07 Martin Liska <mliska@suse.cz>
1662 * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an
1664 (cp_parser_std_attribute): Likewise.
1665 * tree.c: Add new include.
1667 2017-08-04 Paolo Carlini <paolo.carlini@oracle.com>
1670 * pt.c (do_class_deduction): Handle the case of no viable implicit
1671 deduction guides; simplify the code generating implicit deduction
1674 2017-08-03 Paolo Carlini <paolo.carlini@oracle.com>
1677 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
1678 destructor as expressions.
1680 2017-08-02 Jakub Jelinek <jakub@redhat.com>
1683 * call.c (build_user_type_conversion_1): Only call
1684 lookup_fnfields_slot if totype is CLASS_TYPE_P.
1686 2017-07-31 Jason Merrill <jason@redhat.com>
1688 * decl.c (declare_global_var): Set DECL_CONTEXT.
1690 2017-07-31 Jan Hubicka <hubicka@ucw.cz>
1691 Martin Liska <mliska@suse.cz>
1693 * pt.c (tsubst_copy): Copy PREDICT_EXPR.
1694 * semantics.c (finish_goto_stmt): Build gimple predict
1696 * constexpr.c (potential_constant_expression_1): Handle
1699 2017-07-31 Martin Liska <mliska@suse.cz>
1702 * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
1703 also with current_function_decl non-null equality.
1704 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
1705 * decl.c (compute_array_index_type): Likewise.
1706 * init.c (finish_length_check): Likewise.
1707 * typeck.c (cp_build_binary_op): Likewise.
1709 2017-07-29 Jakub Jelinek <jakub@redhat.com>
1711 * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
1712 DW_AT_export_symbols.
1713 * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
1714 argument, pass it through to the debug hook.
1715 (finish_namespace_using_directive): Adjust
1716 emit_debug_info_using_namespace caller.
1717 (push_namespace): Likewise. Call it after setting
1718 DECL_NAMESPACE_INLINE_P.
1719 (cp_emit_debug_info_for_using): Pass false as new argument to
1720 the imported_module_or_decl debug hook.
1722 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
1724 * lex.c (copy_decl): Adjust.
1725 (copy_type): Likewise.
1727 2017-07-26 Paolo Carlini <paolo.carlini@oracle.com>
1730 * lambda.c (add_capture): Early return if we cannot capture by
1733 2017-07-26 Jason Merrill <jason@redhat.com>
1735 P0702R1 - List deduction of vector.
1736 * pt.c (do_class_deduction): Special-case deduction from a single
1737 element of related type.
1739 2017-07-26 Leonid Koppel <lkoppel@uwaterloo.ca>
1741 PR c++/67054 - Inherited ctor with non-default-constructible members
1742 * method.c (walk_field_subobs) Consider member initializers (NSDMIs)
1743 when deducing an inheriting constructor.
1745 2017-07-21 Nathan Sidwell <nathan@acm.org>
1747 * search.c (lookup_conversion_operator): Return overloads.
1748 (lookup_fnfields_idx_nolazy): Absorb into ...
1749 (lookup_fnfields_slot_nolaxy): ... here.
1750 (lookup_fnfields_1): Absorb into ...
1751 (lookup_fnfields_slot): ... here.
1753 Remove special CDtor METHOD_VEC slots.
1754 * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT,
1755 CLASSTYPE_DESTRUCTOR_SLOT): Delete.
1756 (CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
1757 (CLASSTYPE_DESTRUCTOR): Likewise.
1758 * class (add_method): Don't use special cdtor slots.
1759 * search.c (lookup_fnfields_idx_nolazy): Likewise.
1760 (look_for_overrides_here): Use lookup_fnfields_slot.
1761 * semantics (classtype_has_nothrow_assign_or_copy_p): Likewise.
1763 * call.c (add_candidates): Move decls to initialization. Don't
1766 2017-07-20 Nathan Sidwell <nathan@acm.org>
1768 Remove TYPE_METHODS.
1769 * class.c (maybe_warn_about_overly_private_class,
1770 finish_struct_methods, one_inheriting_sig, count_fields,
1771 add_fields_to_record_type, check_field_decls, check_methods,
1772 clone_function_decl, set_method_tm_attributes,
1773 finalize_literal_type_property, check_bases_and_members,
1774 create_vtable_ptr, determine_key_method,
1775 unreverse_member_declarations, finish_struct,
1776 add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS.
1777 * decl.c (fixup_anonymous_aggr): Likewise.
1778 * decl2.c (reset_type_linkage_2): Likewise.
1779 * method.c (after_nsdmi_defaulted_late_checks,
1780 lazily_declare_fn): Likewise.
1781 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
1782 * pt.c (instantiate_class_template_1, tsubst_expr,
1783 do_type_instantiation, instantiate_pending_templates): Likewise.
1784 * search.c (lookup_field_1): Likewise.
1785 * semantics.c (finish_member_declaration,
1786 finish_omp_declare_simd_methods): Likewise.
1788 2017-07-19 Nathan Sidwell <nathan@acm.org>
1790 * class.c (add_implicitly_declared_members): Use
1791 classtype_has_move_assign_or_move_ctor_p.
1792 (classtype_has_move_assign_or_move_ctor,
1793 classtype_has_user_move_assign_or_move_ctor_p): Merge into ...
1794 (classtype_has_move_assign_or_move_ctor_p): ... this new function.
1795 * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p):
1797 (classtype_has_move_assign_or_move_ctor_p): ... this.
1798 * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust.
1799 * tree.c (type_has_nontrivial_copy_init): Adjust.
1801 * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS,
1802 PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}_VALUE_RAW.
1804 2017-07-18 Nathan Sidwell <nathan@acm.org>
1806 * cp-array-notation.c (build_array_notation_ref): Use
1807 TYPE_{MIN,MAX}_VALUE.
1809 * class.c (classtype_has_move_assign_or_move_ctor): Declare.
1810 (add_implicitly_declared_members): Use it.
1811 (type_has_move_constructor, type_has_move_assign): Merge into ...
1812 (classtype_has_move_assign_or_move_ctor): ... this new function.
1813 * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
1815 2017-07-17 Volker Reichelt <v.reichelt@netcologne.de>
1817 * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for
1818 friend outside class and obsolete auto as storage-class-specifier.
1820 2017-07-17 Nathan Sidwell <nathan@acm.org>
1822 * class.c (maybe_warn_about_overly_private_class): Ignore public
1825 * class.c (type_has_user_declared_move_constructor,
1826 type_has_user_declared_move_assign): Combine into ...
1827 (classtype_has_user_move_assign_or_move_ctor_p): ... this new function.
1828 * cp-tree.h (type_has_user_declared_move_constructor,
1829 type_has_user_declared_move_assign): Combine into ...
1830 (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare.
1831 * method.c (maybe_explain_implicit_delete): Use it.
1832 (lazily_declare_fn): Use it.
1833 * tree.c (type_has_nontrivial_copy_init): Use it.
1835 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify
1836 semantics, simplify implementation.
1838 2017-07-16 Volker Reichelt <v.reichelt@netcologne.de>
1840 * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
1841 in old-style cast diagnostic.
1842 * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
1843 in useless cast diagnostic.
1844 * error.c (type_to_string): Remove enum special handling.
1846 2017-07-14 David Malcolm <dmalcolm@redhat.com>
1848 * name-lookup.c (get_std_name_hint): Add '<' and '>' around
1850 (maybe_suggest_missing_header): Update for addition of '<' and '>'
1851 to above. Provide a fix-it hint.
1852 * pt.c: Include "gcc-rich-location.h"
1853 (listify): Attempt to add fix-it hint for missing
1854 #include <initializer_list>.
1855 * rtti.c: Include "gcc-rich-location.h".
1856 (typeid_ok_p): Attempt to add fix-it hint for missing
1857 #include <typeinfo>.
1859 2017-07-12 Jason Merrill <jason@redhat.com>
1861 P0512R0 - Deduction from an initializer list.
1862 * pt.c (do_class_deduction): Do list deduction in two phases.
1864 2017-07-12 Nathan Sidwell <nathan@acm.org>
1866 * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR,
1867 DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at
1869 * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
1870 DECL_CXX_DESTRUCTOR explicitly.
1871 * decl2.c (grokclassfn): Likewise.
1872 * friend.c (do_friend): Likewise.
1873 * method.c (make_thunk, make_alias_for,
1874 implicitly_declare_fn): Likewise.
1876 2017-07-11 Jason Merrill <jason@redhat.com>
1879 * decl.c (grokparms): Downgrade error about array of unknown bound
1880 to pedwarn and disable it for C++17.
1882 2017-07-11 Nathan Sidwell <nathan@acm.org>
1884 * decl2.c (reset_type_linkage_2): Dont't change ctor name.
1886 2017-07-10 Martin Sebor <msebor@redhat.com>
1888 * cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document.
1890 2017-07-06 Jason Merrill <jason@redhat.com>
1892 PR c++/81204 - parse error with dependent template-name
1893 * parser.c (cp_parser_lookup_name): Revert previous change.
1895 2017-07-06 David Malcolm <dmalcolm@redhat.com>
1897 * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
1898 selftest::run_cp_tests.
1899 (selftest::run_cp_tests): New function.
1900 * cp-tree.h (selftest::run_cp_tests): New decl.
1902 2017-07-04 Jakub Jelinek <jakub@redhat.com>
1904 * parser.c (cp_parser_decomposition_declaration): Replace
1905 decomposition declaration with structured binding in diagnostics.
1906 * decl.c (cp_finish_decomp): Likewise.
1907 (grokdeclarator): Likewise.
1910 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid
1911 forms of structured binding initializers.
1913 2017-07-03 Paolo Carlini <paolo.carlini@oracle.com>
1916 * decl.c (grokdeclarator): Move checks on function return type after
1917 the splice_late_return_type call; if declspecs->locations[ds_type_spec]
1918 is UNKNOWN_LOCATION fall back to input_location.
1920 2017-07-03 David Malcolm <dmalcolm@redhat.com>
1922 * parser.c (enum required_token): Fix spelling of
1923 RT_INTERATION to RT_ITERATION.
1924 (cp_parser_iteration_statement): Likewise.
1925 (cp_parser_required_error): Likewise.
1927 2017-06-30 Jason Merrill <jason@redhat.com>
1929 PR c++/81257 - ICE with invalid ::template.
1930 PR c++/54769 - wrong lookup of dependent template-name.
1931 * parser.c (cp_parser_template_name): Revert part of last change.
1933 2017-06-30 Nathan Sidwell <nathan@acm.org>
1935 * config-lang.in (gtfiles): Add cp/lex.c.
1936 * cp-tree.h (mangle_convop_name_for_type): Rename ...
1937 (make_conv_op_name): ... here. Move to lex.
1938 * lambda.c (maybe_add_lambda_conv_op): Update.
1939 * parser.c (cp_parser_conversion_function_id): Update.
1940 * pt.c (tsubst_decl, tsubst_baselink, tsubst_copy,
1941 tsubst_copy_and_build): Update.
1942 * semantics.c (apply_deduced_return_type): Update.
1943 * mangle.c (conv_type_hasher, conv_type_names,
1944 mangle_conv_op_name_for_type): Move to ...
1945 * lex.c (conv_type_hasher, conv_type_names, make_convop_name):
1948 2017-06-30 David Malcolm <dmalcolm@redhat.com>
1951 * parser.c (cp_parser_postfix_expression): Construct a location
1952 for typeid expressions.
1954 2017-06-30 Nathan Sidwell <nathan@acm.org>
1956 * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
1958 (lookup_all_conversions): Declare.
1959 * class.c (get_basefndecls): Use lookup_fnfields_slot.
1960 * decl.c (register_dtor_fn): Use lookup_fnfields_slot.
1961 * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework
1963 * pt.c (retrieve_specialization): Use lookup_fnfields_slot.
1964 (check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
1965 lookup_all_conversions.
1966 * search.c (lookup_fnfields_1): Make static.
1967 (lookup_all_conversions): New.
1968 (class_method_index_for_fn): Delete.
1969 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
1970 lookup_fnfields_slot.
1972 * call.c (build_new_method_call_1): Use constructo_name to get
1973 ctor name. Move argument processing earlier to merge cdtor
1975 * decl.c (grokfndecl): Cdtors have special names.
1976 * method.c (implicitly_declare_fn): Likewise. Simplify flag setting.
1977 * pt.c (check_explicit_specialization): Cdtor name is already
1979 * search.c (class_method_index_for_fn): Likewise.
1982 * name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding
1983 a matching TYPE_DECL.
1985 2017-06-29 Paolo Carlini <paolo.carlini@oracle.com>
1987 * class.c (add_method): Change pair of errors to error + inform.
1988 (handle_using_decl): Likewise.
1990 2017-06-29 Jason Merrill <jason@redhat.com>
1992 * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling.
1994 PR c++/81180 - ICE with C++17 deduction of member class template.
1995 * pt.c (build_deduction_guide): Correct member template handling.
1997 PR c++/81188 - matching decltype of member function call.
1998 * tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
2000 2017-06-29 Nathan Sidwell <nathan@acm.org>
2003 * parser.c (cp_parser_namespace_definition): Immediately close the
2004 namespace if there's no open-brace.
2005 * name-lookup.c (do_pushdecl): Reset OLD when pushing into new
2008 2017-06-29 Jason Merrill <jason@redhat.com>
2010 PR c++/81164 - ICE with invalid inherited constructor.
2011 * search.c (binfo_direct_p): New.
2012 * name-lookup.c (do_class_using_decl): Use it.
2014 2017-06-29 Nathan Sidwell <nathan@acm.org>
2016 * cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
2017 VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
2018 * decl.c (initialize_predefined_identifiers): Name cdtor special
2019 names consistently. Use literals for above deleted defines.
2020 (cxx_init_decl_processing): Use literal for vtbl_ptr_type name,
2022 * lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
2025 * call.c (check_dtor_name): Use constructor_name for enums too.
2026 (build_new_method_call_1): Use constructor_name for cdtors and
2028 * class.c (build_self_reference): Use TYPE_NAME to get name of
2030 * name-lookup (constructor_name): Use DECL_NAME directly.
2031 (constructor_name_p): Reimplement.
2032 (push_class_level_binding_1): Use TYPE_NAME directly.
2034 * class.c (finish_struct): Use OVL_P.
2035 (get_vfield_name): Measure constructor_name length.
2036 * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
2037 (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
2038 * cxx-pretty-print.c (is_destructor_name): Delete.
2039 (pp_cxx_unqualified_id): Remove bogus destructor name checking.
2040 * decl.c (grokfndecl): Move cheap checks first when looking for
2041 implicit extern cness.
2043 * parser.c (cp_parser_direct_declarator): Reorder if to avoid
2044 indentation. Remove unnecessary assignment of constructor name.
2046 Whitespace cleanups.
2047 * call.c (name_as_c_string): Move CONST_CAST to return.
2048 (build_new_method_call_1): Remove unneeded bracing.
2049 * class.c (include_empty_classes): Unbreak line.
2050 * constraint.cc (tsubst_check_constraint): Add space.
2051 * cp-tree.h (lang_decl_ns): Add comment.
2052 (PTRMEM_CST_MEMBER): Break line.
2053 * decl.c (grokfndecl): Add blank lines. Unbreak some others.
2054 (grokdeclarator): Remove lines, move declaration to first use.
2055 * decl2.c (decl_needed_p): Fix indentation.
2056 (c_parse_final_cleanups): Remove blank line.
2057 * method.c (implicitly_declare_fn): Move declaration to first use.
2058 * search.c (current_scope): Add blank lines.
2060 2017-06-28 Jason Merrill <jason@redhat.com>
2062 PR c++/72764 - ICE with invalid template typename.
2063 * decl.c (build_typename_type): No longer static.
2064 * tree.c (strip_typedefs): Use it instead of make_typename_type.
2066 PR c++/69300 - ICE with self-referential noexcept
2067 * pt.c (maybe_instantiate_noexcept): Check for recursion.
2069 PR c++/61022 - error with variadic template template parm
2070 * pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.
2072 PR c++/72801 - ICE with variadic partial specialization
2073 * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.
2075 PR c++/55639 - partial specialization with ::template
2076 * parser.c (cp_parser_class_head): Handle ::template.
2078 PR c++/45976 - error with ::template in declarator.
2079 * pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling.
2081 PR c++/54769 - wrong lookup of dependent template-name.
2082 * parser.c (cp_parser_template_name): Handle dependent object type.
2083 (cp_parser_nested_name_specifier_opt): Make template_keyword_p a
2085 (cp_parser_id_expression): Pass it.
2086 (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.
2088 * parser.c (cp_parser_template_id): Use the range location on the
2091 PR c++/81204 - parse error with dependent template-name
2092 * parser.c (cp_parser_lookup_name): Disqualify function templates
2095 2017-06-27 Nathan Sidwell <nathan@acm.org>
2097 * pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
2098 initialization point. Don't unnecessarily check for ctor name.
2100 * cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
2101 (CLASSTYPE_DESTRUCTOR): ... this.
2102 * class.c (accessible_nvdtor_p,
2103 maybe_warn_about_overly_private_class,
2104 add_implicitly_declared_members,
2105 clone_constructors_and_destructors, type_has_virtual_destructor):
2106 Adjust for CLASSTYPE_DESTRUCTOR.
2107 (deduce_noexcept_on_destructors): Absorb into ...
2108 (check_bases_and_members): ... here.
2109 * except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
2110 * init.c (build_delete): Likewise.
2111 * parser.c (cp_parser_lookup_name): Likewise.
2112 * pt.c (check_explicit_specialization): Likewise.
2113 * rtti.c (emit_support_tinfos): Likewise.
2114 * search.c (lookup_fnfields_idx_nolazy): Likewise.
2116 Kill IDENTIFIER_TEMPLATE.
2117 * cp-tree.h (lang_identifier): Remove class_template_info field.
2118 (IDENTIFIER_TEMPLATE): Delete.
2119 * name-lookup.c (constructor_name_full): Subsume into ...
2120 (constructor_name): ... here. Don't check IDENTIFIER_TEMPLATE.
2121 (constructor_name_p): Likewise.
2122 * mangle.c (write_source_name): Likewise.
2123 * ptree.c (cxx_print_identifier): Likewise.
2125 2017-06-27 Marek Polacek <polacek@redhat.com>
2128 * parser.c (cp_parser_already_scoped_statement): Initialize
2131 2017-06-26 Jason Merrill <jason@redhat.com>
2133 PR c++/81215 - deduction failure with variadic TTP.
2134 * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.
2136 2017-06-26 Martin Sebor <msebor@redhat.com>
2139 * call.c (maybe_warn_class_memaccess): Preserve explicit conversions
2140 to detect casting away cv-qualifiers.
2142 2017-06-26 Nathan Sidwell <nathan@acm.org>
2144 * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
2145 (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
2147 (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
2148 DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
2149 (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
2150 * decl.c (grok_op_properties): Adjust identifier checking.
2151 * init.c (expand_default_init): Adjust identifier descision.
2152 * method.c (implicitly_declare_fn): Don't use
2153 DECL_ASSIGNMENT_OPERATOR_P.
2154 * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
2156 * call.c (in_charge_arg_for_name): Reimplement.
2157 (build_special_member_call): Use IDENTIFIER_CDTOR_P,
2160 2017-06-26 Marek Polacek <polacek@redhat.com>
2163 * parser.c (cp_parser_statement): Add a default argument. Save the
2164 location of the expression-statement after labels have been parsed.
2165 (cp_parser_implicitly_scoped_statement): Set the location of the
2166 body of the conditional after parsing all the labels. Call
2167 warn_for_multistatement_macros.
2168 (cp_parser_already_scoped_statement): Likewise.
2170 2017-06-24 Paolo Carlini <paolo.carlini@oracle.com>
2173 * parser.c (cp_parser_diagnose_invalid_type_name): Don't print
2174 'typename' in error messages about missing 'typename'.
2176 2017-06-23 Jason Merrill <jason@redhat.com>
2178 PR c++/79056 - C++17 ICE with invalid template syntax.
2179 * parser.c (cp_parser_simple_type_specifier): Don't assume that type
2181 (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
2182 * pt.c (template_placeholder_p): New.
2183 * cp-tree.h: Declare it.
2185 2017-06-23 Marc Glisse <marc.glisse@inria.fr>
2187 * decl.c (duplicate_decls): Use builtin_structptr_types.
2189 2017-06-22 Nathan Sidwell <nathan@acm.org>
2191 Reorder IDENTIFIER flags
2193 * cp-tree.h (enum cp_identifier_kind): New.
2194 (IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
2195 IDENTIFIER_KIND_BIT_2): New.
2196 (IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
2197 (IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
2198 (C_IS_RESERVED_WORD): Replace with ...
2199 (IDENTIFIER_KEYWORD_P): ... this.
2200 (IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
2201 (IDENTIFIER_CDTOR_P): ... this.
2202 (IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
2203 (IDENTIFIER_OPNAME_P): Replace with ...
2204 (IDENTIFIER_ANY_OP_P): ... this.
2205 (IDENTIFIER_ASSIGN_OP_P): New.
2206 (IDENTIFIER_TYPENAME_P): Replace with ...
2207 (IDENTIFIER_CONV_OP_P): ... this.
2208 (NEW_DELETE_OPNAME_P): Replace with ...
2209 (IDENTIFIER_NEWDEL_OP_P): ... this.
2210 (DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
2211 (get_identifier_kind_name, set_identifier_kind): Declare.
2212 * lex.c (get_identifier_kind_name, set_identifier_kind): New.
2213 (init_operators): Adjust to avoid keywords, use
2214 set_identifier_kind. Copy TYPE_EXPR slot.
2215 (init_reswords): Call set_identifier_kind.
2216 (unqualified_name_lookup_error): Adjust.
2217 * operators.def (TYPE_EXPR): Remove.
2218 * decl.c (struct predefined_identifier): Move into ...
2219 (initialize_predefined_identifiers): ... here. Call
2220 set_identifier_kind.
2221 (grokfndecl, check_var_type, grokdeclarator): Adjust.
2222 (grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
2224 * call.c (name_as_c_string): Adjust.
2225 (build_new_method_call_1): Likewise.
2226 * cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
2227 * cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
2228 * dump.c (cp_dump_tree): Adjust.
2229 * error.c (dump_decl_name): Adjust.
2230 * mangle.c (write_unqualified_id, write_member_name,
2231 write_expression): Adjust.
2232 (mangle_conv_op_name_for_type): Use set_identifier_kind.
2233 * name-lookup.c (do_class_using_decl): Adjust.
2234 (lookup_name_fuzzy, lookup_name_real_1): Likewise.
2235 * parser.c (cp_lexer_get_preprocessor_token,
2236 cp_parser_direct_declarator): Likewise.
2237 * pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
2238 tsubst_copy, tsubst_copy_and_build): Adjust.
2239 * ptree.c (cxx_print_identifier): Print identifier kind.
2240 * search.c (lookup_field_r, lookup_member,
2241 lookup_fnfields_idx_nolazy): Adjust.
2242 * semantics.c (finish_id_expression): Adjust..
2243 * typeck.c (cp_build_addr_expr_1): Adjust.
2245 2017-06-21 Jakub Jelinek <jakub@redhat.com>
2248 * semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
2249 Complain about t not being a variable if t is OVERLOAD even
2250 when processing_template_decl.
2252 2017-06-21 David Malcolm <dmalcolm@redhat.com>
2254 * parser.c (get_cast_suggestion): New function.
2255 (maybe_add_cast_fixit): New function.
2256 (cp_parser_cast_expression): Capture the location of the closing
2257 parenthesis. Call maybe_add_cast_fixit when emitting warnings
2258 about old-style casts.
2260 2017-06-20 Jason Merrill <jason@redhat.com>
2262 PR c++/80972 - C++17 ICE with attribute packed.
2263 * call.c (build_over_call): Allow a TARGET_EXPR from reference
2266 2017-06-20 Nathan Sidwell <nathan@acm.org>
2268 * cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete.
2269 (nelts_identifier): Delete.
2270 * decl.c (initialize_predefined_identifiers): Remove nelts.
2272 PR c++/67074 - namespace aliases
2273 * decl.c (duplicate_decls): Don't error here on mismatched
2275 * name-lookup.c (name_lookup::add_value): Matching namespaces are
2277 (diagnose_name_conflict): Namespaces are never redeclarations.
2278 (update_binding): An alias can match a real namespace.
2280 2017-06-19 Jason Merrill <jason@redhat.com>
2282 PR c++/80562 - ICE with constexpr if.
2283 * semantics.c (finish_if_stmt_cond): Call
2284 instantiate_non_dependent_expr.
2286 PR c++/80829 - ICE with constexpr copy of base subobject.
2287 * constexpr.c (clear_no_implicit_zero): New.
2288 (cxx_eval_call_expression): Call it.
2290 2017-06-19 Nathan Sidwell <nathan@acm.org>
2294 * name-lookup.c (set_decl_namespace): Don't follow using
2295 directives and ignore using decls. Only check overly-explicit
2296 scope after discovering decl.
2298 2017-06-19 Jason Merrill <jason@redhat.com>
2300 PR c++/81073 - constexpr and static var in statement-expression.
2301 * typeck2.c (store_init_value): Always call
2302 require_potential_constant_expression.
2303 * pt.c (convert_nontype_argument): Likewise.
2304 * constexpr.c (potential_constant_expression_1): Adjust message.
2305 Use decl_maybe_constant_var_p instead of decl_constant_var_p.
2306 * decl2.c (decl_maybe_constant_var_p): Consider initializer.
2308 2017-06-19 Nathan Sidwell <nathan@acm.org>
2310 * pt.c (coerce_template_parms): Fix indentation.
2311 (tsubst_decl): Remove repeated SET_DECL_RTL. Move VAR_P handling
2315 * name-lookup.c (update_binding): Only warn about constructors
2316 hidden by functions.
2318 2017-06-17 Jason Merrill <jason@redhat.com>
2320 PR c++/60063 - -Wunused-local-typedefs and templates.
2321 * decl2.c (is_late_template_attribute): Return false for "used".
2323 PR c++/70844 - -Wuseless-cast and inheriting constructor.
2324 * method.c (forward_parm): Suppress warn_useless_cast.
2326 2017-06-16 Jason Merrill <jason@redhat.com>
2328 PR c++/81045 - Wrong type-dependence with auto return type.
2329 * pt.c (type_dependent_expression_p): An undeduced auto outside the
2330 template isn't dependent.
2331 * call.c (build_over_call): Instantiate undeduced auto even in a
2334 PR c++/80465 - ICE with generic lambda with noexcept-specifier.
2335 * lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
2336 set longer for a generic lambda.
2338 PR c++/80614 - Wrong mangling for C++17 noexcept type
2339 * mangle.c (write_type): Put the eh spec back on the function type.
2341 PR c++/81102 - Wrong error with partial specialization.
2342 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing
2343 types. Do type deduction later.
2345 PR c++/81074 - ICE with partial specialization of member template.
2347 * pt.c (get_partial_spec_bindings): Only coerce innermost args.
2349 PR c++/80831 - ICE with -fsyntax-only.
2350 * decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
2352 PR c++/80639 - ICE with invalid PMF initialization.
2353 PR c++/80043 - ICE with -fpermissive
2354 * typeck.c (convert_for_assignment): Recurse when instantiate_type
2355 returns without an error.
2357 2017-06-16 Nathan Sidwell <nathan@acm.org>
2359 * pt.c (tsubst_baselink): Fix & clarify formatting.
2361 * cp-tree.h (build_this_parm, cp_build_parm_decl,
2362 build_artificial_parm): Add FN parm.
2363 * decl.c (start_cleanup_fn): Adjust.
2364 (build_this_parm): Add FN parm, pass it through.
2365 (grokfndecl): Adjust parm building.
2366 * decl2.c (cp_build_parm_decl): Add FN parm, set context.
2367 (build_artificial_parm): Add FN parm, pass through.
2368 (maybe_retrofit_in_chrg): Adjust parm building.
2369 (start_static_storage_duration_function): Likwise.
2370 * lambda.c (maybe_aadd_lambda_conv_op): Likewise.
2371 * method.c (implicitly_declare_fn): Likewise.
2372 * parser.c (inject_this_parameter): Likewise.
2374 Symbol tables are insert only.
2375 * cp-tree.h (default_hash_traits <lang_identifier *>): Don't
2376 derive from pointer_hash. Make undeletable.
2378 * class.c (resort_type_method_vec): Avoid potential unsigned
2381 Don't defer noexcept_deferred_spec.
2382 * cp-tree.h (unevaluated_noexcept_spec): Don't declare.
2383 * decl.c (cxx_init_decl_processing): Initialize
2384 noexcept_deferred_spec.
2385 * except.c (unevaluated_noexcept_spec): Delete.
2386 * class.c (deduce_noexcept_on_destructor): Use
2387 noexcept_deferred_spec directly.
2388 * method.c (implicitly_declare_fn): Likewise.
2390 Make keyed_classes a vector.
2391 * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
2392 (keyed_classes): Declare as vector.
2393 * decl.c (keyed_classes): Define.
2394 (cxx_init_decl_processing): Allocate it.
2395 (record_key_method_defined): Use vec_safe_push.
2396 * class.c (finish_struct_1): Likewise.
2397 * pt.c (instantiate_class_template_1): Likewise.
2398 * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
2401 * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
2402 TK_VMI_CLASS_TYPES, TK_MAX. Delete TK_FIXED.
2404 (typeid_ok_p): Add quotes to error messages. Use get_tinfo_desc.
2405 (get_tinfo_decl): Use get_tinfo_desc.
2406 (get_pseudo_ti_init): Likewise. Adjust VMI construction.
2407 (create_pseudo_type_info): Delete.
2408 (get_pseudo_ti_index): Just determine the index.
2409 (get_tinfo_desc): New. Create all types lazily.
2410 (create_tinfo_types): Just allocate the descriptor array.
2411 (emit_support_tinfos): Use non-inserting type lookup. Set builtin
2414 2017-06-15 Martin Sebor <msebor@redhat.com>
2417 * call.c (first_non_public_field, maybe_warn_class_memaccess): New
2419 (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
2420 (build_cxx_call): Call maybe_warn_class_memaccess.
2422 2017-06-14 Jakub Jelinek <jakub@redhat.com>
2424 * cp-gimplify.c (cp_genericize_r): Turn most of the function
2425 into a switch (TREE_CODE (stmt)) statement from long else if
2428 2017-06-13 Jakub Jelinek <jakub@redhat.com>
2431 * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
2432 argument even if it has REFERENCE_TYPE.
2435 * cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
2436 BLOCK_VARS (outer) chain.
2437 (cxx_omp_const_qual_no_mutable): Likewise.
2439 2017-06-13 Martin Liska <mliska@suse.cz>
2442 * class.c (build_base_path): Use sanitize_flags_p.
2443 * cp-gimplify.c (cp_genericize_r): Likewise.
2444 (cp_genericize_tree): Likewise.
2445 (cp_genericize): Likewise.
2446 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
2447 * decl.c (compute_array_index_type): Likewise.
2448 (start_preparsed_function): Likewise.
2449 * decl2.c (one_static_initialization_or_destruction): Likewise.
2450 * init.c (finish_length_check): Likewise.
2451 * lambda.c (maybe_add_lambda_conv_op): Likewise.
2452 * typeck.c (cp_build_binary_op): Likewise.
2453 (build_static_cast_1): Likewise.
2455 2017-06-11 Jason Merrill <jason@redhat.com>
2457 * error.c (dump_expr): Use is_this_parameter.
2459 * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
2462 2017-06-09 Jason Merrill <jason@redhat.com>
2464 Missing bits from N4268, constant evaluation for all non-type args.
2465 * call.c (build_converted_constant_expr): Rename from
2466 build_integral_nontype_arg_conv, handle all types.
2467 * pt.c (convert_nontype_argument): In C++17 call it for all types.
2468 Move NOP stripping inside pointer case, don't strip ADDR_EXPR.
2469 * cvt.c (strip_fnptr_conv): Also strip conversions to the same type.
2471 Overhaul pointer-to-member conversion and template argument handling.
2472 * call.c (standard_conversion): Avoid creating ck_pmem when the
2473 class type is the same.
2474 * cvt.c (can_convert_qual): Split from
2475 perform_qualification_conversions.
2476 * constexpr.c (cxx_eval_constant_expression): Check it.
2477 * typeck.c (convert_ptrmem): Only cplus_expand_constant if
2478 adjustment is necessary.
2479 * pt.c (check_valid_ptrmem_cst_expr): Compare class types.
2480 (convert_nontype_argument): Avoid redundant error.
2482 * call.c (convert_like_real): Remove "inner" parameter.
2483 Don't replace a constant with its value.
2484 * cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue.
2486 * pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
2489 * parser.c (cp_parser_constant_expression): Check
2490 potential_rvalue_constant_expression after decay_conversion.
2491 * pt.c (convert_nontype_argument): Don't require linkage in C++17.
2493 PR c++/80384 - ICE with dependent noexcept-specifier
2494 * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
2497 * constexpr.c (potential_constant_expression_1): Allow 'this' capture.
2499 2017-06-09 Jan Hubicka <hubicka@ucw.cz>
2501 * class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
2502 * decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise.
2503 (excpet.c): Mark terminate as cold.
2505 2017-06-08 Jakub Jelinek <jakub@redhat.com>
2508 * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
2509 to sizetype before size_binop.
2512 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause
2513 to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE
2514 and OMP_CLAUSE_SHARED_READONLY flags.
2516 2017-06-08 Jan Hubicka <hubicka@ucw.cz>
2518 * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
2520 2017-06-07 Nathan Sidwell <nathan@acm.org>
2522 * class.c (layout_class_type): Restructure overlong-bitfield tpe
2525 2017-06-07 Jonathan Wakely <jwakely@redhat.com>
2528 * pt.c (do_class_deduction): Build qualified type.
2530 2017-06-06 Nathan Sidwell <nathan@acm.org>
2532 * name-lookup.c (suggest_alternatives_for): Use qualified lookup
2533 sans using directives. Don't walk into inline namespaces.
2536 * name-lookup.c (adl_class_only): Don't add visible friends.
2538 2017-06-05 Volker Reichelt <v.reichelt@netcologne.de>
2540 * parser.c (cp_parser_base_specifier): Fix typos in error messages.
2542 2017-06-02 Nathan Sidwell <nathan@acm.org>
2544 Remove lang_type_ptrmem.
2545 * cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
2547 (lang_type_class): ... this. Reorder bitfields. Rename to ...
2548 (lang_type): ... this. Delete old definition.
2549 (lang_type_ptrmem): Delete.
2550 (LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC. Adjust uses.
2551 (LANG_TYPE_PTRMEM_CHECK): Delete.
2552 (TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
2553 (TYPE_PTRMEMFUNC_TYPE): New. Use TYPE_LANG_SLOT_1.
2554 * decl.c (build_ptrmemfunc_type): Adjust.
2555 * lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
2556 (maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.
2558 * class.c (check_bases_and_members): Adjust vec_new_uses_cookie
2561 Remove cp_binding_level::namespaces
2562 * name-lookup.h (cp_binding_level): Lose namespaces field.
2563 * name-lookup.c (add_decl_to_level): Chain namespaces on the names
2565 (suggest_alternatives_for): Adjust for namespace list. Do
2566 breadth-first search.
2567 * decl2.c (collect_source_refs): Namespaces are on the regulr
2569 (collect_ada_namespace): Likewise.
2571 2017-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
2573 * typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div
2576 2017-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2579 * method.c (constructible_expr): Strip array types before calling
2582 2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
2585 * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
2586 for case INDIRECT_REF too in the main switch.
2588 2017-05-31 Jason Merrill <jason@redhat.com>
2590 PR c++/80840 - ICE with constexpr and reference
2591 * pt.c (convert_nontype_argument): Don't test whether a decl is
2592 value-dependent when binding to a reference.
2594 2017-05-31 Nathan Sidwell <nathan@acm.org>
2596 * cp-tree.h (lang_decl_slector): New enum.
2597 (lang_decl_base): Make selector an enum. Drop decomposition_p
2599 (lang_decl): Use enum for discrimination.
2600 (LANG_DECL_FN_CHECK, LANG_DECL_NS_CHECK, LANG_DECL_PARM_CHECK,
2601 LANG_DECL_DEOMP_CHECK): Use enum.
2602 (DECL_DECOMPOSITION_P): Use selector value.
2603 (SET_DECL_DECOMPOSITION_P): Delete.
2604 (retrofit_lang_decl): Lose SEL parm.
2605 (fit_decomposition_lang_decl): Declare.
2606 * decl.c (cp_finish_decomp, grokdeclarator): Use
2607 fit_decomposition_lang_decl.
2608 * lex.c (maybe_add_lang_decl_raw): New. Broken out of
2610 (set_decl_linkage): New. Broken out of retrofit_lang_decl. Use enum.
2611 (fit_decomposition_lang_decl): Likewise.
2612 (retrofit_lang_decl): Use worker functions.
2613 (cxx_dup_lang_specific_decl): Use selector enum.
2614 (maybe_add_lang_type_raw): New. Broken out of ...
2615 (cxx_make_type_name): ... here. Call it.
2617 2017-05-30 Jason Merrill <jason@redhat.com>
2619 PR c++/80856 - ICE with local extern in template
2620 * semantics.c (finish_call_expr): Replace a local extern overload
2621 set in a template with the IDENTIFIER_NODE.
2623 2017-05-30 David Malcolm <dmalcolm@redhat.com>
2625 * call.c (perform_implicit_conversion_flags): Convert
2626 "from %qT to %qT" to "from %qH to %qI" in diagnostic.
2627 (print_conversion_rejection): Replace pairs of %qT with
2628 %qH and %qI in various places.
2629 (build_user_type_conversion_1): Likewise.
2630 (build_integral_nontype_arg_conv): Likewise.
2631 (build_conditional_expr_1): Likewise.
2632 (convert_like_real): Likewise.
2633 (convert_arg_to_ellipsis): Likewise.
2635 (initialize_reference): Likewise.
2636 * cvt.c (cp_convert_to_pointer): Likewise.
2637 (cp_convert_to_pointer): Likewise.
2638 (convert_to_reference): Likewise.
2639 (ocp_convert): Likewise.
2640 * error.c (cp_printer): Gain bool and const char ** parameters.
2641 (struct deferred_printed_type): New struct.
2642 (class cxx_format_postprocessor): New class.
2643 (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor
2644 to pp->m_format_postprocessor.
2645 (comparable_template_types_p): New function.
2646 (newline_and_indent): New function.
2647 (arg_to_string): New function.
2648 (print_nonequal_arg): New function.
2649 (print_template_differences): New function.
2650 (type_to_string_with_compare): New function.
2651 (print_template_tree_comparison): New function.
2652 (append_formatted_chunk): New function.
2653 (add_quotes): New function.
2654 (cxx_format_postprocessor::handle): New function.
2655 (defer_phase_2_of_type_diff): New function.
2656 (cp_printer): Add "quoted" and "buffer_ptr" params. Implement
2658 * typeck.c (cp_build_binary_op): Replace pairs of %qT with
2659 %qH and %qI in various places.
2660 (convert_member_func_to_ptr): Likewise.
2661 (build_reinterpret_cast_1): Likewise.
2662 (convert_for_assignment): Likewise.
2663 * typeck2.c (check_narrowing): Likewise.
2665 2017-05-30 Nathan Sidwell <nathan@acm.org>
2667 Kill IDENTIFIER_NAMESPACE_BINDINGS
2668 * cp-tree.h (lang_identifier): Delete namespace_bindings.
2669 (IDENTIFIER_NAMESPACE_BINDINGS): Delete.
2670 (lang_decl_ns): Add bindings.
2671 (DECL_NAMESPACE_BINDINGS): New.
2672 * lex.c (retrofit_lang_decl): Create namespace hash table.
2673 * name-lookup.c (find_namespace_slot): Change to use hash-map.
2674 * ptree.c (cxx_print_binding): Delete.
2675 (cxx_print_identifier): Remove NAMESPACE_BINDING printing.
2677 * cp-tree.def (OVERLOAD): Fix comment.
2678 * cp-tree.h: Fix comments and whitespace.
2679 * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
2680 * name-lookup.c (add_decl_to_level): Assert not class.
2681 (check_local_shadow): Use OVL_P.
2682 (pushdecl_with_scope_1): Rename to ...
2683 (do_pushdecl_with_Scope): ... here.
2684 (do_nonmember_using_decl): Use qualified_namespace_lookup return
2686 (push_class_level_binding_1): Use OVL_P.
2687 (pushdecl_namespace_level): Use do_pushdecl_with_scope.
2688 (pushtag_1): Rename to ...
2689 (do_pushtag): ... here. Adjust do_pushdecl_with_scope call.
2691 (store_class_bindings): Do not time here.
2692 * name-lookup.h (pushdecl_outermost_localscope): Reorder.
2693 * pt.c (listify): Declare argvec at point of initialization.
2696 * name-lookup.c (add_decl_to_level): Assert not making a circular
2698 (update_binding): Don't prematurely slide artificial decl.
2700 2017-05-29 Alexandre Oliva <aoliva@redhat.com>
2702 * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused.
2704 2017-05-29 Nathan Sidwell <nathan@acm.org>
2706 PR c++/80891 (#1,#5)
2707 * cp-tree.h (lookup_maybe_add): Add DEDUPING argument.
2708 * name-lookup.c (name_lookup): Add deduping field.
2709 (name_lookup::preserve_state, name_lookup::restore_state): Deal
2711 (name_lookup::add_overload): New.
2712 (name_lookup::add_value, name_lookup::add_fns): Call add_overload.
2713 (name_lookup::search_adl): Set deduping. Don't unmark here.
2714 * pt.c (most_specialized_instantiation): Revert previous change,
2715 Assert not given duplicates.
2716 * tree.c (lookup_mark): Just mark the underlying decls.
2717 (lookup_maybe_add): Dedup using marked decls.
2720 * ptree.c (cxx_print_xnode): Show internal OVERLOAD structure.
2721 * tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert.
2723 Stat hack representation
2724 * name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
2725 MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
2727 (find_namespace_binding): Replace with ...
2728 (find_namespace_slot): ... this.
2729 (find_namespace_value): New.
2730 (name_lookup::search_namespace_only,
2731 name_lookup::adl_namespace_only): Adjust.
2732 (update_binding): Add SLOT parameter, adjust.
2733 (check_local_shadow): Use find_namespace_value.
2734 (set_local_extern_decl_linkage): Likewise.
2735 (do_pushdecl): Adjust for namespace slot.
2736 (push_local_binding): Assert not a namespace binding.
2737 (check_for_out_of_scope_variable): Use find_namespace_value.
2738 (set_identifier_type_value_with_scope): Likewise.
2739 (get_namespace_binding): Likewise.
2740 (set_namespace_binding): Delete.
2741 (set_global_binding): Directly update the binding.
2742 (finish_namespace_using_decl): Likewise.
2743 (lookup_type_scope_1): Use find_namespace_slot and update.
2744 (do_push_nested_namespace): Use find_namespace_value.
2747 * pt.c (most_specialized_instantiation): Cope with duplicate
2751 * cp-tree.h (build_min_nt_call_vec): Declare.
2752 * decl.c (build_offset_ref_call_from_tree): Call it.
2753 * parser.c (cp_parser_postfix_expression): Likewise.
2754 * pt.c (tsubst_copy_and_build): Likewise.
2755 * semantics.c (finish_call_expr): Likewise.
2756 * tree.c (build_min_nt_loc): Keep unresolved lookups.
2757 (build_min): Likewise.
2758 (build_min_non_dep): Likewise.
2759 (build_min_non_dep_call_vec): Likewise.
2760 (build_min_nt_call_vec): New.
2763 * tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP.
2765 (lookup_keep): Call it.
2767 2017-05-26 Nathan Sidwell <nathan@acm.org>
2770 * name-lookup.c (push_inline_namespaces): New.
2771 (push_namespace): Look inside inline namespaces.
2773 Inline and using namespace representation change.
2774 * cp-tree.h (struct lang_decl_ns): Delete ns_using. Add usings,
2776 (DECL_NAMESPACE_USING): Adjust.
2777 (DECL_NAMESPACE_INLINEES): New.
2778 * name-lookup.h (struct cp_binding_level): Change usings
2780 * name-lookup.c (name_lookup::do_queue_usings,
2781 name_lookup::queue_usings): Adjust.
2782 (name_lookup::search_namespace, name_lookup::search_usings,
2783 name_lookup::queue_namespace): Adjust.
2784 (name_lookup::adl_namespace_only): Adjust.
2785 (add_using_namespace, push_namespace): Push onto vector.
2786 (pop_namespace): Add timing logic.
2788 * call.c (build_operator_new_call): Do namelookup and ADL here.
2789 (build_new_op_1): Likewise.
2790 * name-lookup.h (lookup_function_nonclass): Delete declaration.
2791 (do_using_directive): Likewise.
2792 * name-lookup.c (set_namespace_binding, push_local_binding): Don't
2794 (struct scope_binding): Delete.
2795 (EMPTY_SCOPE_BINDING): Delete.
2796 (set_decl_namespace): Use OVL_P.
2797 (finish_local_using_decl): Lose unnecesary checks.
2798 (lookup_function_nonclass): Delete.
2799 (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
2801 * cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
2802 (ovl_iterator): Add allow_inner field. Adjust ctor. Make
2804 (ovl_iterator::maybe_push, ovl_iterator::pop): New.
2805 (lkp_iterator): Add outer field. Adjust ctor.
2806 (lkp_iterator::operator++): New.
2807 (lookup_mark, lookup_maybe_add): Declare.
2808 * name-lookup.c (name_lookup): Delete fn_set member.
2809 (name_lookup::preserve_state, name_lookup::restore_state): Unmark
2811 (name_lookup::add_value): Use lookup_add directly.
2812 (name_lookup::add_fns: Use lookup_maybe_add.
2813 (name_lookup::search_adl): Mark and unmark fns.
2815 * pt.c (check_explicit_specialization): Use lookup_add directly.
2816 * ptree.c (cxx_print_xnode): Show complete overload structure.
2817 * tree.c (lookup_mark, lookup_maybe_add): New.
2819 * name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args.
2821 2017-05-26 Jakub Jelinek <jakub@redhat.com>
2823 * cp-tree.h (struct lang_decl_decomp): New type.
2824 (struct lang_decl): Add u.decomp.
2825 (LANG_DECL_DECOMP_CHECK): Define.
2826 (DECL_DECOMPOSITION_P): Note it is set also on the vars
2827 for user identifiers.
2828 (DECL_DECOMP_BASE): Define.
2829 (retrofit_lang_decl): Add extra int = 0 argument.
2830 * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
2831 use it to influence the selector choices and for selector
2832 0 to non-zero transition copy old content.
2833 (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
2834 * decl.c (poplevel): For DECL_DECOMPOSITION_P, check
2835 !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning
2836 wording if decl is a structured binding.
2837 (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
2838 Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization
2839 of individual variables for tuple structured bindings.
2840 (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
2841 Clear DECL_DECOMP_BASE.
2842 * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
2843 * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
2845 * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
2848 2017-05-25 Jason Merrill <jason@redhat.com>
2850 PR c++/80605 - __is_standard_layout and zero-length array
2851 * class.c (check_bases): Use DECL_FIELD_IS_BASE.
2853 2017-05-25 Nathan Sidwell <nathan@acm.org>
2855 Kill OVL_CURRENT, OVL_NEXT.
2856 * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
2857 * name-lookup.c (set_decl_namespace): Use ovl_iterator.
2858 (consider_binding_level): Use OVL_FIRST.
2859 (cp_emit_debug_info_for_using): Use lkp_iterator.
2860 * pt.c (check_explicit_specialization): Use ovl_iterator.
2862 Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS.
2863 * cp-tree.h (lang_decl_ns): Remove ns_users field.
2864 (DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete.
2865 (TREE_INDIRECT_USING): Delete.
2866 * name-lookup.h (is_associated_namespace): Delete.
2867 * name-lookup.c (name_lookup::search_usings,
2868 name_lookup::do_queue_usings): Usings are always direct.
2869 (is_associated_namespace): Delete.
2870 (handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P.
2871 (namespace_ancestor_1, namespace_ancestor): Delete.
2872 (push_using_directive_1, push_using_directive): Delete.
2873 (add_using_namespace_1): Delete.
2874 (add_using_namespace): Reimplement.
2875 (emit_debug_info_using_namespace): New.
2876 (finish_namespace_using_directive, finish_local_using_directive,
2877 push_namespace): Adjust.
2878 * tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling.
2880 2017-05-25 Volker Reichelt <v.reichelt@netcologne.de>
2882 * semantics.c (finish_handler_parms): Warn about non-reference type
2885 2017-05-25 Nathan Sidwell <nathan@acm.org>
2887 Reimplement unqualified namespace lookup.
2888 * name-lookup.c (name_lookup::using_pair,
2889 name_lookup::using_queue): New typedefs.
2890 (name_lookup::queue_namespace, name_lookup::do_queue_usings,
2891 name_lookup::queue_usings): New.
2892 (name_lookup::search_unqualified): New.
2893 (merge_functions, same_entity_p, ambiguous_decl,
2894 unqualified_namespace_lookup_1, unqualified_namespace_lookup,
2895 lookup_using_namespace): Delete.
2896 (lookup_name_real_1): Adjust.
2898 Reimplement qualified namespace lookup.
2899 * name-lookup.c (name_lookup::flags): New member. Adjust ctor.
2900 (name_lookup::ambiguous, name_lookup::add_value,
2901 name_lookup::add_type, name_lookup::process_binding): New.
2902 (name_lookup::search_namespace_only,
2903 name_lookup::search_namespace, name_lookup::search_usings): New.
2904 (name_lookup::search_qualified): New.
2905 (do_nonmember_using_decl, suggest_alternatives_for,
2906 lookup_qualified_name): Adjust.
2907 (tree_vec_contains): Delete.
2908 (qualified_lookup_using_namespace): Rename to ...
2909 (qualified_namespace_lookup): ... here. Reimplement.
2912 * cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New.
2913 * name-lookup.h (lookup_arg_dependent): Return plain tree.
2914 * name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args,
2915 arg_assoc_args_vec, arg_assoc_type, add_function,
2916 arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases,
2917 arg_assoc_class, arg_assoc_template_arg, arg_assoc,
2918 lookup_arg_dependent_1): Delete.
2919 (name_lookup): New lookup object.
2920 (name_lookup::preserve_state, name_lookup::restore_state,
2921 name_lookup::mark_seen, name_lookup::find_and_mark,
2922 name_lookup::add_fns, name_lookup::adl_namespace_only,
2923 name_lookup::adl_namespace, name_lookup::adl_class_only,
2924 name_lookup::adl_bases, name_lookup::adl_class,
2925 name_lookup::adl_expr, name_lookup::adl_type,
2926 name_lookup::adl_template_arg, name_lookup::search_adl): New.
2927 (lookup_arg_dependent): Return a plain tree. Adjust.
2928 (is_associated_namespace): Move later.
2930 2017-05-24 Nathan Sidwell <nathan@acm.org>
2932 * friend.c (do_friend): Remove check for existing decl.
2933 * name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
2934 * name-lookup.c (push_local_binding): Directly look for binding.
2935 (lookup_name_innermost_nonclass_level_1): Delete.
2936 (lookup_name_innermost_nonclass_level): Delete.
2938 * Make-lang.in (CXX_AND_OBJCXX_OBJS): Alphabetize.
2940 * cp-tree.h (cp_free_lang_data): Add extern.
2941 (ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
2943 (type_unknown_p): Return bool, make inline, lose TREE_LIST check.
2944 * typeck.c (type_unknown_p): Delete.
2945 * tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
2946 overload management.
2947 (dependent_name): Likewise.
2948 (decl_anon_ns_mem_p): Simplify.
2950 2017-05-24 Jonathan Wakely <jwakely@redhat.com>
2953 * tree.c (reshape_init): Use unqualified type for direct enum init.
2954 * typeck.c (maybe_warn_about_cast_ignoring_quals): New.
2955 (build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
2956 non-class destination types.
2957 (build_const_cast_1): Strip cv-quals from destination types.
2958 (build_static_cast, build_reinterpret_cast, build_const_cast)
2959 (cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.
2961 2017-05-24 Martin Sebor <msebor@redhat.com>
2964 * call.c (fully_fold_internal): Adjust.
2966 2017-05-24 Nathan Sidwell <nathan@acm.org>
2968 * cp-tree.h (ovl_skip_hidden): Declare.
2969 * tree.c (ovl_skip_hidden): New.
2970 * name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden.
2971 (lookup_arg_dependent_1): Likewise.
2972 (ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden.
2973 (hidden_name_p, remove_hidden_names): Delete.
2974 (lookup_name_real_1): Do not strip hidden names.
2975 * name-lookup.h (hidden_name_p, remove_hidden_names): Delete.
2977 * cp-tree.h (OVL_HIDDEN_P): New.
2978 (ovl_iterator::hidden_p, ovl_iterator::reveal_node): New.
2979 (ovl_iterator::reveal_node): Declare.
2980 * tree.c (ovl_copy): Copy OVL_HIDDEN_P.
2981 (ovl_insert): Order on hiddenness.
2982 (ovl_iterator::reveal_node): New.
2983 * name-lookup.c (anticipated_builtin_p): New.
2984 (supplement_binding_1): Use it.
2985 (set_local_extern_decl_linkage): Use hidden_p.
2986 (do_pushdecl): Deal with unhiding a hidden decl, use
2987 anticipated_builtin_p.
2988 (do_nonmember_using_decl): Use anticipated_decl_p.
2989 (lookup_name_real_1): Use DECL_HIDDEN_P.
2991 2017-05-23 Jason Merrill <jason@redhat.com>
2993 -Wunused and C++17 structured bindings
2994 * decl.c (poplevel): Don't warn about unused structured bindings,
2995 only real variables.
2996 * error.c (dump_simple_decl): Handle structured bindings.
2997 * expr.c (mark_exp_read): Look through DECL_VALUE_EXPR.
2999 2017-05-23 Nathan Sidwell <nathan@acm.org>
3001 * cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
3002 * name-lookup.c (create_local_binding): New.
3003 (update_binding): New.
3004 (pushdecl_maybe_friend_1): Rename to ...
3005 (do_pushdecl): ... this. Reimplement.
3007 (push_overloaded_decl_1, push_overloaded_decl): Delete.
3009 2017-05-23 Jason Merrill <jason@redhat.com>
3011 PR c++/80396 - built-in for make_integer_sequence.
3012 * pt.c (builtin_pack_fn_p, builtin_pack_call_p)
3013 (expand_integer_pack, expand_builtin_pack_call): New.
3014 (find_parameter_packs_r): Check builtin_pack_call_p.
3015 (check_for_bare_parameter_packs): Handle it.
3016 (tsubst_pack_expansion): Call expand_builtin_pack_call.
3017 (declare_integer_pack): New.
3018 (init_template_processing): Call it.
3019 * decl2.c (mark_used): Check builtin_pack_fn_p.
3021 2017-05-23 Nathan Sidwell <nathan@acm.org>
3023 * name-lookup.c (find_namespace_binding): New.
3024 (pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT.
3025 (set_identifier_type_value_with_scope): Use find_namespace_binding.
3026 (find_binding, cp_binding_level_find_binding_for_name,
3027 binding_for_name, namespace_binding_1): Delete.
3028 (push_overloaded_decl_1): Use CP_DECL_CONTEXT.
3029 (get_namespace_binding, set_namespace_binding,
3030 finish_namespace_using_decl, unqualified_namespace_lookup_1,
3031 qualified_lookup_using_namespace, lookup_type_scope_1,
3032 lookup_name_innermost_nonclass_level_1): Use find_namespace_binding.
3035 * parser.c (cp_parser_template_id): Keep the lookup when stashing
3038 * cp-tree.h (DECL_HIDDEN_P): New.
3039 * name-lookup.c (set_decl_context,
3040 set_local_extern_decl_linkage): New, broken out of ...
3041 (pushdecl_maybe_friend_1): ... here. Call them.
3043 2017-05-23 Thomas Schwinge <thomas@codesourcery.com>
3045 * parser.c (OACC_KERNELS_CLAUSE_MASK): Add
3046 "PRAGMA_OACC_CLAUSE_NUM_GANGS", "PRAGMA_OACC_CLAUSE_NUM_WORKERS",
3049 2017-05-23 Nathan Sidwell <nathan@acm.org>
3051 * cp-tree.h (OVL_P): New.
3052 * name-lookup.h (push_local_binding): Delete.
3053 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3054 (finish_namespace_using_decl, finish_local_using_decl): ... here
3055 * name-lookup.c (add_decl_to_level): Swap args.
3056 (pop_bindings_and_leave_scope): Look inside TREE_LIST.
3057 (diagnose_name_conflict): Check contexts are same for redecl.
3058 (update_local_overload): New.
3059 (compparms_for_decl_and_using): Rename to ...
3060 (matching_fn_p): ... here.
3061 (pushdecl_maybe_friend_1): Adjust add_decl_to_level,
3062 push_local_bindings call.
3063 (push_local_binding): Make static, replace FLAGS arg with
3065 (validate_nonmember_using_decl): Use OVL_FIRST.
3066 (do_nonmember_using_decl): Use in/out parameters. Use
3067 lkp_iterator and simplify.
3068 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3069 (finish_namespace_using_decl, finish_local_using_decl): ... here.
3071 (lookup_type_current_level): Delete.
3072 * parser.c (cp_parser_using_declaration): Adjust.
3073 * pt.c (tsubst_expr): Adjust.
3075 2017-05-22 Nathan Sidwell <nathan@acm.org>
3077 * name-lookup.h (parse_using_directive): Replace with ...
3078 (finish_namespace_using_directive): ... this and ...
3079 (finish_local_using_directive): ... this.
3080 * name-lookup.c (add_using_namespace_1): Move later.
3081 (add_using_namespace): Move later, add namespace_p arg, remove
3083 (push_using_directive_1): Directly recurse.
3084 (do_using_directive, parse_using_directive): Delete, split into ...
3085 (finish_namespace_using_directive): ... this and ...
3086 (finish_local_using_directive): ... this.
3087 (push_namespace): Use add_using_namespace.
3088 * parser.c (cp_parser_using_directive): Call
3089 finish_namespace_using_directive or finish_local_using_directive.
3090 * pt.c (tsubst_expr): Call finish_local_using_directive.
3092 * cp-objcp-common.c (cp_register_dumps): Register raw dumper.
3093 * cp-tree.h (raw_dump_id): Declare.
3094 * decl2.c (raw_dump_id): Define.
3095 (dump_tu): Use raw_dump_id.
3097 * config-lang.in (gtfiles): Sort list, break lines.
3099 * cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
3100 (CPTI_TERMINATE_FN, CPTI_CALL_UNEXPECTED_FN): ... here.
3101 ( CPTI_GET_EXCEPTION_PTR_FN, CPTI_BEGIN_CATCH_FN, CPTI_END_CATCH_FN,
3102 CPTI_ALLOCATE_EXCEPTION_FN, CPTI_FREE_EXCEPTION_FN, CPTI_THROW_FN,
3103 CPTI_RETHROW_FN): New.
3104 (noexcept_deferred_spec): New.
3105 (terminate_node, call_unexpected_node): Rename to ...
3106 (terminate_fn, call_unexpected_fn): ... here.
3107 (get_exception_ptr_fn, begin_catch_fn, end_catch_fn,
3108 allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New.
3109 * except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete.
3110 (init_exception_processing): Adjust.
3111 (declare_library_fn): Create and push the fns here.
3112 (do_get_exception_ptr, do_begin_catch, do_end_catch,
3113 do_allocate_exception_ptr, do_free_exception_ptr): Adjust
3114 declare_library_fn use.
3115 (unevaluated_noexcept_spec): Adjust.
3116 * cp-gimplify.c (genericize_eh_spec_block,
3117 gimplify_most_not_throw_expr): Adjust.
3119 * name-lookup.c (pushdecl_top_level,
3120 pushdecl_top_level_and_finish): Move after namespace pushing and
3122 (push_to_top_level): Rename to ...
3123 (do_push_to_top_level): ... here. Remove timing code.
3124 (pop_from_top_level_1): Rename to ...
3125 (do_pop_from_top_level): ... here.
3126 (do_push_nested_namespace, do_pop_nested_namespace)
3127 (push_to_top_level): New wrapper for do_push_to_top_level.
3128 (pop_from_top_level): Adjust.
3129 (push_nested_namepace, pop_nested_namespace): Wrappers for workers.
3131 2017-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
3133 * config-lang.in (gtfiles): Add c-family/c-format.c,
3134 except.c, init.c, lambda.c and friend.c.
3135 * class.c (dvirt_fn): Move out of function scope,
3137 * except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise.
3138 * init.c (fn): Likewise.
3139 * lambda.c (ptr_id, max_id): Likewise.
3140 * friend.c (global_friend): Add GTY attribute.
3142 2017-05-19 Nathan Sidwell <nathan@acm.org>
3144 * call.c (add_list_candidates): Use OVL_FIRST.
3145 (build_new_method_call_1): Likewise.
3146 * cp-tree.h (OVL_SINGLE_P): New.
3147 (TYPE_HIDDEN_P): New.
3148 * decl.c (xref_tag_1): Use TYPE_HIDDEN_P.
3149 * dump.c (cp_tump_tree): Adjust overload dumping.
3150 * error.c (dump_decl): Use OVL_SINGLE_P, simplify context
3152 * method.c (lazily_declare_fn): Assert we added it.
3153 * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
3155 (cp_parser_template_name): Use lkp_iterator.
3156 * pt.c (begin_template_parm_list): Fixup comment.
3157 (instantiate_class_template_1): Use TYPE_HIDDEN_P.
3158 * tree.c (ovl_iterator::remove_node): Cope with inherited ctors.
3159 (ovl_scope): Use lkp_iterator.
3161 2017-05-19 Thomas Schwinge <thomas@codesourcery.com>
3163 * parser.c (cp_parser_omp_clause_default): Handle
3164 "OMP_CLAUSE_DEFAULT_PRESENT".
3166 * parser.c (cp_parser_omp_clause_default): Avoid printing more
3167 than one syntax error message.
3169 2017-05-19 Nathan Sidwell <nathan@acm.org>
3171 * class.c (class_dump_id): Define.
3172 (dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
3173 * cp-objcp-common.c (cp_register_dumps): New.
3174 * cp-objcp-common.h (cp_register_dumps): Declare.
3175 (LANG_HOOKS_REGISTER_DUMPS): Override.
3176 * cp-tree.h (class_dump_id): Declare.
3178 2017-05-18 Nathan Sidwell <nathan@acm.org>
3180 * cp-tree.h (OVL_ARG_DEPENDENT): Delete.
3182 (lookup_keep): Declare.
3183 * name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT.
3184 * pt.c (tsubst_copy): Assert lookup is persistent.
3185 * semantics.c (finish_call_expr): Use lkp_iterator, call
3187 * tree.c (ovl_copy): New.
3188 (ovl_insert, ovl_iterator::remove_node): Copy immutable nodes.
3191 * cp-tree.h (OVL_USED): Replace with ...
3192 (OVL_USING_P): ... this.
3193 (ovl_iterator::using_p): Adjust.
3194 * name-lookup.c (push_overloaded_decl_1,
3195 do_nonmember_using_decl): Adjust.
3196 * search.c (lookup_field_r): Adjust.
3197 * tree.c (ovl_insert, ovl_scope): Adjust.
3199 * cp-tree.h (lookup_add): Swap args.
3200 (ovl_cons, build_overload): Delete.
3201 * name-lookup.c (add_function, push_overloaded_decl_1,
3202 do_nonmember_using_decl, merge_functions, remove_hidden_names):
3203 Use lookup_add, ovl_insert.
3204 * pt.c (check_explicit_specialization): Use lookup_add.
3205 (do_class_deduction): Likewise. Refactor if.
3206 * tree.c (lookup_add): Swap args.
3207 (ovl_cons, build_overload): Delete.
3209 * name-lookup.c (find_local_binding): New, broken out of ...
3210 (lookup_name_innermost_nonclass_level_1): ... here. Call it.
3211 (set_namespace_binding): Swap scope & name args.
3212 (namespace_binding_1): Likewise.
3213 (pushdecl_maybe_friend_1): Adjust set_namespace_binding call.
3214 (push_overloaded_decl_1): Likewise.
3215 (set_global_binding): Likewise.
3216 (get_namespace_binding): Adjust namespace_binding_1 call.
3218 2017-05-17 Nathan Sidwell <nathan@acm.org>
3220 * cp-tree.h (default_hash_traits <lang_identifier *>): New
3222 * name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete.
3223 (extern_c_fns): New hash table.
3224 (check_extern_c_conflict): New, broken out of ...
3225 (pushdecl_maybe_friend_1): ... here. Call it.
3226 (c_linkage_bindings): Just look in hash table.
3228 2017-05-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3232 Implement new C++ intrinsics __is_assignable and __is_constructible.
3233 * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
3235 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3236 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3237 * method.c (constructible_expr): Set cp_unevaluated.
3238 (is_xible_helper): New.
3239 (is_trivially_xible): Adjust.
3241 * parser.c (cp_parser_primary_expression): Handle
3242 RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
3243 (cp_parser_trait_expr): Likewise.
3244 * semantics.c (trait_expr_value): Handle
3245 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3247 2017-05-17 Nathan Sidwell <nathan@acm.org>
3249 * cp-tree.h (ovl_iterator::using_p): New predicate.
3250 (ovl_iterator::remove_node): New worker.
3251 (ovl_insert): Declare.
3252 * tree.c (ovl_insert): New.
3253 (ovl_iterator::remove_node): New.
3254 * class.c (add_method): Use ovl_iterator, ovl_insert.
3255 (clone_function_decl): Fix description.
3256 (clone_constructors_and_destructors): Use ovl_iterator.
3258 * class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator.
3259 (maybe_warn_about_overly_private_class): Use ovl_iterator.
3260 (method_name_cmp, resort_method_name_cmp): Use OVL_NAME.
3261 (resort_type_method_vec, finish_struct_methods): Use OVL_FIRST.
3262 (get_base_fndecls): Use ovl_iterator.
3263 (warn_hidden): Use OVL_NAME, ovl_iterator.
3264 (add_implicitly_declared_members): Use ovl_iterator.
3265 * constraint.cc (normalize_template_id_expression): Use OVL_FIRST,
3267 (finish_shorthand_constraint): Simplify, use ovl_make.
3268 * pt.c (make_constrained_auto): Simplify. Use ovl_make.
3269 * search.c (shared_member_p): Use ovl_iterator.
3270 (lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME.
3271 (lookup_conversion_operator): Use OVL_FIRST.
3272 (lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME.
3273 (look_for_overrides_here): Use ovl_iterator.
3274 (lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator.
3275 * typeck.c (build_x_unary_op): Use ovl_make.
3277 2017-05-17 Martin Liska <mliska@suse.cz>
3279 * class.c (dump_class_hierarchy): Introduce dump_flags_t type and
3280 use it instead of int type.
3281 (dump_vtable): Likewise.
3282 (dump_vtt): Likewise.
3283 * decl2.c (dump_tu): Likewise.
3285 2017-05-16 David Malcolm <dmalcolm@redhat.com>
3287 * call.c (enforce_access): Add access_failure_info * param and use
3288 it to record access failures.
3289 * cp-tree.h (class access_failure_info): New class.
3290 (enforce_access): Add access_failure_info * param, defaulting to
3292 (lookup_member): Likewise.
3293 (locate_field_accessor): New function decl.
3294 (perform_or_defer_access_check): Add access_failure_info * param,
3296 * search.c (lookup_member): Add access_failure_info * param and
3297 pass it on to call to perform_or_defer_access_check.
3298 (matches_code_and_type_p): New function.
3299 (field_access_p): New function.
3300 (direct_accessor_p): New function.
3301 (reference_accessor_p): New function.
3302 (field_accessor_p): New function.
3303 (struct locate_field_data): New struct.
3304 (dfs_locate_field_accessor_pre): New function.
3305 (locate_field_accessor): New function.
3306 * semantics.c (perform_or_defer_access_check): Add
3307 access_failure_info * param, and pass it on to call to
3309 * typeck.c (access_failure_info::record_access_failure): New method.
3310 (access_failure_info::maybe_suggest_accessor): New method.
3311 (finish_class_member_access_expr): Pass an access_failure_info
3312 instance to the lookup_member call, and call its
3313 maybe_suggest_accessor method afterwards.
3315 2017-05-16 Marek Polacek <polacek@redhat.com>
3319 * cp-gimplify.c (cp_fold): Handle SAVE_EXPR.
3321 2017-05-16 Nathan Sidwell <nathan@acm.org>
3323 * name-lookup.c (check_local_shadow): New, broke out of ...
3324 (pushdecl_maybe_friend_1): ... here. Call it.
3326 * cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New.
3327 (ovl_first): Move inline definition to end of file.
3328 (ovl_make, lookup_add): Declare.
3329 (get_fns, get_first_fn): Make pure.
3330 * tree.c (ovl_cache): New.
3331 (ovl_make, lookup_add): New.
3332 * pt.c (do_class_deduction): Don't add candidates that will be
3335 * call.c (build_user_type_conversion_1): Use OVL_FIRST.
3336 (print_error_for_call_failure): Use OVL_NAME.
3337 (build_op_call_1): Use ovl_iterator.
3338 (add_candidates): Use OVL_FIRST & lkp_iterator.
3339 (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
3341 * class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
3342 (type_has_user_nondefault_constructor,
3343 in_class_defaulted_default_constructor,
3344 type_has_user_provided_constructor,
3345 type_has_user_provided_or_explicit_constructor,
3346 type_has_non_user_provided_default_constructor,
3347 vbase_has_user_provided_move_assign,
3348 type_has_move_constructor, type_has_move_assign,
3349 type_has_user_declared_move_constructor,
3350 type_has_user_declared_move_assign,
3351 type_build_ctor_call, type_build_dtor_call,
3352 type_requires_array_cookie, explain_non_literal_class): Likewise.
3353 (finish_struct): Use lkp_iterator.
3354 (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
3355 (note_name_declared_in_class): Use OVL_NAME.
3356 * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
3357 (pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
3358 cxx_pretty_printer::expression): Likewise.
3359 * decl2.c (check_classfn): Use ovl_iterator.
3360 * pt.c (retrieve_specialization): Use ovl_iterator.
3361 * tree.c (cp_tree_equal): Use lkp_iterator.
3362 (type_has_nontrivial_copy_init): Use ovl_iterator.
3364 * typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
3365 check is_overloaded_fn.
3367 2017-05-16 Martin Liska <mliska@suse.cz>
3369 * parser.c (cp_lexer_print_token): Add default value for flags
3370 argument of print_gimple_stmt, print_gimple_expr,
3371 print_generic_stmt and print_generic_expr.
3373 2017-05-16 Nathan Sidwell <nathan@acm.org>
3375 * cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD
3377 (MAYBE_BASELINK_FUNCTIONS): New.
3378 * constraint.cc (resolve_constraint_check): Use lkp_iterator.
3379 * decl2.c (maybe_warn_sized_delete): Use ovl_iterator.
3380 * lambda.c (maybe_generic_this_capture): Use lkp_iterator.
3381 * method.c (inherited_ctor_binfo): Use ovl_iterator.
3382 (binfo_inherited_from): Likewise.
3383 * parser.c (lookup_literal_operator): Use lkp_iterator.
3384 * pt.c (iterative_hash_template_arg): Use lkp_iterator.
3385 (print_candidates_1): Likewise.
3386 (determine_specialization): Likewise.
3387 (resolve_overloaded_unification): Likewise.
3388 (resolve_nondeduced_context): Likewise.
3389 (type_dependent_expression_p): Likewise.
3390 (dependent_template_p): Likewise.
3391 * ptree.c (cxx_print_xnode): Likewise.
3392 * semantics.c (omp_reduction_lookup): Use lkp_iterator.
3393 (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator.
3394 * typeck.c (check_template_keyword): Use lkp_iterator.
3396 * cp-tree.h (OVL_FIRST, OVL_NAME): New.
3398 * constexpr.c (function_concept_check): Use OVL_FIRST.
3399 * cvt.c (build_expr_type_conversion): Likewise.
3400 * decl.c (poplevel, grokdeclarator): Use OVL_NAME.
3401 * decl2.c (mark_used): Use OVL_FIRST.
3402 * error.c (dump_decl): Use OVL_FIRST, OVL_NAME.
3403 (dump_expr, location_of): Use OVL_FIRST.
3404 * friend.c (do_friend): Use OVL_NAME.
3405 * init.c (build_offset_ref): Use OVL_FIRST.
3406 * mangle.c (write_member_name): Likewise.
3407 (write_expression): Use OVL_NAME.
3408 * method.c (strip_inheriting_ctors): Use OVL_FIRST.
3409 * name-lookup.c (pushdecl_class_level): Use OVL_NAME.
3410 * pt.c (check_explicit_specialization): Use OVL_FIRST.
3411 (check_template_shadow): Likewise.
3412 (tsubst_template_args): Use OVL_NAME.
3413 (tsubst_baselink): Use OVL_FIRST.
3414 * semantics.c (perform_koenig_lookup): Use OVL_NAME.
3415 * tree.c (get_first_fn): Use OVL_FIRST.
3416 * typeck.c (finish_class_member_access_expr): Use OVL_NAME.
3417 (cp_build_addr_expr_1): Use OVL_FIRST.
3419 * pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF
3421 * semantics.c (finish_id_expression): Directly init local var.
3422 (finish_omp_reduction_clause): Use really_overloaded_fn.
3423 * tree.c (get_fns): Document. Assert we got an overload.
3424 (get_first_fn) Document.
3425 * typeck.c (cp_build_addr_expr_1): Pass arg directly to
3426 really_overloaded_fn.
3427 * typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly.
3429 * cp-tree.h (SCOPE_DEPTH): New.
3430 * name-lookup.h (is_nested_namespace): Declare.
3431 * name-lookup.c (is_nested_namespace): New.
3432 (is_ancestor): Use it.
3433 (set_decl_namespace): Likewise.
3434 (push_namespace): Set SCOPE_DEPTH.
3435 * pt.c (check_specialization_namespace): Use is_nested_namespace.
3436 (check_unqualigied_spec_or_inst): Likewise.
3438 2017-05-15 Nathan Sidwell <nathan@acm.org>
3441 * cp-tree.h (DECL_NAMESPACE_INLINE_P): New.
3442 * name-lookup.h (push_namespace): Return int, add make_inline arg.
3443 * name-lookup.c (push_namespace): Deal with inline directly.
3444 Return pushed count.
3445 * parser.c (cp_parser_namespace_definition): Adjust for
3446 push_namespace change.
3448 2017-05-11 Nathan Sidwell <nathan@acm.org>
3450 * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS,
3451 LANG_HOOKS_PUSHDECL): Move to ...
3452 * cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
3453 LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here.
3454 * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare.
3456 * name-lookup.h (pushdecl): Add default friend parm.
3457 (pushdecl_maybe_friend): Delete.
3458 (pushdecl_top_level): Add default friend parm.
3459 (pushdecl_top_level_maybe_friend): Delete.
3460 * name-lookup.c (pushdecl_maybe_friend): Delete.
3461 (pushdecl): Add is_friend parm.
3462 (pushdecl_top_level): Add is friend_parm.
3463 (pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete.
3464 (pushdecl_top_level_and_finish): Do pushing and finishing directly.
3465 * friend.c (do_friend): Adjust.
3466 * pt.c (tsubst_friend_class): Adjust.
3468 Revert pushdecl_top_level_and_finish name change.
3469 * name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name.
3470 * name-lookup.c (pushdecl_top_level_and_finish): Likewise.
3471 * decl.c (cp_make_fname_decl): Adjust.
3472 * decl2.c (get_guard, handle_tls_init): Adjust.
3473 * rtti.c (get_tinfo_decl, tinfo_base_init): Adjust.
3475 * name-lookup.c (pushdecl_outermost_localscope): Always
3476 conditionally stop timer.
3478 * decl.c (xref_tag_1): Don't frob ts_lambda scope here.
3479 * name-lookup.c (pushtag_1): Deal with ts_lambda scope.
3481 * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag,
3482 pushtag_top_level_maybe_friend,
3483 pushdecl_top_level_and_finish): Move declarations to ...
3484 * name-lookup.h: ... here. Group pushdecl variants.
3485 (pushdecl_top_level_and_finish): Rename to ...
3486 (pushdecl_top_level_with_init): ... here.
3487 * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init.
3488 * decl2.c (get_guard, handle_tls_init): Likewise.
3489 * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
3490 * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
3491 * method.c (implicitly_declare_fn): Likewise.
3492 * searchc (node_debug_info_needed): Likewise.
3493 * name-lookup.c (pushdecl_top_level_and_finish): Rename to ...
3494 (pushdecl_top_level_with_init): ... here.
3495 (pop_everything): Use namespace_bindings_p.
3497 * name-lookup.h (pop_binding): Rename to pop_local_binding.
3498 (getdecls): Rename to get_local_decls.
3499 * name-lookup.c (pop_binding): Rename to ...
3500 (pop_local_binding): ... here.
3501 (pop_bindings_and_leave_scope): Adjust.
3502 (getdecls): Rename to ...
3503 (get_local_decls): ... here. Assert local scope.
3504 * decl.c (poplevel): Assert not namespace. Adjust and simplify
3506 (store_parm_decls): Adjust get_local_decls call.
3507 (parser.c (synthesize_implicit_template_parm): Likewise.
3509 2017-05-11 Ville Voutilainen <ville.voutilainen@gmail.com>
3512 * method.c (is_trivially_xible): Reject void types.
3514 2017-05-10 Nathan Sidwell <nathan@acm.org>
3516 * class.c (handle_using_decl): Always use OVL_CURRENT.
3517 (resolve_address_of_overloaded_function): Move iterator decl into
3518 for scope. Don't strip anticipated decls here.
3520 * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
3522 (print_candidates): Adjust.
3524 * cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix
3526 * call.c (build_new_function_call): Lose koenig_p arg. Remove
3527 koenig_p handling here.
3528 * pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
3529 (tsubst_omp_clauses): Likewise.
3530 (do_class_deduction): Adjust buld_new_function_call calls.
3531 * semantics.c (finish_call_expr): Likewise.
3533 2017-05-10 Jason Merrill <jason@redhat.com>
3535 * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
3536 (unify_type_mismatch, unify_parameter_pack_mismatch)
3537 (unify_ptrmem_cst_mismatch, unify_expression_unequal)
3538 (unify_parameter_pack_inconsistent, unify_inconsistency)
3539 (unify_vla_arg, unify_method_type_error, unify_arity)
3540 (unify_arg_conversion, unify_no_common_base)
3541 (unify_inconsistent_template_template_parameters)
3542 (unify_template_deduction_failure)
3543 (unify_template_argument_mismatch)
3544 (unify_overload_resolution_failure): Call unify_invalid.
3546 CWG 1847 - Clarifying compatibility during partial ordering
3547 * pt.c (more_specialized_fn): No order between two non-deducible
3550 * pt.c (dependent_type_p): Make sure we aren't called with
3553 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
3554 * pt.c (convert_template_argument): Just return an argument pack.
3555 (coerce_template_parameter_pack, template_parm_to_arg)
3556 (extract_fnparm_pack, make_argument_pack, tsubst_template_args)
3557 (tsubst_decl, tsubst, type_unification_real, unify_pack_expansion):
3558 Don't set the type of a NONTYPE_ARGUMENT_PACK.
3559 * parser.c (make_char_string_pack, make_string_pack): Likewise.
3561 2017-05-10 Nathan Sidwell <nathan@acm.org>
3563 * cp-tree.h (add_method, clone_function_decl): Change last arg to
3565 * class.c (add_method): Change third arg to bool. Adjust.
3566 (one_inheriting_sig, one_inherited_ctor): Adjust.
3567 (clone_function_decl): Change 2nd arg to bool. Adjust.
3568 (clone_constructors_and_destructors): Adjust.
3569 * lambda.c (maybe_add_lambda_conv_op): Adjust.
3570 * method.c (lazily_declare_fn): Adjust.
3571 * pt.c (tsubst_decl, instantiate_template_1): Adjust.
3572 * semantics.c (finish_member_declaration): Adjust.
3574 2017-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3577 * decl.c (finish_function): To improve error recovery, change the
3578 logic for calling apply_deduced_return_type.
3580 2017-05-09 Jason Merrill <jason@redhat.com>
3582 PR c++/80605 - __is_standard_layout and empty base
3583 * class.c (check_bases): Ignore empty bases.
3585 PR c++/70979 - literal class and closure types
3586 * class.c (finalize_literal_type_property): Handle closures
3588 (explain_non_literal_class): Likewise.
3590 PR c++/66297, DR 1684 - literal class and constexpr member fns
3591 * constexpr.c (is_valid_constexpr_fn): Only complain about
3592 non-literal enclosing class in C++11.
3593 * class.c (finalize_literal_type_property): Likewise.
3595 2017-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3598 * pt.c (tsubst_decl): Early return error_mark_node if
3599 grok_ctor_properties returns false.
3601 2017-05-09 Jason Merrill <jason@redhat.com>
3603 PR c++/70167 - array prvalue treated as lvalue
3604 * cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New.
3606 * semantics.c (finish_compound_literal): Add fcl_context parameter.
3607 Only make a static variable for C99 syntax.
3608 * parser.c (cp_parser_postfix_expression): Pass it.
3609 * pt.c (tsubst_copy_and_build): Likewise.
3610 * call.c (extend_ref_init_temps): Set
3611 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
3613 2017-05-09 Nathan Sidwell <nathan@acm.org>
3615 * cp-lang.c (get_global_decls, cxx_pushdecl): New.
3616 (LANG_HOOKS_GETDECLS, LANG_HOOKS_PUSHDECL): Override.
3617 * name-lookup.h (pushdecl_top_level): Declare.
3619 2017-05-08 Jason Merrill <jason@redhat.com>
3621 PR c++/80178 - parameter passing for uncopyable classes
3622 * tree.c (type_has_nontrivial_copy_init): True for classes with only
3623 deleted copy/move ctors.
3624 (remember_deleted_copy, maybe_warn_parm_abi): New.
3625 * decl.c (require_complete_types_for_parms, check_function_type):
3626 Call maybe_warn_parm_abi.
3627 * call.c (convert_for_arg_passing, build_cxx_call): Likewise.
3629 2017-05-08 Nathan Sidwell <nathan@acm.org>
3631 * decl.c (builtin_function_1): Set DECL_ANTICIPATED before pushing.
3632 (start_preparsed_function): Do decl pushing before setting
3633 current_funciton_decl and announcing it.
3635 * name-lookup.h (pushdecl_with_scope): Replace with ...
3636 (pushdecl_outermost_localscope): ... this.
3637 * name-lookup.c (pushdecl_with_scope): Replace with ...
3638 (pushdecl_outermost_localscope): ... this.
3639 (pushdecl_namespace_level): Adjust.
3640 * decl.c (cp_make_fname_decl): Use pushdecl_outermost_localscope.
3641 * lambda.c (insert_capture_proxy): Likewise.
3643 * class.c (build_vtbl_initializer): Don't shadow outer variable
3646 Revert _binding -> _value change.
3647 * name-lookup.h (get_namespace_value, set_global_value): Rename to ...
3648 (get_namespace_binding, set_global_binding): ... these.
3649 * name-lookup.c (get_namespace_value, set_global_value): Rename to ...
3650 (get_namespace_binding, set_global_binding): ... these.
3651 (arg_assoc_namespace, pushdecl_maybe_friend_1,
3652 check_for_out_of_scope_variable, push_overloaded_decl_1,
3653 lookup_name_innermost_nonclass_level, push_namespace): Adjust.
3654 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
3655 SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
3656 * decl.c (poplevel): Adjust.
3657 * pt.c (make_constrained_auto): Likewise.
3659 2017-05-07 Volker Reichelt <v.reichelt@netcologne.de>
3661 PR translation/80280
3662 * call.c (print_z_candidate): Fix quoting.
3664 2017-05-05 David Malcolm <dmalcolm@redhat.com>
3666 * error.c (pedwarn_cxx98): Replace report_diagnostic
3667 with diagnostic_report_diagnostic.
3669 2017-05-05 Nathan Sidwell <nathan@acm.org>
3671 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
3672 (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value.
3673 (IDENTIFIER_NAMESPACE_VALUE): Delete.
3674 * name-lookup.h (namespace_binding, set_namespace_binding): Replace
3676 (get_namespace_value, set_global_value): ... these.
3677 (get_global_value_if_present, is_typename_at_global_scope): Delete.
3678 * decl.c (poplevel): Use get_namespace_value.
3679 (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE.
3680 * class.c (build_vtbl_initializer): Stash library decl in
3681 static var. Use IDENTIFIER_GLOBAL_VALUE.
3682 * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
3683 do_allocate_exception, do_free_exception, build_throw): Likewise.
3684 * init.c (throw_bad_array_new_length): Likewise.
3685 * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise.
3686 * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1,
3687 check_for_our_of_scope_variable, push_overloaded_decl_1): Use
3688 get_namespace_value.
3689 (set_namespace_binding_1): Rename to
3690 (set_namespace_binding): ... here.
3691 (set_global_value): New.
3692 (lookup_name_innermost_nonclass_level_1, push_namespace): Use
3693 get_namespace_value.
3694 * pt.c (listify): Use get_namespace_value.
3696 * call.c (make_temporary_var_for_ref_to_temp): Push decl into
3698 * lex.c (unqualified_name_lookup_error): Likewise.
3700 * class.c (alter_class): Use retrofit_lang_decl directly.
3701 * decl.c (push_local_name, dupliate_decls): Likewise.
3702 * semantics.c (omp_privatize_field): Likewise.
3704 Kill walk_namespaces.
3705 * cp-tree.h (walk_namespaces_fn, walk_namespaces): Delete.
3706 * decl.c (walk_namespaces_r, walk_namespaces): Delete.
3708 Kill per-namespace static_decls.
3709 * cp-tree.h (static_decls): Declare.
3710 (wrapup_globals_for_namespace,
3711 diagnose_inline_vars_for_namespace): Replace with ...
3712 (wrapup_namespace_globals): ... this.
3713 * decl.c (static_decls): Define.
3714 (wrapup_globals_for_namespace,
3715 diagnose_inline_vars_for_namespace): Replace with ...
3716 (wrapup_namespace_globals): ... this.
3717 (cxx_init_decl_processing): Initialize static_decls.
3718 * decl2.c (c_parse_final_cleanups): Adjust.
3719 * name-lookup.h (cp_binding_level): Remove static_decls member.
3720 * name-lookup.c (add_decl_to_level): Adjust.
3721 (begin_scope): Adjust.
3723 2017-05-05 Paolo Carlini <paolo.carlini@oracle.com>
3726 * decl.c (reshape_init): Unconditionally return error_mark_node
3727 upon error about too many initializers.
3729 2017-05-04 Nathan Sidwell <nathan@acm.org>
3731 * constraint.cc (diagnose_check_constraint): Fix %E thinko.
3733 2017-05-04 Martin Sebor <msebor@redhat.com>
3735 PR translation/80280
3736 * call.c (print_z_candidate): Add missing quoting to %D and other
3738 (build_op_call_1): Same.
3739 * constraint.cc (diagnose_check_constraint): Same.
3740 * mangle.c (mangle_decl): Same.
3741 * name-lookup.c (cp_binding_level_debug): Same.
3742 (set_decl_namespace): Same.
3743 * parser.c (cp_parser_tx_qualifier_opt): Same.
3744 * pt.c (print_candidates_1): Same.
3745 (check_template_variable): Same.
3746 (tsubst_default_argument): Same.
3747 (most_specialized_partial_spec): Same.
3748 * semantics.c (omp_reduction_lookup): Same.
3749 * tree.c (check_abi_tag_redeclaration): Same.
3750 * typeck.c (comptypes): Same.
3751 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3753 2017-05-04 Nathan Sidwell <nathan@acm.org>
3756 * cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL,
3757 CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER,
3758 CPTI_INIT_LIST_IDENTIFIER.
3759 (global_namespace, global_type_node, global_identifier,
3760 anon_identifier, init_list_identifier): New.
3761 * decl.c (global_type_node, global_scope_name): Delete.
3762 (initialize_predefined_identifiers): Add new identifiers.
3763 (cxx_init_decl_processing): Adjust.
3764 * name-lookup.h (global_namespace, global_type_node): Delete.
3765 * name-lookup.c (global_namespace, anonymous_namespace_name,
3766 get_anonymous_namespace_name): Delete.
3767 (namespace_scope_ht_size, begin_scope, pushtag_1,
3768 push_namespace): Adjust,
3769 * call.c (type_has_extended_temps): Use init_list_identifier.
3770 * pt.c (listify): Likewise.
3772 * name-lookup.c: Reorder functions to make merging from modules
3775 2017-05-03 Jason Merrill <jason@redhat.com>
3777 * constexpr.c (cxx_eval_outermost_constant_expr): Use TV_CONSTEXPR.
3779 2017-05-03 Nathan Sidwell <nathan@acm.org>
3781 * cp-tree.h (enum cp_tree_index, cp_global_trees): Move earlier,
3782 along with #defines, to before name-lookup include.
3784 2017-05-02 Paolo Carlini <paolo.carlini@oracle.com>
3786 * pt.c (is_auto_or_concept): Remove.
3787 (type_uses_auto_or_concept): Remove, unused.
3788 (find_parameter_packs_r, extract_autos_r, is_auto_r): Adjust.
3789 * parser.c (tree_type_is_auto_or_concept): Remove, unused.
3790 * cp-tree.h (is_auto_or_concept): Remove.
3792 2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
3795 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't
3796 add pedigree operation and detach call here.
3797 * cp-gimplify.c (cp_gimplify_expr): Remove the calls to
3798 cilk_cp_gimplify_call_params_in_spawned_fn.
3799 (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function.
3800 * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN.
3802 2017-04-29 Volker Reichelt <v.reichelt@netcologne.de>
3804 * parser.c (cp_parser_member_declaration): Add fix-it hints for
3805 stray comma and missing semicolon at end of member declaration.
3807 2017-04-27 Volker Reichelt <v.reichelt@netcologne.de>
3809 * parser.c (cp_parser_cast_expression): Add target type of cast to
3811 * error.c (type_to_string): Add '{enum}' suffix to enumeration types.
3813 2017-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3815 * decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change
3816 return type to bool.
3817 * cp-tree.h (grok_ctor_properties): Update.
3819 2017-04-26 Volker Reichelt <v.reichelt@netcologne.de>
3821 * parser.c (cp_parser_nested_name_specifier_opt): Add fix-it
3822 information to diagnostic of invalid colon in nested-name-specifier.
3824 2017-04-25 Volker Reichelt <v.reichelt@netcologne.de>
3826 * parser.c (cp_parser_elaborated_type_specifier): Add fix-it to
3827 diagnostic of invalid class/struct keyword after enum.
3829 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3831 * parser.c (cp_parser_member_declaration): Add fix-it hint
3832 for removing stray semicolons.
3834 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3836 * name-lookup.c (get_std_name_hint): New function.
3837 (maybe_suggest_missing_header): New function.
3838 (suggest_alternative_in_explicit_scope): Call
3839 maybe_suggest_missing_header.
3841 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3844 * name-lookup.c (suggest_alternative_in_explicit_scope): Convert
3845 candidate type of bm from tree to const char *.
3846 (consider_binding_level): Likewise.
3847 (lookup_name_fuzzy): Likewise, using this to merge the best
3848 result from the preprocessor into bm, rather than immediately
3849 returning, so that better matches from reserved words can "win".
3850 Guard the rejection of keywords that don't start decl-specifiers
3851 so it only happens for FUZZY_LOOKUP_TYPENAME.
3853 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3855 * decl.c (grokdeclarator): Use %qT instead of %<%T%> in diagnostics.
3856 (start_enum): Likewise.
3857 (build_enumerator): Likewise. Use %qE instead of plain %E.
3858 * parser.c (cp_parser_mem_initializer_list): Use %qD instead of
3859 %<%D%> in diagnostics.
3860 (cp_parser_elaborated_type_specifier): Likewise.
3861 * pt.c (make_pack_expansion): Use %qT and %qE instead of
3862 %<%T%> and %<%E%> in diagnostics.
3863 (tsubst_pack_expansion): Likewise.
3865 2017-04-24 David Malcolm <dmalcolm@redhat.com>
3868 * parser.c (cp_parser_unary_expression): Generate a location
3869 range for alignof and sizeof expressions.
3871 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3873 * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to
3875 (cp_parser_virt_specifier_seq_opt): Likewise.
3876 (set_and_check_decl_spec_loc): Likewise twice.
3878 2017-04-21 Jason Merrill <jason@redhat.com>
3880 PR c++/80179 - ICE with initialized flexible array member.
3881 * constexpr.c (verify_ctor_sanity): Handle flexible array members.
3883 2017-04-21 Richard Biener <rguenther@suse.de>
3885 * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO.
3886 (copy_type): Likewise.
3887 * lex.c (copy_decl): Pass down mem-stat info.
3888 (copy_type): Likewise.
3890 2017-04-20 Jonathan Wakely <jwakely@redhat.com>
3893 * init.c (build_new_1): Suppress notes about over-aligned new when
3894 the warning is suppressed.
3896 2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
3898 * parser.c (cp_parser_member_declaration): Add warning with fixit
3899 information for extra semicolon after in-class function definition.
3901 2017-04-20 Jakub Jelinek <jakub@redhat.com>
3904 * tree.c (build_cplus_array_type): Call build_array_type
3905 with the intended TYPE_TYPELESS_STORAGE flag value, instead
3906 of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
3909 2017-04-18 Marek Polacek <polacek@redhat.com>
3911 PR c++/80244 - ICE with attribute in template alias.
3912 * tree.c (strip_typedefs): Handle UNDERLYING_TYPE.
3914 PR c++/80241 - ICE with alignas pack expansion.
3915 * error.c (dump_expr): Handle TREE_LIST.
3916 * parser.c (cp_parser_std_attribute_list): Return error_mark if
3917 make_pack_expansion returns an error.
3919 2017-04-17 Bernd Edlinger <bernd.edlinger@hotmail.de>
3922 * class.c (fixup_may_alias): Fix all type variants.
3924 2017-04-17 Jason Merrill <jason@redhat.com>
3926 PR c++/80415 - wrong error with default arg and array reference.
3927 * tree.c (lvalue_kind): Return clk_class for an array prvalue.
3929 * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
3931 2017-04-15 Alexandre Oliva <aoliva@redhat.com>
3933 * decl.c (name_unnamed_type): Split out of...
3934 (grokdeclarator): ... this.
3935 * decl.h (name_unnamed_type): Declare.
3937 2017-04-12 Richard Biener <rguenther@suse.de>
3938 Bernd Edlinger <bernd.edlinger@hotmail.de>
3941 * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE
3942 for arrays of character or std::byte type.
3944 2017-04-11 Jason Merrill <jason@redhat.com>
3946 PR c++/80294 - ICE with constexpr and inheritance.
3947 * constexpr.c (reduced_constant_expression_p):
3948 A null constructor element is non-constant.
3949 (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before
3950 returning an empty base.
3952 2017-04-11 Jakub Jelinek <jakub@redhat.com>
3955 * decl.c (cp_finish_decomp): If processing_template_decl on
3956 non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't
3957 change their DECL_VALUE_EXPR nor cp_finish_decl them. Instead make
3958 sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst
3960 * pt.c (value_dependent_expression_p) <case VAR_DECL>: For variables
3961 with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type
3964 2017-04-11 Jakub Jelinek <jakub@redhat.com>
3967 * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR.
3969 2017-04-10 Jakub Jelinek <jakub@redhat.com>
3972 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second
3973 operand, if it is a static member function, recurse on the
3976 2017-04-10 Marek Polacek <polacek@redhat.com>
3979 * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL. Set
3980 ORIG_TYPE earlier and not only when shortening.
3982 2017-04-07 Jason Merrill <jason@redhat.com>
3984 PR c++/80356 - ICE with reference to function template argument.
3986 * pt.c (convert_nontype_argument_function): Adjust type even with a
3987 value-dependent argument.
3989 PR c++/80267 - ICE with nested capture of reference
3991 * pt.c (tsubst_copy): Handle lookup finding a capture proxy.
3993 2017-04-07 Marek Polacek <polacek@redhat.com>
3996 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE.
3999 * call.c (build_over_call): Don't check cxx_dialect.
4000 * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor
4001 whether SUB is a CONSTRUCTOR.
4002 * init.c (build_new_1): Don't check cxx_dialect.
4003 * tree.c (replace_placeholders): Add a function comment. Return if
4004 not in C++14, or if the object isn't a (member of a) class.
4005 * typeck2.c (store_init_value): Don't check cxx_dialect nor whether
4006 TYPE is CLASS_TYPE_P.
4008 2017-04-05 Jakub Jelinek <jakub@redhat.com>
4011 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
4012 of a loop doing vec_safe_push of NULL. Formatting fixes.
4013 (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
4014 to newidx before calling canonical_type_parameter on newtype.
4016 2017-04-04 Volker Reichelt <v.reichelt@netcologne.de>
4019 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
4020 UNARY_PLUS_EXPR case.
4022 2017-04-03 Jason Merrill <jason@redhat.com>
4024 * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
4026 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
4028 * class.c (update_vtable_entry_for_fn): Fix typo in comment.
4029 * decl2.c (one_static_initialization_or_destruction): Likewise.
4030 * name-lookup.c (store_bindings): Likewise.
4031 * parser.c (make_call_declarator): Likewise.
4032 * pt.c (check_explicit_specialization): Likewise.
4034 2017-04-03 Jason Merrill <jason@redhat.com>
4036 PR sanitizer/79993 - ICE with VLA initialization from string
4037 PR c++/69487 - wrong VLA initialization from string
4038 * init.c (finish_length_check): Split out from build_vec_init.
4039 (build_vec_init): Handle STRING_CST.
4040 * typeck2.c (split_nonconstant_init): Handle STRING_CST.
4041 (digest_init_r): Don't give a STRING_CST VLA type.
4043 2017-03-31 Jakub Jelinek <jakub@redhat.com>
4046 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
4047 REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller
4048 for NOP_EXPR to REFERENCE_TYPE.
4051 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
4052 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
4054 * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
4055 Remove extraneous parens.
4056 (finish_trait_expr): Handle CPTK_IS_AGGREGATE.
4057 * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
4058 (cp_parser_trait_expr): Likewise.
4060 2017-03-27 Jakub Jelinek <jakub@redhat.com>
4063 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
4064 * typeck.c (cxx_mark_addressable): Likewise. Look through
4065 VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
4067 (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
4069 2017-03-24 Jason Merrill <jason@redhat.com>
4071 PR c++/77339 - ICE with invalid use of alias template.
4072 * pt.c (lookup_template_class_1): Don't try to enter the scope of an
4075 2017-03-24 Marek Polacek <polacek@redhat.com>
4078 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
4079 doesn't have side effects.
4081 2017-03-23 Jason Merrill <jason@redhat.com>
4083 PR c++/80150 - ICE with overloaded variadic deduction.
4084 * pt.c (try_one_overload): Remove asserts.
4086 PR c++/77563 - missing ambiguous conversion error.
4087 * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
4089 2017-03-23 Marek Polacek <polacek@redhat.com>
4091 * cp-tree.h: Remove a C_RID_YYCODE reference.
4093 2017-03-22 Jakub Jelinek <jakub@redhat.com>
4096 * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
4097 case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
4098 processing_template_decl.
4100 2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
4103 * name-lookup.c (pushtag_1): Add check for bogus, non template,
4104 std::initializer_list.
4106 2017-03-21 Jakub Jelinek <jakub@redhat.com>
4109 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
4111 2017-03-21 Ville Voutilainen <ville.voutilainen@gmail.com>
4114 * init.c (std_placement_new_fn_p): New.
4115 (build_new_1): Call it.
4117 2017-03-20 Jason Merrill <jason@redhat.com>
4119 PR c++/80096 - ICE with C++17 non-type auto.
4120 * pt.c (tsubst): Delay tsubst of type of template non-type
4123 PR c++/79519 - ICE with deleted template friend.
4124 * decl.c (grokdeclarator): Complain about misplaced function
4125 definition using =, as well.
4127 PR c++/79640 - infinite recursion with generic lambda.
4128 * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
4129 before substituting its initializer.
4131 2017-03-20 Marek Polacek <polacek@redhat.com>
4132 Paolo Carlini <paolo.carlini@oracle.com>
4134 PR c++/80059 - ICE with noexcept and __transaction_atomic
4135 * except.c (build_must_not_throw_expr): Call
4136 instantiate_non_dependent_expr.
4138 2017-03-19 Jason Merrill <jason@redhat.com>
4140 PR c++/80084 - wrong C++17 decomposition by reference of parameter.
4141 * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
4142 reference decomposition.
4144 PR c++/80077 - error with constexpr and -fno-elide-constructors.
4145 * constexpr.c (cxx_eval_call_expression): Set ctx->call while
4146 expanding trivial constructor.
4148 2017-03-17 Jason Merrill <jason@redhat.com>
4150 PR c++/78345 - ICE initializing array from lambda.
4151 * init.c (build_aggr_init): Check array initializer.
4152 (build_vec_init): Check the type of a CONSTRUCTOR.
4154 PR c++/80073 - C++17 ICE with virtual base.
4155 * decl.c (xref_basetypes): Also check for indirect vbases.
4157 2017-03-16 Jason Merrill <jason@redhat.com>
4159 * decl.c (start_enum): std::byte aliases anything.
4162 * constexpr.c (lookup_placeholder): Tweak.
4164 2017-03-15 Jason Merrill <jason@redhat.com>
4166 PR c++/80043 - ICE with -fpermissive
4167 * typeck.c (convert_for_assignment): Handle instantiate_type
4168 not giving an error.
4170 2017-03-14 Nathan Sidwell <nathan@acm.org>
4172 PR c++/79393 DR 1658 workaround
4173 * method.c (synthesized_method_base_walk): Inihibit abstract class
4174 virtual base access check here.
4175 (synthesized_method_walk): Not here.
4177 2017-03-13 Nathan Sidwell <nathan@acm.org>
4179 PR c++/79393 DR 1658 workaround
4180 * method.c (synthesized_method_walk): Check vbases of abstract
4181 classes for dtor walk.
4183 2017-03-10 David Malcolm <dmalcolm@redhat.com>
4185 PR translation/79848
4186 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
4188 2017-03-10 Jason Merrill <jason@redhat.com>
4190 PR c++/79960 - alias templates and partial ordering
4191 * pt.c (comp_template_args): Add partial_order parm.
4192 (template_args_equal): Likewise.
4193 (comp_template_args_porder): New.
4194 (get_partial_spec_bindings): Use it.
4196 2017-03-10 Marek Polacek <polacek@redhat.com>
4199 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
4201 2017-03-10 Jakub Jelinek <jakub@redhat.com>
4204 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
4205 Use XALLOCAVEC macro.
4208 * decl.c (finish_enum_value_list): If value is error_mark_node,
4209 don't copy it and change its type.
4210 * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
4211 of CONST_DECL is error_mark_node.
4213 2017-03-09 Marek Polacek <polacek@redhat.com>
4215 PR c++/79900 - ICE in strip_typedefs
4216 * tree.c (strip_typedefs): Skip the attribute handling if T is
4217 a variant type which hasn't been updated yet.
4219 PR c++/79687 - wrong code with pointer-to-member
4220 * init.c (constant_value_1): Break if the variable has a dynamic
4223 2017-03-08 Jason Merrill <jason@redhat.com>
4225 PR c++/79797 - ICE with self-reference in array DMI.
4226 * constexpr.c (lookup_placeholder): Split out...
4227 (cxx_eval_constant_expression): ...from here.
4229 2017-03-07 Jakub Jelinek <jakub@redhat.com>
4232 * parser.c (cp_parser_omp_cancellation_point,
4233 cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
4234 cp_parser_omp_target_update): Change "may only be used in compound
4235 statements" diagnostics, such that the same translatable string is
4236 used for all pragmas.
4237 (cp_parser_pragma): Likewise. Use error_at instead of
4238 cp_parser_error for that diagnostics.
4240 2017-03-06 Marek Polacek <polacek@redhat.com>
4242 PR c++/79796 - ICE with NSDMI and this pointer
4243 * call.c (build_over_call): Handle NSDMI with a 'this' by calling
4244 replace_placeholders.
4246 2017-03-06 Jakub Jelinek <jakub@redhat.com>
4249 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
4252 2017-03-06 Jason Merrill <jason@redhat.com>
4254 Revert "Allow deduction guides to look into primary template."
4255 * cp-tree.h, parser.c, pt.c, search.c: Revert.
4257 2017-03-05 Paolo Carlini <paolo.carlini@oracle.com>
4260 * except.c (build_must_not_throw_expr): Perform the implicit
4261 conversions on the condition.
4263 2017-03-03 Jason Merrill <jason@redhat.com>
4265 * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
4268 Core issues 2273 and 2277
4269 * call.c (joust): Adjust using-declaration tiebreaker to handle
4270 the intermediate base case.
4271 * method.c (strip_inheriting_ctors): Just return the argument if
4272 !flag_new_inheriting_ctors.
4274 2017-03-03 Richard Biener <rguenther@suse.de>
4277 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
4279 2017-03-03 Marek Polacek <polacek@redhat.com>
4282 * typeck.c (string_conv_p): In C++11, always call pedwarn with
4285 2017-03-02 Jason Merrill <jason@redhat.com>
4287 Update overload resolution with deduction guides.
4288 * pt.c (do_class_deduction): Always build the copy guide.
4289 (copy_guide_p, template_guide_p): New.
4290 (build_deduction_guide): Remember the original constructor.
4291 * call.c (joust): Prefer the copy guide and non-template guides.
4293 Allow deduction guides to look into primary template.
4294 * cp-tree.h (struct saved_scope): Add deduction_guide_type.
4295 (struct cp_decl_specifier_seq): Add constructor_p.
4296 * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
4297 (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p.
4298 Clear deduction_guide_type. Don't handle deduction guide names.
4299 (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
4300 (cp_parser_direct_declarator): Likewise. Handle deduction guides.
4301 (cp_parser_member_declaration, cp_parser_cache_defarg)
4302 (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
4303 * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
4304 (build_deduction_guide): Set deduction_guide_type.
4305 (dependent_scope_p): Check deduction_guide_type.
4306 * search.c (lookup_member): Likewise.
4308 2017-03-02 Jakub Jelinek <jakub@redhat.com>
4311 * init.c (mark_exp_read_r): New function.
4312 (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
4313 whole arguments instead of plain mark_exp_read on TREE_LIST values.
4315 2017-03-01 Jason Merrill <jason@redhat.com>
4317 Class template argument deduction in new-expression
4318 * init.c (build_new): Handle deduction from no initializer.
4319 * parser.c (cp_parser_new_expression): Don't require a single
4320 expression for class template deduction.
4321 * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
4322 class template placeholder.
4323 * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
4324 (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
4325 (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
4327 2017-03-01 Jakub Jelinek <jakub@redhat.com>
4330 * init.c (emit_mem_initializers): When not constructing vbases of
4331 abstract classes, mark arguments as read for
4332 -Wunused-but-set-parameter.
4334 2017-02-28 Jason Merrill <jason@redhat.com>
4336 Class template argument deduction refinements
4337 * call.c (joust): Move deduction guide tiebreaker down.
4338 * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
4339 deduction with no initializer.
4340 * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
4341 (do_class_deduction): Use that rather than special case.
4342 (do_auto_deduction): Handle null initializer.
4344 2017-02-28 Jakub Jelinek <jakub@redhat.com>
4346 * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
4347 instead of just cond ? "..." : "...".
4348 (grokdeclarator): Likewise.
4349 (build_enumerator): Likewise.
4350 * init.c (build_new_1): Likewise.
4351 * call.c (build_new_method_call_1): Likewise.
4352 * parser.c: Include intl.h.
4353 (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
4354 "enter"/"exit" keyword.
4355 (cp_finalize_oacc_routine): Don't use %s to supply portions of the
4358 2017-02-27 Jason Merrill <jason@redhat.com>
4360 PR c++/71568 - SFINAE forming pointer to member function
4361 * init.c (build_offset_ref): Check the return value of
4362 perform_or_defer_access_check.
4364 2017-02-27 Marek Polacek <polacek@redhat.com>
4366 * decl.c (expand_static_init): Add missing } in a comment.
4368 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de>
4370 * init.c: Include intl.h.
4371 (build_new_1): Move message strings into pedwarn to make them
4372 -Wformat-security friendly. Mark string for translation.
4373 * pt.c (tsubst_copy_and_build): Mark string for translation.
4374 Make the pointer const.
4375 * semantics.c (finish_id_expression): Mark strings for translation.
4377 2017-02-25 Jakub Jelinek <jakub@redhat.com>
4379 * call.c (build_op_delete_call): Make msg1 and msg2 const.
4381 2017-02-24 Jakub Jelinek <jakub@redhat.com>
4384 * call.c (build_over_call): Call check_function_arguments even for
4385 -Wrestrict, adjust check_function_arguments caller.
4386 * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
4388 * typeck.c (cp_build_function_call_vec): Adjust
4389 check_function_arguments caller.
4391 2017-02-24 Marek Polacek <polacek@redhat.com>
4393 PR translation/79705
4394 * decl.c (check_redeclaration_exception_specification): Mark a string
4395 for translation. Make the pointer const.
4397 2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
4400 * pt.c (register_specialization): Check duplicate_decls return value
4401 for error_mark_node and pass it back.
4403 2017-02-22 Jason Merrill <jason@redhat.com>
4405 PR c++/79679 - missing destructor for argument
4406 * call.c (build_over_call): Don't pass tf_no_cleanup to argument
4409 * pt.c (do_class_deduction): Handle 0 argument case.
4411 2017-02-22 Jakub Jelinek <jakub@redhat.com>
4414 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
4415 SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
4416 * constexpr.c (potential_constant_expression_1): Handle
4417 OMP_*, OACC_* and CILK_* trees. Use error_at with
4418 EXPR_LOC_OR_LOC (t, input_location) computed early
4419 instead of error, or error_at with location_of (t).
4421 2017-02-22 Marek Polacek <polacek@redhat.com>
4424 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
4425 if the alignas expression is erroneous.
4426 * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
4430 * semantics.c (finish_underlying_type): Bail out for incomplete enums.
4432 2017-02-21 Jason Merrill <jason@redhat.com>
4434 PR c++/50308 - wrong deprecated warning with ADL
4435 PR c++/17729 - duplicate deprecated warning
4436 * semantics.c (finish_id_expression): Only call mark_used on a
4437 function if we aren't building a call.
4439 PR c++/41727 - ICE with partial spec of partial instantiation
4440 * pt.c (process_partial_specialization): For now, don't check more
4441 specialized if there is more than one level of args.
4443 2017-02-21 Marek Polacek <polacek@redhat.com>
4446 * cp-tree.h (maybe_reject_flexarray_init): Declare.
4447 * init.c (maybe_reject_flexarray_init): No longer static.
4448 Add check for current_function_decl.
4449 * parser.c (cp_parser_late_parse_one_default_arg): Reject
4450 a default mem-initializer for a flexible array.
4452 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4453 Paolo Carlini <paolo.carlini@oracle.com>
4456 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
4458 * pt.c (tsubst_decomp_names): Return error_mark_node if the first
4459 decl after the decomposition artificial decl has error_mark_node.
4460 * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
4461 instead of just == error_mark_node comparison.
4463 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4466 * decl.c: Include gimplify.h.
4467 (cp_finish_decomp): Make sure there is no sharing of trees
4468 in between DECL_VALUE_EXPR of decomposition decls.
4471 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
4474 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
4475 call cplus_expand_constant on it first.
4477 2017-02-19 Jason Merrill <jason@redhat.com>
4479 PR c++/78139 - destructor needed by new-expression
4480 * call.c (build_special_member_call): Use tf_no_cleanup.
4482 PR c++/78282 - auto template and pack expansion
4483 * pt.c (find_parameter_packs_r): Don't walk into the type of
4484 templates other than template template-parameters.
4486 PR c++/79606 - ICE with this->base_member in NSDMI
4487 * class.c (build_base_path): Check processing_template_decl.
4489 PR c++/79607 - ICE with T{} initializer
4490 * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
4492 PR c++/79566 - elaborated-type-specifier in range for
4493 * parser.c (cp_parser_simple_declaration): Fix check for type
4496 PR c++/79400 - confusing suggestion of 'noexcept'
4497 * parser.c (cp_parser_exception_specification_opt): Remove
4498 suggestion for deprecated dynamic exception-specification.
4500 PR c++/79470 - partial ordering with reference parameters
4501 * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
4503 PR c++/79500 - ICE with non-template deduction guide
4504 * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
4505 DECL_TEMPLATE_RESULT.
4507 PR c++/79580 - ICE with compound literal
4508 * parser.c (cp_parser_class_head): If we're in the middle of an
4509 expression, use ts_within_enclosing_non_class.
4511 PR c++/79503 - inherited ctor taking base class
4512 * call.c (add_function_candidate): Also check that
4513 DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
4515 2017-02-19 Paolo Carlini <paolo.carlini@oracle.com>
4518 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
4521 2017-02-19 Eric Fiselier <eric@efcs.ca>
4522 Jonathan Wakely <jwakely@redhat.com>
4525 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
4526 control warning about literal suffix identifiers without a leading
4529 2017-02-17 Jason Merrill <jason@redhat.com>
4531 PR c++/79508 - lookup error with member template
4532 * parser.c (cp_parser_template_name): Clear
4533 parser->context->object_type if we aren't doing lookup.
4535 PR c++/78690 - ICE with using and global type with same name
4536 * pt.c (type_dependent_object_expression_p): True for
4539 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
4540 * pt.c (convert_template_argument): Just return an auto arg pack.
4541 (tsubst_template_args): Don't tsubst an auto pack type.
4543 PR c++/79556 - C++17 ICE with non-type auto
4544 * pt.c (do_auto_deduction): Don't try to deduce from null type.
4546 PR c++/79533 - C++17 ICE with temporary cast to reference
4547 * call.c (build_over_call): Conversion to a reference prevents copy
4550 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4551 Jason Merrill <jason@redhat.com>
4553 PR c++/79502 - lost nodiscard attribute
4554 * pt.c (apply_late_template_attributes): Do apply non-dependent
4555 attributes to types.
4557 2017-02-16 Jason Merrill <jason@redhat.com>
4559 PR c++/78572 - ICE with self-modifying array initializer
4560 * constexpr.c (cxx_eval_store_expression): The object we're
4561 initializing is outside the constant-expression.
4562 (cxx_eval_call_expression): Set ctx->call.
4564 PR c++/79050 - ICE with undeduced auto and LTO
4565 * decl.c (poplevel): Remove undeduced auto decls.
4567 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4570 * parser.c (cp_parser_omp_target): For -fopenmp-simd
4571 ignore #pragma omp target even when not followed by identifier.
4573 2017-02-15 Jason Merrill <jason@redhat.com>
4574 Jakub Jelinek <jakub@redhat.com>
4576 PR c++/79464 - ICE in IPA with omitted constructor parms
4577 * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
4578 (adjust_clone_args): Adjust.
4579 (add_method): Remember omitted parms.
4580 * call.c (add_function_candidate): Likewise.
4581 * mangle.c (write_method_parms): Likewise.
4582 * method.c (ctor_omit_inherited_parms): Return false if there are no
4585 2017-02-15 Martin Sebor <msebor@redhat.com>
4588 * init.c (maybe_reject_flexarray_init): New function.
4589 (perform_member_init): Call it.
4591 2017-02-15 Jakub Jelinek <jakub@redhat.com>
4594 * parser.c (cp_parser_std_attribute): Don't pedwarn about
4595 [[deprecated]] with -std=c++11 and [[fallthrough]] with
4596 -std=c++11 and -std=c++14.
4599 * decl.c (grokdeclarator): For static data members, handle thread_p
4600 only after handling inline.
4602 2017-02-14 Marek Polacek <polacek@redhat.com>
4606 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
4607 clobbering if the postfix expression isn't an EXPR_P.
4609 2017-02-13 Jason Merrill <jason@redhat.com>
4611 PR c++/79461 - ICE with lambda in constexpr constructor
4612 * constexpr.c (build_data_member_initialization): Ignore
4613 initialization of a local variable.
4615 2017-02-13 Jakub Jelinek <jakub@redhat.com>
4617 * init.c (warn_placement_new_too_small): Add missing space in
4619 * parser.c (cp_parser_oacc_declare): Likewise.
4620 * mangle.c (maybe_check_abi_tags): Likewise.
4623 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
4624 on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
4625 in the rightmost operand.
4627 2017-02-13 Nathan Sidwell <nathan@acm.org>
4629 PR c++/79296 - ICE mangling localized template instantiation
4630 * decl2.c (determine_visibility): Use template fn context for
4631 local class instantiations.
4633 2017-02-11 Jason Merrill <jason@redhat.com>
4635 PR c++/77659 - ICE with new and C++14 aggregate NSDMI
4636 * init.c (build_new): Make backups of any CONSTRUCTORs in init.
4637 (build_new_1): Use replace_placeholders.
4638 * tree.c (replace_placeholders_t): Also track whether we've seen a
4640 (replace_placeholders, replace_placeholders_r): Adjust.
4641 * cp-tree.h: Adjust.
4643 PR c++/77790 - ICE with auto function in C++11 mode
4644 * decl.c (undeduced_auto_decl): Remove C++14 limitation.
4645 (require_deduced_type): Add complain parm, return bool.
4646 * cp-tree.h: Adjust.
4647 * decl2.c (mark_used): Use require_deduced_type.
4649 2017-02-10 Jason Merrill <jason@redhat.com>
4651 PR c++/78908 - template ops and bitfields
4652 * tree.c (build_min_non_dep): Use unlowered_expr_type.
4654 PR c++/78897 - constexpr union
4655 * constexpr.c (cxx_eval_store_expression): A store to a union member
4656 erases a previous store to another member.
4658 PR c++/71285 - member of fold-expression
4659 * semantics.c (finish_unary_fold_expr)
4660 (finish_binary_fold_expr): Use null type for fold-expressions.
4662 PR c++/79401 - protected inherited constructor
4663 * call.c (enforce_access): For inheriting constructor, find a base
4664 binfo in the path we already have.
4666 2017-02-10 Marek Polacek <polacek@redhat.com>
4669 * pt.c (type_dependent_expression_p): Check if the expression type
4673 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
4674 if warnings shouldn't be given.
4676 2017-02-10 Paolo Carlini <paolo.carlini@oracle.com>
4679 * pt.c (tsubst_decl): Don't try to preserve a typedef that names
4680 an error_mark_node as type.
4682 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4683 Jason Merrill <jason@redhat.com>
4686 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
4687 from pattern to type.
4689 2017-02-09 Jason Merrill <jason@redhat.com>
4691 PR c++/79316 - default argument in deduction guide
4692 PR c++/79350 - explicit deduction guide
4693 * parser.c (cp_parser_constructor_declarator_p)
4694 (cp_parser_direct_declarator): Parse deduction guides more like
4696 * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
4697 * tree.c (special_function_p): Return it.
4698 * decl.c (check_special_function_return_type): Handle it.
4699 (grokdeclarator, grokfndecl): Adjust.
4700 (cp_finish_decl): Pass flags to do_auto_deduction.
4701 * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
4702 * pt.c (dguide_name_p): Take a const_tree.
4703 (do_class_deduction): Handle explicit.
4704 (do_auto_deduction): Pass flags through.
4705 (build_deduction_guide): Copy explicit flag.
4707 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4710 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
4711 non-pragma_compound context here.
4712 (cp_parser_omp_target): Likewise.
4713 (cp_parser_pragma): Don't call push_omp_privatization_clauses and
4714 parsing for ordered and target omp pragmas in non-pragma_stmt
4715 non-pragma_compound contexts.
4718 * parser.c (cp_parser_oacc_declare): Formatting fix.
4719 (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
4720 automatic variables.
4722 2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
4723 Chung-Lin Tang <cltang@codesourcery.com>
4725 * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix
4726 parsing. Parse constant expression. Remove semantic checking.
4727 (cp_parser_omp_clause_collapse): Disallow tile.
4728 (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse
4729 error about missing for after already emitting one. Use more
4730 conventional for idiom for unbounded loop.
4731 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
4732 * semantics.c (finish_omp_clauses): Correct TILE semantic check.
4733 (finish_omp_for): Deal with tile clause.
4735 2017-02-07 Nathan Sidwell <nathan@acm.org>
4737 * method.c (synthesized_method_base_walk): New. Broken out of ...
4738 (synthesized_method_walk): ... here. Call it. Cleanup
4741 2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
4744 * typeck2.c (process_init_constructor_union): Consider only
4745 FIELD_DECLs when looking for an NSDMI.
4747 2017-02-06 Jason Merrill <jason@redhat.com>
4749 PR c++/71193 - incomplete types in templates
4750 * parser.c (cp_parser_postfix_dot_deref_expression): In a template
4751 handle incomplete type by pedwarning and then treating as dependent.
4753 2017-02-06 Jakub Jelinek <jakub@redhat.com>
4756 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
4757 (potential_constant_expression_1): Likewise.
4760 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
4761 allow one fewer than expected arguments if flag_permissive.
4764 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
4765 * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
4766 with error_mark_node type.
4768 2017-02-03 Jason Merrill <jason@redhat.com>
4770 PR c++/78689 - ICE on constructor with label
4771 * optimize.c (maybe_clone_body): Replace omitted parameters with
4773 * class.c (build_clone): Fix logic for omitting inherited parms.
4775 PR c++/12245 - excessive memory use
4776 * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
4777 back in. Don't cache constants.
4778 (maybe_constant_init): Don't cache constants.
4780 PR c++/79294 - ICE with invalid template argument
4781 * pt.c (convert_nontype_argument_function): Check value-dependence.
4782 (convert_nontype_argument): Don't check it here for function ptrs.
4784 2017-02-02 Richard Biener <rguenther@suse.de>
4787 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
4788 it lazily on the first changed element only and copy it
4789 fully upfront, only storing changed elements.
4791 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
4794 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
4797 2017-01-31 Jakub Jelinek <jakub@redhat.com>
4800 * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
4803 2017-01-31 David Malcolm <dmalcolm@redhat.com>
4806 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
4807 any namespace aliases.
4809 2017-01-31 Nathan Sidwell <nathan@acm.org>
4812 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
4816 * pt.c: (instantiate_decl): Push to top level when current
4817 function scope doesn't match. Only push lmabda scope stack when
4820 * cp-tree.h (instantiate_decl): Make defer_ok bool.
4821 * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
4822 (instantiate_decl): Simplify and reorder state saving and restoration.
4825 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
4826 * semantics.c (finish_member_declaration): Assert class is being
4829 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
4831 Introduce C++ support in libcc1.
4832 * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
4833 (ansi_opname): Rename to...
4834 (cp_operator_id): ... this. Adjust all callers.
4835 (ansi_assopname): Rename to...
4836 (cp_assignment_operator_id): ... this. Adjust all callers.
4837 (cp_literal_operator_id): Declare.
4838 (set_global_friend): Declare.
4839 (is_global_friend): Declare.
4840 (enum cp_oracle_request): New type.
4841 (cp_binding_oracle_function): New type.
4842 (cp_binding_oracle): Declare.
4843 (cp_finish_injected_record_type): Declare.
4844 * friend.c (global_friend): New var.
4845 (set_global_friend): New fn.
4846 (is_global_friend): New fn.
4847 (is_friend): Call is_global_friend.
4848 * name-lookup.c (cp_binding_oracle): New var.
4849 (query_oracle): New fn.
4850 (qualified_lookup_using_namespace): Call query_oracle.
4851 (lookup_name_real_1): Likewise.
4852 * parser.c (cp_literal_operator_id): Drop static.
4853 * search.c (friend_accessible_p): Call is_global_friend.
4854 * semantics.c (is_this_parameter): Accept a variable if the
4855 binding oracle is enabled.
4857 2017-01-27 Jason Merrill <jason@redhat.com>
4859 PR c++/78771 - ICE with inherited constructor.
4860 * call.c (build_over_call): Call deduce_inheriting_ctor here.
4861 * pt.c (tsubst_decl): Not here.
4862 * class.c (add_method): Or here.
4863 * method.c (deduce_inheriting_ctor): Handle clones.
4864 (implicitly_declare_fn): Don't deduce inheriting ctors yet.
4866 2017-01-27 Adam Butcher <adam@jessamine.co.uk>
4869 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
4871 * cp/cp-tree.h: Declare it.
4872 * cp/semantics.c (finish_id_expression): Resolve names within a default
4873 capturing generic lambda defined within a template prior to
4874 instantiation to allow for captures to be added to the closure type.
4876 2017-01-26 Jakub Jelinek <jakub@redhat.com>
4879 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
4880 * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
4881 * parser.c (cp_parser_builtin_offsetof): Pass result of
4882 build_static_cast of null_pointer_node to finish_offsetof.
4883 * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
4884 it for -Winvalid-offsetof pedwarn instead of trying to guess
4885 original offsetof type from EXPR. Save OBJECT_PTR as a new
4886 second operand to OFFSETOF_EXPR.
4887 * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
4888 finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
4891 2017-01-26 Jason Merrill <jason@redhat.com>
4893 * name-lookup.c (parse_using_directive): Deprecate strong using.
4895 PR c++/79176 - lambda ICE with -flto -Os
4896 * decl2.c (vague_linkage_p): Handle decloned 'tors.
4897 * tree.c (decl_linkage): Likewise.
4899 2017-01-25 Martin Sebor <msebor@redhat.com>
4901 * decl.c (grokdeclarator): Fix a typo in a comment.
4903 2017-01-25 Jakub Jelinek <jakub@redhat.com>
4906 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
4910 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
4911 OPT_Wpedantic on lambda templates for -std=c++14 and higher.
4913 2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
4916 * decl.c (cxx_init_decl_processing): Pass main_input_filename
4917 to build_translation_unit_decl.
4919 2017-01-24 Jakub Jelinek <jakub@redhat.com>
4922 * cp-gimplify.c (cp_genericize_r): Add result of
4923 convert_from_reference on invisiref parm to p_set.
4925 2017-01-24 Nathan Sidwell <nathan@acm.org>
4927 PR c++/78469 - defaulted ctor and inaccessible dtor
4928 * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
4929 * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
4930 * tree.c (build_target_expr): Check tf_no_cleanup.
4932 PR c++/79118 - anon-members and constexpr
4933 * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
4934 ctor decl. Recursively check anonymous members.
4935 (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
4937 (explain_invalid_constexpr_fn): Likewise.
4939 2017-01-23 Nathan Sidwell <nathan@acm.org>
4941 PR c++/71710 - template using directive of field
4942 * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
4945 PR c++/71406 - ICE with scope-ref'd template id exprs
4947 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
4948 before breaking up TEMPLATE_ID_EXPR.
4950 2017-01-20 Nathan Sidwell <nathan@acm.org>
4952 PR c++/78495 - wrong code inherited ctor and invisi-ref parm
4953 * cp-gimplify.c (cp_generize_r): Don't skip thunks.
4955 2017-01-20 David Malcolm <dmalcolm@redhat.com>
4959 * cp-tree.h (suggest_alternatives_for): Add bool param.
4960 (suggest_alternative_in_explicit_scope): New decl.
4961 * error.c (qualified_name_lookup_error): When SCOPE is a namespace
4962 that isn't the global one, call new function
4963 suggest_alternative_in_explicit_scope, only calling
4964 suggest_alternatives_for if it fails, and disabling near match
4965 searches fort that case. When SCOPE is the global namespace,
4966 pass true for new param to suggest_alternatives_for to allow for
4968 * lex.c (unqualified_name_lookup_error): Pass true for new param
4969 to suggest_alternatives_for.
4970 * name-lookup.c (consider_binding_level): Add forward decl.
4971 (suggest_alternatives_for): Add "suggest_misspellings" param,
4972 using it to conditionalize the fuzzy name-lookup code.
4973 (suggest_alternative_in_explicit_scope): New function.
4974 * parser.c (cp_parser_primary_expression): When calling
4975 finish_id_expression, pass location of id_expression rather
4976 than that of id_expr_token.
4977 (cp_parser_id_expression): Convert local "unqualified_id" from
4978 tree to cp_expr to avoid implicitly dropping location information.
4980 2017-01-20 Marek Polacek <polacek@redhat.com>
4983 * call.c (build_conditional_expr_1): Warn about duplicated branches.
4984 * semantics.c (finish_expr_stmt): Build statement using the proper
4987 2017-01-19 Jason Merrill <jason@redhat.com>
4989 US 20 - forwarding references and class template argument deduction
4990 * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
4991 * pt.c (push_template_decl_real): Set it.
4992 (maybe_adjust_types_for_deduction): Check it.
4993 (rewrite_template_parm): Copy it.
4995 US 19 - deduction guides and constructors
4996 * call.c (joust): Prefer deduction guides to constructors.
4997 * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
4998 (deduction_guide_p): Check DECL_P.
5000 * decl.c (check_initializer): Always use build_aggr_init for array
5003 PR c++/79130 - decomposition and direct-initialization
5004 * init.c (build_aggr_init): Communicate direct-initialization to
5006 (build_vec_init): Check for array copy sooner.
5007 * parser.c (cp_parser_decomposition_declaration): Remove call to
5008 build_x_compound_expr_from_list.
5010 2017-01-18 Jason Merrill <jason@redhat.com>
5012 PR c++/68666 - member variable template-id
5013 * typeck.c (finish_class_member_access_expr): Handle variable
5015 * pt.c (lookup_and_finish_template_variable): No longer static.
5016 * cp-tree.h: Declare it.
5018 2017-01-18 Nathan Sidwell <nathan@acm.org>
5021 * call.c (build_over_call): When checking ellipsis conversions for
5022 an inherited ctor, make sure there is at least one conversion.
5024 2017-01-18 Jason Merrill <jason@redhat.com>
5026 PR c++/78894 - ICE with class deduction and default arg
5027 * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
5029 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5032 * mangle.c (write_discriminator): Reorganize abi warning check.
5034 2017-01-18 Nathan Sidwell <nathan@acm.org>
5036 * cp-tree.h: Clarify exception spec node comment.
5037 * except.c (nothrow_spec_p): Simplify by checking node-equality.
5040 * mangle.c (write_exception_spec): Check nothrow explicitly.
5041 (write_encoding): Don't increment processing_template_decl around
5044 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5047 * mangle.c (write_template_args): Add "on" for operator names.
5049 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5052 * mangle.c (write_discriminator): Handle discriminator >= 10.
5054 2017-01-17 Nathan Sidwell <nathan@acm.org>
5057 * cp-tree.h (maybe_generic_this_capture): Declare.
5058 * lambda.c (resolvable_dummy_lambda): New, broken out of ...
5059 (maybe_resolve_dummy): ... here. Call it.
5060 (maybe_generic_this_capture): New.
5061 * parser.c (cp_parser_postfix_expression): Speculatively capture
5062 this in generic lambda in unresolved member function call.
5063 * pt.c (tsubst_copy_and_build): Force hard error from failed
5064 member function lookup in generic lambda.
5066 2017-01-17 Aldy Hernandez <aldyh@redhat.com>
5069 * cp-array-notation.c (expand_array_notation_exprs): Handle
5072 2017-01-11 Jason Merrill <jason@redhat.com>
5074 PR c++/78337 - ICE on invalid with generic lambda
5075 * semantics.c (process_outer_var_ref): Check if containing_function
5076 is null. Move inform call under complain test.
5078 2017-01-11 Nathan Sidwell <nathan@acm.org>
5081 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
5084 2017-01-11 Nathan Sidwell <nathan@acm.org>
5086 * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
5088 2017-01-11 Jakub Jelinek <jakub@redhat.com>
5091 * parser.c (cp_parser_std_attribute_spec): Remove over-eager
5092 assertion. Formatting fix.
5095 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
5098 2017-01-10 David Malcolm <dmalcolm@redhat.com>
5101 * parser.c (cp_parser_class_specifier_1): Only suggest inserting
5102 a missing semicolon if we have a valid insertion location for
5105 2017-01-10 Jason Merrill <jason@redhat.com>
5107 FI 20, decomposition declaration with parenthesized initializer.
5108 * parser.c (cp_parser_decomposition_declaration): Use
5109 cp_parser_initializer.
5111 2017-01-09 Jason Merrill <jason@redhat.com>
5113 Implement P0195R2, C++17 variadic using.
5114 * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
5115 * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
5116 * error.c (dump_decl): Likewise.
5118 2017-01-09 Jakub Jelinek <jakub@redhat.com>
5120 PR translation/79019
5121 PR translation/79020
5122 * semantics.c (finish_omp_clauses): Add missing whitespace to
5123 translatable strings.
5124 * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
5126 2017-01-07 Jason Merrill <jason@redhat.com>
5128 PR c++/78948 - instantiation from discarded statement
5129 * parser.h (struct cp_parser): Remove in_discarded_stmt field.
5130 * cp-tree.h (in_discarded_stmt): Declare it.
5131 (struct saved_scope): Add discarded_stmt bitfield.
5132 (in_discarded_stmt): New macro.
5133 * decl2.c (mark_used): Check it.
5134 * parser.c (cp_parser_selection_statement): Adjust.
5135 (cp_parser_jump_statement): Adjust.
5137 2017-01-05 Jakub Jelinek <jakub@redhat.com>
5140 * decl.c (cp_finish_decomp): Remove probe variable, if tt is
5141 REFERENCE_REF_P, set tt to its operand.
5144 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
5145 unions even for C++11 and later.
5147 2017-01-05 Nathan Sidwell <nathan@acm.org>
5150 * pt.c (convert_nontype_argument): Don't try and see if integral
5151 or enum expressions are constants prematurely.
5153 2017-01-04 Marek Polacek <polacek@redhat.com>
5156 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
5157 a zero character literal.
5159 2017-01-04 Jakub Jelinek <jakub@redhat.com>
5162 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
5166 * parser.c (cp_parser_simple_declaration): Only complain about
5167 inconsistent auto deduction if auto_result doesn't use auto.
5169 * parser.c (cp_parser_simple_declaration): Diagnose function
5170 declaration among more than one init-declarators with auto
5174 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
5175 assertion, as lexer->buffer may be NULL.
5177 2017-01-04 Marek Polacek <polacek@redhat.com>
5181 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
5183 2017-01-04 Nathan Sidwell <nathan@acm.org>
5186 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
5187 (lambda_capture_field_type): Update prototype.
5188 * lambda.c (lambda_capture_field_type): Add is_reference parm.
5189 Add referenceness here.
5190 (add_capture): Adjust lambda_capture_field_type call, refactor
5192 * pt.c (tsubst): Adjust lambda_capture_field_type call.
5194 2017-01-01 Jakub Jelinek <jakub@redhat.com>
5196 Update copyright years.
5198 Copyright (C) 2017 Free Software Foundation, Inc.
5200 Copying and distribution of this file, with or without modification,
5201 are permitted in any medium without royalty provided the copyright
5202 notice and this notice are preserved.