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