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