1 2018-01-02 Nathan Sidwell <nathan@acm.org>
3 * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
6 2017-12-22 Mike Stump <mikestump@comcast.net>
7 Eric Botcazou <ebotcazou@adacore.com>
9 * constexpr.c (cxx_eval_constant_expression) <ANNOTATE_EXPR>: Remove
10 assertion on 2nd operand.
11 (potential_constant_expression_1): Likewise.
12 * cp-tree.def (RANGE_FOR_STMT): Take a 5th operand.
13 * cp-tree.h (RANGE_FOR_UNROLL): New macro.
14 (cp_convert_range_for): Adjust prototype.
15 (finish_while_stmt_cond): Likewise.
16 (finish_do_stmt): Likewise.
17 (finish_for_cond): Likewise.
18 * init.c (build_vec_init): Adjut call to finish_for_cond.
19 * parser.c (cp_parser_statement): Adjust call to
20 cp_parser_iteration_statement.
21 (cp_parser_for): Add unroll parameter and pass it in calls to
22 cp_parser_range_for and cp_parser_c_for.
23 (cp_parser_c_for): Add unroll parameter and pass it in call to
25 (cp_parser_range_for): Add unroll parameter, set in on RANGE_FOR_STMT
26 and pass it in call to cp_convert_range_for.
27 (cp_convert_range_for): Add unroll parameter and pass it in call to
29 (cp_parser_iteration_statement): Add unroll parameter and pass it in
30 calls to finish_while_stmt_cond, finish_do_stmt and cp_parser_for.
31 (cp_parser_pragma_ivdep): New static function.
32 (cp_parser_pragma_unroll): Likewise.
33 (cp_parser_pragma) <PRAGMA_IVDEP>: Add support for pragma Unroll.
34 <PRAGMA_UNROLL>: New case.
35 * pt.c (tsubst_expr) <FOR_STMT>: Adjust call to finish_for_cond.
36 <RANGE_FOR_STMT>: Pass unrolling factor to cp_convert_range_for.
37 <WHILE_STMT>: Adjust call to finish_while_stmt_cond.
38 <DO_STMT>: Adjust call to finish_do_stmt.
39 * semantics.c (finish_while_stmt_cond): Add unroll parameter and
40 build ANNOTATE_EXPR if present.
41 (finish_do_stmt): Likewise.
42 (finish_for_cond): Likewise.
43 (begin_range_for_stmt): Build RANGE_FOR_STMT with 5th operand.
45 2017-12-21 Nathan Sidwell <nathan@acm.org>
48 * parser.c (cp_parser_lambda_body): Remove obsolete
49 single-return-statement handling.
51 2017-12-21 Richard Sandiford <richard.sandiford@linaro.org>
52 Alan Hayward <alan.hayward@arm.com>
53 David Sherwood <david.sherwood@arm.com>
55 * constexpr.c (check_automatic_or_tls): Track polynomial
58 2017-12-19 Paolo Carlini <paolo.carlini@oracle.com>
61 * decl.c (check_array_designated_initializer): Not static.
62 * cp-tree.h (check_array_designated_initializer): Declare.
63 * typeck2.c (process_init_constructor_array): Call the latter.
64 * parser.c (cp_parser_initializer_list): Check the return value
65 of require_potential_rvalue_constant_expression.
67 2017-12-19 Martin Sebor <msebor@redhat.com>
71 * decl2.c (cplus_decl_attributes): Look up member functions
72 in the scope of their class.
74 2017-12-19 Jakub Jelinek <jakub@redhat.com>
76 * name-lookup.c (get_std_name_hint): Replace Yoda conditions with
77 typical order conditions.
78 * class.c (check_bitfield_decl): Likewise.
79 * pt.c (convert_template_argument): Likewise.
80 * decl.c (duplicate_decls): Likewise.
81 * typeck.c (commonparms): Likewise.
83 2017-12-19 Paolo Carlini <paolo.carlini@oracle.com>
85 * cp-tree.h: Fix typo in comment.
87 2017-12-18 Marek Polacek <polacek@redhat.com>
90 * constexpr.c (cxx_eval_call_expression): Only look into
91 constexpr_call_table if ctx->strict.
93 2017-12-18 Jakub Jelinek <jakub@redhat.com>
96 * decl2.c (save_template_attributes): Add flags argument, if
97 not ATTR_FLAG_TYPE_IN_PLACE, *decl_p is a type and we want to
98 modify TYPE_ATTRIBUTES, add them on type attribute variant.
100 2017-12-18 Nathan Sidwell <nathan@acm.org>
103 * name-lookup.c (name_lookup::search_unqualified): Don't search
104 parent namespace when looking for hidden things.
105 * pt.c (tsubst_friend_class): Always push to friend scope, drop
106 unneeded self-friend check. Inject new hidden friend into correct
109 2017-12-15 Jakub Jelinek <jakub@redhat.com>
112 * decl.c (cp_finish_decomp): Handle the case when tsize is not
113 error_mark_node, but doesn't fit into uhwi. Split up count != eltscnt
114 and !tree_fits_uhwi_p (tsize) error_at calls into error_n and inform_n
115 to handle plural forms properly.
118 * cp-tree.h (cp_maybe_mangle_decomp): Declare.
119 * decl.c (cp_maybe_mangle_decomp): New function.
120 (cp_finish_decomp): Don't SET_DECL_ASSEMBLER_NAME here.
121 * parser.c (cp_convert_range_for,
122 cp_parser_decomposition_declaration): Call cp_maybe_mangle_decomp.
123 * pt.c (tsubst_expr): Likewise.
124 * mangle.c (find_decomp_unqualified_name): New function.
125 (write_unqualified_name): Handle DECL_DECOMPOSITION_P
126 where DECL_ASSEMBLER_NAME is already set.
130 * typeck2.c (digest_init_r): Change nested argument type from bool to
131 int. Use code instead of TREE_CODE (type) where possible. If
132 nested == 2, diagnose initialization of flexible array member with
133 STRING_CST. Pass nested to process_init_constructor. Formatting fix.
134 (digest_init, digest_init_flags): Adjust digest_init_r caller.
135 (massage_init_elt): Add nested argument. Pass 2 instead of 1 to
136 digest_init_r's nested argument if nested is non-zero.
137 (process_init_constructor_array): Add nested argument. If nested == 2,
138 diagnose initialization of flexible array member with non-empty
139 braced enclosed list. Pass nested to massage_init_elt.
140 (process_init_constructor_record, process_init_constructor_union): Add
141 nested argument, pass it to massage_init_elt.
142 (process_init_constructor): Add nested argument, pass it to
143 process_init_constructor_{array,record,union}.
144 * init.c (find_field_init): Renamed to ...
145 (find_flexarray_init): ... this. Return NULL_TREE if init is
146 error_mark_node. Don't look through nested CONSTRUCTORs.
147 (warn_placement_new_too_small): Adjust caller.
150 * decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
151 call complete_type (TREE_TYPE (type)).
153 * tree.c (cxx_attribute_table, std_attribute_table): Swap
154 affects_type_identity and handler fields, adjust comments.
156 2017-12-15 Nathan Sidwell <nathan@acm.org>
159 * decl.c (xref_tag_1): Correct comments about template friends and
161 * friend.c (make_friend_class): Move comments concerning
162 self-friendliness to code dealing with such.
163 * pt.c (check_default_tmpl_args): Deal with template friend
165 (push_template_decl_real): Check default args for non-function
168 2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
170 * decl2.c (start_static_storage_duration_function): Avoid warning.
171 * typeck.c (cxx_safe_arg_type_equiv_p,
172 cxx_safe_function_type_cast_p): New function.
173 (build_reinterpret_cast_1): Implement -Wcast-function-type.
175 2017-12-14 Jakub Jelinek <jakub@redhat.com>
178 * pt.c (convert_nontype_argument): Diagnose
179 reduced_constant_expression_p expressions that aren't INTEGER_CST.
181 2017-12-13 Paolo Carlini <paolo.carlini@oracle.com>
184 * typeck.c (cp_build_modify_expr): Upon cxx_readonly_error
185 immediately return error_mark_node.
187 2017-12-13 Nathan Sidwell <nathan@acm.org>
190 * pt.c (tsubst_baselink): Don't repeat the lookup for
191 non-dependent baselinks.
193 2017-12-12 Jason Merrill <jason@redhat.com>
195 * decl.c (value_dependent_init_p): Check the type of a CONSTRUCTOR.
196 (type_dependent_init_p): Remove.
198 PR c++/82115 - ICE with variable initialized with its own address.
199 * cp-tree.h (struct lang_decl_base): Add dependent_init_p.
200 (DECL_DEPENDENT_INIT_P, SET_DECL_DEPENDENT_INIT_P): New.
201 * decl.c (cp_finish_decl): Set it.
202 (duplicate_decls): Copy it.
203 * pt.c (tsubst_decl): Clear it.
204 (value_dependent_expression_p): Revert earlier change. Check it.
206 2017-12-12 Alexandre Oliva <aoliva@redhat.com>
208 * constexpr.c (check_constexpr_ctor_body_1): Skip begin stmt
210 (constexpr_fn_retval): Likewise.
211 (potential_constant_expression_1): Likewise.
212 (cxx_eval_statement_list): Check that a begin stmt marker is
213 not used as the value of a statement list.
214 (cxx_eval_constant_expression): Return begin stmt markers
216 * cp-array-notation.c (stmt_location): New.
217 (cp_expand_cond_array_notations): Use it.
218 * cp-objcp-common.h (LANG_HOOKS_EMITS_BEGIN_STMT): Redefine as true.
219 * parser.c (add_debug_begin_stmt): New.
220 (cp_parser_statement): Call it.
221 * pt.c (tsubst_copy): Handle begin stmt markers.
223 2017-12-07 Martin Sebor <msebor@redhat.com>
226 * cp-tree.h (decls_match): Add default argument.
227 * decl.c (decls_match): Avoid calling into the target back end
228 and triggering an error.
229 * decl2.c (cplus_decl_attributes): Look up existing declaration and
230 pass it to decl_attributes.
231 * tree.c (cxx_attribute_table): Initialize new member of struct
234 2017-12-06 Jakub Jelinek <jakub@redhat.com>
237 * decl2.c (grokfield): Diagnose = delete redefinition of a friend.
239 2017-12-06 Jason Merrill <jason@redhat.com>
241 * call.c (convert_for_arg_passing): Pass NULL_TREE to
242 targetm.calls.promote_prototypes.
243 (type_passed_as): Likewise.
245 PR c++/82115 - ICE with variable initialized with its own address.
246 * pt.c (value_dependent_expression_p): Add lval parameter. Don't
247 consider DECL_INITIAL if it's true.
249 2017-12-06 David Malcolm <dmalcolm@redhat.com>
252 * name-lookup.c (consider_binding_level): Don't suggest names that
253 are reserved for use by the implementation.
255 2017-12-06 David Malcolm <dmalcolm@redhat.com>
257 * name-lookup.c: Include "c-family/c-spellcheck.h".
259 2017-12-05 Jason Merrill <jason@redhat.com>
261 PR c++/82331 - ICE with variadic partial specialization of auto
262 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl
263 around call to tsubst.
265 2017-12-05 Nathan Sidwell <nathan@acm.org>
268 * tree.c (build_min): Check CAST_EXPR arg for OVERLOADs.
270 2017-12-05 Martin Liska <mliska@suse.cz>
271 Jakub Jelinek <jakub@redhat.com>
273 * typeck.c (pointer_diff): Add new argument and instrument
275 (cp_build_binary_op): Create compound expression if doing an
278 2017-12-05 Jakub Jelinek <jakub@redhat.com>
280 * cp-gimplify.c (cp_maybe_instrument_return): Don't add
281 __builtin_unreachable if -O0 or if -fsanitize=unreachable.
283 2017-12-04 Jason Merrill <jason@redhat.com>
285 PR c++/83273 - constexpr if allows non-constant condition
286 * semantics.c (finish_if_stmt_cond): Use require_constant_expression
287 rather than is_constant_expression.
288 * constexpr.c (potential_constant_expression_1) [LAMBDA_EXPR]: Allow
291 2017-12-01 Jason Merrill <jason@redhat.com>
293 Give #include hints for <complex>.
294 * name-lookup.c (get_std_name_hint): Add <complex>.
295 * parser.c (cp_parser_diagnose_invalid_type_name): Call
296 suggest_alternative_in_explicit_scope.
297 (cp_parser_namespace_name): Likewise.
299 PR c++/79228 - extensions hide C++14 complex literal operators
300 * parser.c (cp_parser_userdef_numeric_literal): Be helpful about
303 2017-12-01 Jakub Jelinek <jakub@redhat.com>
305 * parser.c (cp_parser_new): Don't clear cilk_simd_fn_info.
306 (parsing_nsdmi): Adjust comment.
307 (cp_parser_omp_for_loop_init): Likewise.
308 * parser.h (struct cp_omp_declare_simd_data): Adjust comment.
309 (struct cp_parser): Remove cilk_simd_fn_info field.
310 * cp-tree.h (cilk_valid_spawn): Remove.
313 * cp-gimplify.c (genericize_switch_stmt): Emit LABEL_EXPR for the
314 break label into SWITCH_BODY instead of after it and set
315 SWITCH_BREAK_LABEL_P on it.
316 * parser.c (cp_parser_objc_expression): Add FALLTHRU comment to avoid
317 -Wimplicit-fallthrough warning.
319 2017-11-30 Jason Merrill <jason@redhat.com>
321 PR c++/82219 - bogus -Wignored-qualifiers with template
322 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Suppress
323 -Wignored-qualifiers.
325 2017-11-29 David Malcolm <dmalcolm@redhat.com>
327 * parser.c (cp_parser_unary_expression): Generate a location for
329 (cp_parser_trait_expr): Generate and return a location_t,
330 converting the return type from tree to cp_expr.
331 (cp_parser_static_assert): Pass location of the condition to
332 finish_static_assert, rather than that of the "static_assert"
333 token, where available.
335 2017-11-29 Paolo Carlini <paolo.carlini@oracle.com>
338 * lambda.c (nonlambda_method_basetype): Don't use LAMBDA_TYPE_P
341 2017-11-29 Jason Merrill <jason@redhat.com>
343 PR c++/82760 - memory corruption with aligned new.
344 * call.c (build_operator_new_call): Update *args if we add the
347 2017-11-28 Jakub Jelinek <jakub@redhat.com>
350 * cp-tree.h (SWITCH_STMT_ALL_CASES_P): Define.
351 (SWITCH_STMT_NO_BREAK_P): Define.
352 (note_break_stmt, note_iteration_stmt_body_start,
353 note_iteration_stmt_body_end): Declare.
354 * decl.c (struct cp_switch): Add has_default_p, break_stmt_seen_p
355 and in_loop_body_p fields.
356 (push_switch): Clear them.
357 (pop_switch): Set SWITCH_STMT_CANNOT_FALLTHRU_P if has_default_p
358 and !break_stmt_seen_p. Assert in_loop_body_p is false.
359 (note_break_stmt, note_iteration_stmt_body_start,
360 note_iteration_stmt_body_end): New functions.
361 (finish_case_label): Set has_default_p when both low and high
363 * parser.c (cp_parser_iteration_statement): Use
364 note_iteration_stmt_body_start and note_iteration_stmt_body_end
365 around parsing iteration body.
366 * pt.c (tsubst_expr): Likewise.
367 * cp-objcp-common.c (cxx_block_may_fallthru): Return false for
368 SWITCH_STMT which contains no BREAK_STMTs, contains a default:
369 CASE_LABEL_EXPR and where SWITCH_STMT_BODY isn't empty and
371 * semantics.c (finish_break_stmt): Call note_break_stmt.
372 * cp-gimplify.c (genericize_switch_stmt): Copy SWITCH_STMT_ALL_CASES_P
373 bit to SWITCH_ALL_CASES_P. Assert that if SWITCH_STMT_NO_BREAK_P then
374 the break label is not TREE_USED.
376 2017-11-28 Julia Koval <julia.koval@intel.com>
377 Sebastian Peryt <sebastian.peryt@intel.com>
379 * Make-lang.in (cp/cp-array-notation.o, cp/cp-cilkplus.o): Delete.
380 * call.c (convert_for_arg_passing, build_cxx_call): Remove cilkplus.
381 * constexpr.c (potential_constant_expression_1): Ditto.
382 * cp-array-notation.c: Delete.
383 * cp-cilkplus.c: Ditto.
384 * cp-cilkplus.h: Ditto.
385 * cp-gimplify.c (cp_gimplify_expr, cp_fold_r, cp_genericize): Remove
387 * cp-objcp-common.c (ARRAY_NOTATION_REF): Delete.
388 * cp-tree.h (cilkplus_an_triplet_types_ok_p): Delete.
389 * decl.c (grokfndecl, finish_function): Remove cilkplus condition.
390 * error.c (dump_decl, dump_expr): Remove ARRAY_NOTATION_REF condition.
391 * lambda.c (cp-cilkplus.h): Remove.
392 * parser.c (cp_parser_cilk_simd, cp_parser_cilk_for,
393 cp_parser_cilk_simd_vectorlength): Delete.
394 (cp_debug_parser, cp_parser_ctor_initializer_opt_and_function_body,
395 cp_parser_postfix_expression,
396 cp_parser_postfix_open_square_expression,
397 cp_parser_statement, cp_parser_jump_statement,
398 cp_parser_direct_declarator,
399 cp_parser_late_return_type_opt, cp_parser_gnu_attribute_list,
400 cp_parser_omp_clause_name, cp_parser_omp_clause_aligned,
401 cp_parser_omp_clause_linear, cp_parser_omp_all_clauses,
403 cp_parser_omp_for_cond, cp_parser_omp_for_incr,
404 cp_parser_omp_for_loop_init,
405 cp_parser_omp_for_loop,
406 cp_parser_omp_declare_simd): Remove cilkplus support.
407 (CILK_SIMD_FN_CLAUSE_MASK, cp_parser_late_parsing_cilk_simd_fn_info,
408 cp_parser_cilk_grainsize): Remove.
409 (cp_parser_pragma, c_parse_file): Remove cilkplus support.
410 (cp_parser_cilk_simd_vectorlength, cp_parser_cilk_simd_linear,
411 cp_parser_cilk_simd_clause_name, cp_parser_cilk_simd_all_clauses,
412 cp_parser_cilk_simd, cp_parser_cilk_for): Remove.
413 * parser.h (IN_CILK_SIMD_FOR, IN_CILK_SPAWN): Remove.
414 * pt.c (tsubst_attribute, tsubst_expr, tsubst_copy_and_build): Remove
416 * semantics.c (finish_goto_stmt, begin_while_stmt, finish_do_body,
417 finish_init_stmt, finish_switch_cond, simplify_aggr_init_expr,
418 finish_omp_clauses, finish_omp_clauses, finish_omp_for): Remove
421 * tree.c (lvalue_kind): Remove ARRAY_NOTATION_REF conditon.
422 * typeck.c (cp_build_array_ref, cp_build_compound_expr,
423 check_return_expr): Remove cilkplus support.
425 2017-11-28 Jakub Jelinek <jakub@redhat.com>
427 * cp-gimplify.c (genericize_switch_stmt): Build SWITCH_EXPR using
428 build2_loc instead of build3_loc.
430 2017-11-27 Martin Sebor <msebor@redhat.com>
433 * init.c (warn_placement_new_too_small): Use offset_int instead of
436 2017-11-27 Jakub Jelinek <jakub@redhat.com>
439 * parser.c (cp_parser_decomposition_declaration): Reject just
440 BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather
441 than all such CONSTRUCTORs, and only if is_direct_init is true.
443 2017-11-27 Jason Merrill <jason@redhat.com>
445 * pt.c (primary_template_specialization_p): Rename from
446 primary_template_instantiation_p. Don't check
447 DECL_TEMPLATE_INSTANTIATION.
448 * call.c, cp-tree.h, decl2.c: Adjust.
450 2017-11-27 Jakub Jelinek <jakub@redhat.com>
453 * cp-gimplify.c (cp_fold) <case COND_EXPR>: Don't return immediately
454 for VOID_TYPE_P COND_EXPRs, instead fold the operands and if op0 is
455 INTEGER_CST, ensure that both op1 and op2 are non-NULL and fall
456 through into normal folding, otherwise just rebuild x if any op
459 2017-11-14 Boris Kolpackov <boris@codesynthesis.com>
461 * Make-lang.in (c++.install-plugin): Install backend import library.
463 2017-11-23 Jakub Jelinek <jakub@redhat.com>
465 * parser.c (cp_parser_omp_declare): Change return type to bool from
466 void, return true for declare simd.
467 (cp_parser_pragma): Return cp_parser_omp_declare returned value
468 rather than always false.
470 2017-11-23 Mike Stump <mikestump@comcast.net>
471 Eric Botcazou <ebotcazou@adacore.com>
473 * pt.c (tsubst_expr) <ANNOTATE_EXPR>: Recurse on 3rd operand.
474 * semantics.c (finish_while_stmt_cond): Pass 3rd operand to
476 (finish_do_stmt): Likewise.
477 (finish_for_cond): Likewise.
479 2017-11-22 Jakub Jelinek <jakub@redhat.com>
482 * name-lookup.c (member_name_cmp): Return 0 if a == b.
484 2017-11-22 David Malcolm <dmalcolm@redhat.com>
487 * error.c (type_to_string): Add leading comment. Add params
488 "postprocessed", "quote", and "show_color", using them to fix
489 quoting of the "aka" for types involving typedefs.
490 (arg_to_string): Update for new params to type_to_string.
491 (cxx_format_postprocessor::handle): Likewise.
492 (cp_printer): Convert penultimate param from bool to bool *.
493 Update call to type_to_string and calls to
494 defer_phase_2_of_type_diff.
496 2017-11-22 Marek Polacek <polacek@redhat.com>
501 * class.c (layout_class_type): Set DECL_PADDING_P on padding.
502 * decl.c (cxx_init_decl_processing): Set TRANSLATION_UNIT_WARN_EMPTY_P.
503 (grokdeclarator): Set DECL_PADDING_P on unnamed bit-fields.
505 2017-11-21 Martin Liska <mliska@suse.cz>
507 * class.c (finalize_literal_type_property): Add quotes for
509 (explain_non_literal_class): Likewise.
510 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
511 (is_valid_constexpr_fn): Likewise.
512 (check_constexpr_ctor_body): Likewise.
513 (register_constexpr_fundef): Likewise.
514 (explain_invalid_constexpr_fn): Likewise.
515 (cxx_eval_builtin_function_call): Likewise.
516 (cxx_eval_call_expression): Likewise.
517 (cxx_eval_loop_expr): Likewise.
518 (potential_constant_expression_1): Likewise.
519 * decl.c (check_previous_goto_1): Likewise.
520 (check_goto): Likewise.
521 (grokfndecl): Likewise.
522 (grokdeclarator): Likewise.
523 * error.c (maybe_print_constexpr_context): Likewise.
524 * method.c (process_subob_fn): Likewise.
525 (defaulted_late_check): Likewise.
526 * parser.c (cp_parser_compound_statement): Likewise.
528 2017-11-21 Marc Glisse <marc.glisse@inria.fr>
530 * constexpr.c (cxx_eval_constant_expression,
531 potential_constant_expression_1): Handle POINTER_DIFF_EXPR.
532 * cp-gimplify.c (cp_fold): Likewise.
533 * error.c (dump_expr): Likewise.
534 * typeck.c (pointer_diff): Use POINTER_DIFF_EXPR.
536 2017-11-21 Jakub Jelinek <jakub@redhat.com>
538 P0428R2 - familiar template syntax for generic lambdas
539 * parser.c (cp_parser_lambda_declarator_opt): Don't pedwarn
540 for cxx2a and above, reword pedwarn for C++14/C++17.
542 2017-11-20 David Malcolm <dmalcolm@redhat.com>
545 * name-lookup.c: Include "c-family/known-headers.h"
546 (lookup_name_fuzzy): Call get_cp_stdlib_header_for_name and
547 potentially return a new suggest_missing_header hint.
549 2017-11-20 David Malcolm <dmalcolm@redhat.com>
552 * name-lookup.c (class macro_use_before_def): New class.
553 (lookup_name_fuzzy): Detect macro that were used before being
554 defined, and report them as such.
556 2017-11-20 Jason Merrill <jason@redhat.com>
558 * decl2.c (constrain_class_visibility): Don't warn about artificial
561 2017-11-20 Jakub Jelinek <jakub@redhat.com>
563 P0329R4: Designated Initialization
564 * parser.c (cp_parser_initializer_clause): List in comment grammar
565 designated-initializer-list.
566 (cp_parser_initializer_list): Allow .identifier = without pedwarn for
567 C++2A, parse .identifier { ... }. Improve location_t argument to
568 pedwarn. Add pedwarn for [cst] = designators. Diagnose ... in
569 designated initializer list. Diagnose mixing designated and
570 non-designated initializer clauses for C++2A. Diagnose duplicated
571 identifiers in designators.
572 * name-lookup.h (search_anon_aggr): New declaration.
573 * name-lookup.c (fields_linear_search): Use search_anon_aggr.
574 (search_anon_aggr): New function.
575 * typeck2.c (process_init_constructor_record): Allow designator
576 to skip over some non-static data members. Handle anonymous
577 aggregates. Add diagnostics for designator order not matching
578 member declaration order.
580 2017-11-20 David Malcolm <dmalcolm@redhat.com>
582 * name-lookup.c: Define INCLUDE_UNIQUE_PTR before including system.h.
583 Include "c-family/name-hint.h"
584 (suggest_alternatives_for): Convert "fuzzy_name" from const char *
585 to name_hint, and rename to "hint". Pass location to
587 (lookup_name_fuzzy): Convert return type from const char *
588 to name_hint. Add location_t param.
589 * parser.c: Define INCLUDE_UNIQUE_PTR before including system.h.
590 Include "c-family/name-hint.h"
591 (cp_parser_diagnose_invalid_type_name): Convert
592 "suggestion" from const char * to name_hint, and rename to "hint".
593 Pass location to lookup_name_fuzzy.
595 2017-11-20 Nathan Sidwell <nathan@acm.org>
599 * call.c (build_call_a): Don't set CALL_FROM_THUNK_P for inherited
601 * cp-gimplify.c (cp_genericize_r): Restore THUNK dereference
602 inhibibition check removed in previous c++/78495 change.
604 2017-11-20 Jakub Jelinek <jakub@redhat.com>
607 * constexpr.c (cxx_eval_vector_conditional_expression): New function.
608 (cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead
609 of cxx_eval_conditional_expression.
611 2017-11-19 Jakub Jelinek <jakub@redhat.com>
615 * cp-gimplify.c (c_fully_fold): Add LVAL argument, call
616 cp_fold_maybe_rvalue instead of cp_fold_rvalue and pass it !LVAL.
618 2017-11-16 Jason Merrill <jason@redhat.com>
620 PR c++/79092 - non-type args of different types are different
621 * tree.c (cp_tree_equal): Check the type of constants.
622 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Handle UNIFY_ALLOW_INTEGER
623 when comparing to previously deduced argument.
624 (maybe_convert_nontype_argument): New.
625 (convert_nontype_argument): Call it.
626 (tsubst_copy_and_build): Handle partial instantiation of
628 (unify): Ignore type when deducing from array bound.
629 (dependent_type_p_r): Handle DEFERRED_NOEXCEPT.
630 (value_dependent_expression_p): Any type-dependent expression is
631 value-dependent. Handle IMPLICIT_CONV_EXPR.
632 * cp-tree.h (IMPLICIT_CONV_EXPR_NONTYPE_ARG): New.
633 * mangle.c (write_template_arg): Strip IMPLICIT_CONV_EXPR.
635 2017-11-16 Nathan Sidwell <nathan@acm.org>
639 * cp-objcp-common.h (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME):
641 * cp-tree.h (overwrite_mangling): Declare.
642 * decl2.c (struct mangled_decl_hash): Entries are deletable.
643 (overwrite_mangling): New.
646 * decl.c (xref_tag_1): Push lambda into current scope.
647 * name-lookup.c (do_pushtag): Don't deal with ts_lambda here.
649 2017-11-15 Nathan Sidwell <nathan@acm.org>
652 * lambda.c (lambda_capture_field_type): Function references are
653 always catured by reference.
655 2017-11-15 Martin Liska <mliska@suse.cz>
657 * decl.c (begin_destructor_body): Use cp_build_fold_indirect_ref
658 instead of cp_build_indirect_ref.
660 2017-11-15 Martin Liska <mliska@suse.cz>
662 * decl.c (begin_destructor_body): In case of VPTR sanitization
663 (with disabled recovery), zero vptr in order to catch virtual calls
664 after lifetime of an object.
666 2017-11-14 Jason Merrill <jason@redhat.com>
668 Use GTY((cache)) on some hash tables.
669 * decl.c (decomp_type_table): Use tree_cache_map.
670 * init.c (nsdmi_inst): Likewise.
671 * pt.c (defarg_ints): Likewise.
672 * cp-objcp-common.c (cp_get_debug_type): Likewise.
674 2017-11-13 Jason Merrill <jason@redhat.com>
676 Capture adjustments for P0588R1.
677 * semantics.c (process_outer_var_ref): Capture variables when
678 they are named; complain about non-capture uses when odr-used.
679 * expr.c (mark_use): Rvalue use looks through capture proxy.
680 * constexpr.c (potential_constant_expression_1): Improve error about
681 use of captured variable.
682 * lambda.c (need_generic_capture, dependent_capture_r)
683 (do_dependent_capture, processing_nonlambda_template): Remove.
684 * call.c (build_this): Remove uses of the above.
685 * decl.c (cp_finish_decl): Likewise.
686 * semantics.c (maybe_cleanup_point_expr)
687 (maybe_cleanup_point_expr_void, finish_goto_stmt)
688 (maybe_convert_cond): Likewise.
689 * typeck.c (check_return_expr): Likewise.
692 * typeck.c (cp_build_fold_indirect_ref): New.
693 (cp_build_indirect_ref_1): Split out from cp_build_indirect_ref.
694 Add 'fold' parameter.
695 * cp-tree.h: Declare cp_build_fold_indirect_ref.
696 * call.c, class.c, cp-ubsan.c, decl.c, except.c, init.c, lambda.c,
697 parser.c, rtti.c, tree.c, typeck.c, typeck2.c: Use it.
698 * parser.c (do_range_for_auto_deduction): Use RO_UNARY_STAR.
699 (cp_convert_range_for): Likewise.
700 * typeck2.c (build_x_arrow): Use RO_ARROW.
702 * cp-ubsan.c (cp_ubsan_check_member_access_r): Fix handling of
703 INDIRECT_REF of ADDR_EXPR.
705 PR c++/82360 - ICE with static_cast in template.
706 * call.c (perform_direct_initialization_if_possible): Check
707 processing_template_decl.
708 * typeck.c (build_static_cast_1): Likewise.
710 2017-11-13 Ville Voutilainen <ville.voutilainen@gmail.com>
712 Remove the null check from placement new in all modes
713 * init.c (build_new_1): Don't do a null check for
714 a namespace-scope non-replaceable placement new
715 in any mode unless -fcheck-new is provided.
717 2017-11-07 Boris Kolpackov <boris@codesynthesis.com>
719 * Make-lang.in (CP_PLUGIN_HEADERS): Add operators.def since included
722 2017-11-07 Jakub Jelinek <jakub@redhat.com>
725 * cp-gimplify.c (cxx_omp_clause_apply_fn): For methods pass i - 1 to
726 convert_default_arg instead of i.
728 2017-11-06 Jason Merrill <jason@redhat.com>
730 P0704R1 - fixing const-qualified pointers to members
731 * typeck2.c (build_m_component_ref): Also accept in lower stds with
734 2017-11-06 Paolo Carlini <paolo.carlini@oracle.com>
737 * decl2.c (finish_static_data_member_decl): If there's an initializer,
738 complete the type and re-apply the quals.
740 2017-11-06 Martin Liska <mliska@suse.cz>
743 * constexpr.c (cxx_eval_builtin_function_call): Handle
744 __builtin_unreachable call.
745 (get_function_named_in_call): Declare function earlier.
746 (constexpr_fn_retval): Skip __builtin_unreachable.
747 * cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
749 (cp_maybe_instrument_return): ... this.
750 (cp_genericize): Call the function unconditionally.
752 2017-11-03 Nathan Sidwell <nathan@acm.org>
755 * decl.c (grokdeclarator): Protect MAYBE_CLASS things from paren
758 2017-11-02 Paolo Carlini <paolo.carlini@oracle.com>
761 * pt.c (make_pack_expansion): Add tsubst_flags_t parameter.
762 (expand_integer_pack, convert_template_argument, coerce_template_parms,
763 gen_elem_of_pack_expansion_instantiation, tsubst_pack_expansion,
764 unify): Adjust calls.
765 * tree.c (cp_build_qualified_type_real): Likewise.
766 * cp-tree.h (make_pack_expansion): Adjust declaration.
768 2017-11-02 Nathan Sidwell <nathan@acm.org>
770 * cp-tree.h (IDENTIFIER_NEWDEL_OP_P): Restore, adjust.
771 (IDENTIFIER_NEW_OP_P): New.
772 * decl.c (grokdeclarator): Restore IDENTIFIER_NEWDEL_OP_P use.
773 * pt.c (push_template_decl_real): Likewise.
774 * typeck.c (check_return_expr): Use IDENTIFIER_NEW_OP_P.
777 * decl.c (grokdeclarator): Don't warn when parens protect a return
778 type from a qualified name.
780 2017-11-01 Nathan Sidwell <nathan@acm.org>
782 * cp-tree.h (enum cp_identifier_kind): Delete cik_newdel_op.
783 Renumber and reserve udlit value.
784 (IDENTIFIER_NEWDEL_OP_P): Delete.
785 (IDENTIFIER_OVL_OP_P): New.
786 (IDENTIFIER_ASSIGN_OP_P): Adjust.
787 (IDENTIFIER_CONV_OP_P): Adjust.
788 (IDENTIFIER_OVL_OP_INFO): Adjust.
789 (IDENTIFIER_OVL_OP_FLAGS): New.
790 * decl.c (grokdeclarator): Use IDENTIFIER_OVL_OP_FLAGS.
791 * lex.c (get_identifier_kind_name): Adjust.
792 (init_operators): Don't special case new/delete ops.
793 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_P.
794 * pt.c (push_template_decl_real): Use IDENTIFIER_OVL_OP_FLAGS.
795 * typeck.c (check_return_expr): Likewise.
797 * cp-tree.h (assign_op_identifier, call_op_identifier): Use
799 (struct lang_decl_fn): Use compressed operator code.
800 (DECL_OVERLOADED_OPERATOR_CODE): Replace with ...
801 (DECL_OVERLOADED_OPERATOR_CODE_RAW): ... this.
802 (DECL_OVERLOADED_OPERATOR_CODE_IS): Use it.
803 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE_RAW.
804 (build_library_fn): Likewise.
805 (grok_op_properties): Likewise.
806 * mangle.c (write_unqualified_name): Likewise.
807 * method.c (implicitly_declare_fn): Likewise.
808 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_IS.
810 * cp-tree.h (IDENTIFIER_CP_INDEX): Define.
811 (enum ovl_op_flags): Add OVL_OP_FLAG_AMBIARY.
812 (enum ovl_op_code): New.
813 (struct ovl_op_info): Add ovl_op_code field.
814 (ovl_op_info): Size by OVL_OP_MAX.
815 (ovl_op_mapping, ovl_op_alternate): Declare.
816 (OVL_OP_INFO): Adjust for mapping array.
817 (IDENTIFIER_OVL_OP_INFO): New.
818 * decl.c (ambi_op_p, unary_op_p): Delete.
819 (grok_op_properties): Use IDENTIFIER_OVL_OP_INFO and
821 * lex.c (ovl_op_info): Adjust and static initialize.
822 (ovl_op_mappings, ovl_op_alternate): Define.
823 (init_operators): Iterate over ovl_op_info array and init mappings
825 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO.
826 * operators.def (DEF_OPERATOR): Remove KIND parm.
827 (DEF_SIMPLE_OPERATOR): Delete.
828 (OPERATOR_TRANSITION): Expand if defined.
830 2017-10-31 David Malcolm <dmalcolm@redhat.com>
832 * pt.c (listify): Use %< and %> for description of #include.
834 2017-10-31 David Malcolm <dmalcolm@redhat.com>
836 * class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
838 * name-lookup.c (suggest_alternatives_for): Update for renaming of
840 (maybe_suggest_missing_header): Likewise.
841 (suggest_alternative_in_explicit_scope): Likewise.
842 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
843 renaming of error_at_rich_loc.
844 (cp_parser_string_literal): Likewise.
845 (cp_parser_nested_name_specifier_opt): Likewise.
846 (cp_parser_cast_expression): Likewise for renaming of
848 (cp_parser_decl_specifier_seq): Likewise for renaming of
849 error_at_rich_loc and warning_at_rich_loc.
850 (cp_parser_elaborated_type_specifier): Likewise for renaming of
852 (cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
854 (cp_parser_virt_specifier_seq_opt): Likewise.
855 (cp_parser_class_specifier_1): Likewise.
856 (cp_parser_class_head): Likewise.
857 (cp_parser_member_declaration): Likewise for renaming of
858 pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
859 (cp_parser_enclosed_template_argument_list): Likewise for renaming
860 of error_at_rich_loc.
861 (set_and_check_decl_spec_loc): Likewise.
862 * pt.c (listify): Likewise.
863 * rtti.c (typeid_ok_p): Likewise.
864 * semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
866 * typeck.c (access_failure_info::maybe_suggest_accessor): Update
867 for renaming of inform_at_rich_loc.
868 (finish_class_member_access_expr): Likewise for renaming of
871 2017-10-31 Nathan Sidwell <nathan@acm.org>
873 * cp-tree.h (struct operator_name_info_t): Rename to ...
874 (struct ovl_op_info_t): ... here. Add tree_code field.
875 (operator_name_info, assignment_operator_name_info): Delete.
876 (ovl_op_info): Declare.
877 (OVL_OP_INFO): Adjust.
878 * decl.c (grok_op_properties): Use ovl_op_flags.
879 * lex.c (operator_name_info, assignment_operator_name_info):
881 (ovl_op_info): Define.
882 (set_operator_ident): Adjust.
883 (init_operators): Set tree_code.
884 * mangle.c (write_unqualified_id): Adjust operator array scan.
886 * lex.c (init_operators): Allow NULL operator name. Don't add
888 * operators.def: Use NULL for mangling only operators. Move to
889 after regular operators but move assignment operators last.
891 * cp-tree.h (enum ovl_op_flags): New.
892 (struct operator_name_info_t): Rename arity to flags.
893 * lex.c (set_operator_ident): New.
894 (init_operators): Use it. Adjust for flags.
895 * mangle.c (write_unqualified_id): Adjust for flags.
896 * operators.def: Replace arity with flags.
898 * cp-tree.h (ovl_op_identifier): New.
899 (assign_op_identifier, call_op_identifier): Adjust.
900 (cp_operator_id, cp_assignment_operator_ide): Delete.
901 (SET_OVERLOADED_OPERATOR_CODE): Delete.
903 * call.c (op_error): Use OVL_OP_INFO.
904 (build_conditional_expr_1): Use ovl_op_identifier.
905 (build_new_op_1): Use OVL_OP_INFO & ovl_op_identifier.
906 (build_op_delete_call): Likewise.
907 * class.c (type_requires_array_cookie): Use ovl_op_identifier.
908 * decl.c (duplicate_decls): Directly copy operator code.
909 (builtin_function_1): Do not set operator code.
910 (build_library_fn): Directly set operator code.
911 (push_cp_library_fn): Use ovl_op_identifier.
912 (grok_op_properties): Directly set operator code.
913 * decl2.c (maybe_warn_sized_delete): Use ovl_op_identifier.
914 * error.c (dump_expr): Use OVL_OP_INFO.
915 (op_to_string): Add assop arg. Use OVL_OP_INFO.
916 (assop_to_string): Delete.
917 (args_to_string): Adjust.
918 * init.c (build_new_1): Use ovl_op_identifier.
919 * mangle.c (write_unqualified_name): Use OVL_OP_INFO.
920 (write_expression): Likewise.
921 * method.c (synthesized_method_walk): Use ovl_op_identifier.
922 (implicitly_declare_fn): Use assign_op_identifier. Directly set
924 * name-lookup.c (get_class_binding): Use assign_op_identifier.
925 * parser.c (cp_parser_operator): Use ovl_op_identifier.
926 (cp_parser_omp_clause_reduction): Likewise.
927 * semantics.c (omp_reduction_id): Likewise.
928 * typeck.c (cxx_sizeof_or_alignof_type): Use OVL_OP_INFO.
930 * cp-tree.h (assign_op_identifier, call_op_identifier): Define.
931 (LAMBDA_FUNCTION_P): Use DECL_OVERLOADED_OPERATOR_IS.
932 (DECL_OVERLOADED_OPERATOR_P): Just retuurn true/false.
933 (DECL_OVERLOADED_OPERATOR_CODE, DECL_OVERLOADED_OPERATOR_IS): Define.
934 * call.c (add_function_candidate): Use
935 DECL_OVERLOADED_OPERATOR_IS.
936 (build_op_call_1): Use call_op_identifier &
937 DECL_OVERLOADED_OPERATOR_IS.
938 (build_over_call): Likewise.
939 (has_trivial_copy_assign_p): Use assign_op_identifier.
940 (build_special_member_call): Likewise.
941 * class.c (dfs_declare_virt_assop_and_dtor): Likewise.
942 (vbase_has_user_provided_move_assign,
943 classtype_has_move_assign_or_move_ctor_p): Likewise.
944 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE.
945 (grok_special_member_properties): Use assign_op_identifier.
946 (start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS.
947 * decl2.c (mark_used): Use DECL_CONV_FN_P.
948 * dump.c (dump_access): Delete prototype.
950 (cp_dump_tree): Don't call it.
951 * lambda.c (lambda_function): Use call_op_identifier.
952 (maybe_add_lambda_conv_op): Not an overloaded operator. Remove
954 * mangle.c (write_unqualified_name): Use DECL_OVERLOADED_OPERTOR_CODE.
955 * method.c (do_build_copy_assign): Use assign_op_identifier.
956 (synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS.
957 (get_copy_assign): Use assign_op_identifier.
958 (synthesized_method_walk): Likewise.
959 (defaultable_fn_check): Use DECL_OVERLOADED_OPERATOR_IS.
960 * parser.c (cp_parser_lambda_declarator_opt): Use
962 * semanitics.c (classtype_has_nothrow_assign_or_copy_p): Use
963 assign_op_identifier.
964 * tree.c (special_function_p): Use DECL_OVERLOADED_OPERATOR_IS.
965 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_CODE.
966 (check_return_expr): Use assign_op_identifier.
968 2017-10-30 Paolo Carlini <paolo.carlini@oracle.com>
971 * pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
972 unconditionally call convert_from_reference.
974 2017-10-30 Nathan Sidwell <nathan@acm.org>
976 * call.c (build_op_call_1): Test for FUNCTION_DECL in same manner
977 as a few lines earlier.
978 * cp-tree.h (PACK_EXPANSION_PATTERN): Fix white space.
979 * decl.c (grokfndecl): Fix indentation.
980 (compute_array_index_type): Use processing_template_decl_sentinel.
981 (grok_op_properties): Move warnings to end. Reorder other checks
982 to group similar entities. Tweak diagnostics.
983 * lex.c (unqualified_name_lookup_error): No need to check name is
984 not ERROR_MARK operator.
985 * parser.c (cp_parser_operator): Select operator code before
987 * typeck.c (check_return_expr): Fix indentation and line wrapping.
989 2017-10-27 Paolo Carlini <paolo.carlini@oracle.com>
991 * pt.c (invalid_nontype_parm_type_p): Return a bool instead of an int.
993 2017-10-26 Nathan Sidwell <nathan@acm.org>
995 * decl.c (sort_labels): Restore function.
996 (pop_labels): Sort labels
997 (identify_goto): Add translation markup.
999 2017-10-25 Nathan Sidwell <nathan@acm.org>
1001 Kill IDENTIFIER_LABEL_VALUE.
1002 * cp-tree.h (lang_identifier): Delete label_value slot.
1003 (IDENTIFIER_LABEL_VALUE, SET_IDENTIFIER_LABEL_VALUE): Delete.
1004 (struct named_label_hasher): Rename to ...
1005 (struct named_label_hash): ... here. Reimplement.
1006 (struct language_function): Adjust x_named_labels.
1007 * name-lookup.h (struct cp_label_binding): Delete.
1008 (struct cp_binding_level): Delete shadowed_labels slot.
1009 * decl.c (struct named_label_entry): Add name and outer slots.
1010 (pop_label): Rename to ...
1011 (check_label_used): ... here. Don't pop.
1012 (note_label, sort_labels): Delete.
1013 (pop_labels, pop_local_label): Reimplement.
1014 (poplevel): Pop local labels as any other decl. Remove
1015 shadowed_labels handling.
1016 (named_label_hash::hash, named_label_hash::equal): New.
1017 (make_label_decl): Absorb into ...
1018 (lookup_label_1): ... here. Add making_local_p arg, reimplement.
1019 (lookup_label, declare_local_label): Adjust.
1020 (check_goto, define_label): Adjust.
1021 * lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE.
1022 * ptree.c (cxx_print_identifier): Don't print identifier binding.
1024 * decl.c (identifier_goto): Reduce duplication.
1025 (check_previous_goto_1): Likewise.
1026 (check_goto): Move var decls to initialization.
1027 (check_omp_return, define_label_1, define_label): Likewise.
1029 2017-10-25 Jakub Jelinek <jakub@redhat.com>
1032 * decl.c (duplicate_decls): Copy "omp declare simd" attributes from
1033 newdecl to corresponding __builtin_ if any.
1035 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
1038 * decl.c (duplicate_decls): Warn for built-in functions declared as
1039 non-function, use OPT_Wbuiltin_declaration_mismatch.
1041 * decl.c (duplicate_decls): Avoid redundant '+' in warning_at.
1043 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
1046 * pt.c (value_dependent_expression_p, [TRAIT_EXPR]): Handle
1047 a TREE_LIST as TRAIT_EXPR_TYPE2.
1049 2017-10-24 Mukesh Kapoor <mukesh.kapoor@oracle.com>
1050 Paolo Carlini <paolo.carlini@oracle.com>
1053 * cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped
1054 enumeration type whose underlying type is fixed.
1056 2017-10-23 Paolo Carlini <paolo.carlini@oracle.com>
1059 * semantics.c (finish_compound_literal): Check do_auto_deduction
1060 return value for error_mark_node.
1062 2017-10-23 Jason Merrill <jason@redhat.com>
1064 PR c++/77369 - wrong noexcept handling in C++14 and below
1065 * tree.c (strip_typedefs): Canonicalize TYPE_RAISES_EXCEPTIONS.
1067 2017-10-20 Nathan Sidwell <nathan@acm.org>
1069 * class.c (layout_class_type): Cleanup as-base creation, determine
1071 (finish_struct_1): ... not here.
1073 2017-10-19 Jakub Jelinek <jakub@redhat.com>
1076 * typeck.c (check_return_expr): Don't call
1077 maybe_warn_about_returning_address_of_local in templates.
1079 2017-10-17 Nathan Sidwell <nathan@acm.org>
1082 * call.c (build_over_call): Don't pass tf_no_cleanup to nested
1086 * cp-objcp-common.c (cp_tree_size): Reformat. Adjust returns size
1089 2017-10-13 Jason Merrill <jason@redhat.com>
1091 PR c++/82357 - bit-field in template
1092 * tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.
1094 2017-10-13 David Malcolm <dmalcolm@redhat.com>
1096 * cp-tree.h (maybe_show_extern_c_location): New decl.
1097 * decl.c (grokfndecl): When complaining about literal operators
1098 with C linkage, issue a note giving the location of the
1100 * parser.c (cp_parser_new): Initialize new field
1101 "innermost_linkage_specification_location".
1102 (cp_parser_linkage_specification): Store the location
1103 of the linkage specification within the cp_parser.
1104 (cp_parser_explicit_specialization): When complaining about
1105 template specializations with C linkage, issue a note giving the
1106 location of the extern "C".
1107 (cp_parser_explicit_template_declaration): Likewise for templates.
1108 (maybe_show_extern_c_location): New function.
1109 * parser.h (struct cp_parser): New field
1110 "innermost_linkage_specification_location".
1112 2017-10-12 Nathan Sidwell <nathan@acm.org>
1114 * cp-tree.h (cp_expr): Add const operator * and operator->
1116 (cp_tree_node_structure_enum): Delete TS_CP_BINDING,
1117 TS_CP_WRAPPER, LAST_TS_CP_ENUM.
1119 2017-10-12 David Malcolm <dmalcolm@redhat.com>
1121 * parser.c (get_required_cpp_ttype): New function.
1122 (cp_parser_error_1): Call it, using the result to call
1123 maybe_suggest_missing_token_insertion.
1125 2017-10-12 David Malcolm <dmalcolm@redhat.com>
1127 * parser.c (get_matching_symbol): Move to before...
1128 (cp_parser_error): Split out into...
1129 (cp_parser_error_1): ...this new function, merging in content
1131 (cp_parser_required_error): ...here. Eliminate partial duplicate
1132 of body of cp_parser_error in favor of a call to the new
1133 cp_parser_error_1 helper function.
1135 2017-10-11 Nathan Sidwell <nathan@acm.org>
1137 * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
1138 (record_mangling): Likewise.
1140 2017-10-10 Nathan Sidwell <nathan@acm.org>
1142 * name-lookup.c (extern_c_fns): Rename to ...
1143 (extern_c_decls): ... here.
1144 (check_extern_c_conflict, extern_c_linkage_bindings): Update.
1145 (do_pushdecl): Check extern-c fns and vars.
1147 * cp-tree.h (default_hash_traits <lang_identifier *>): Delete
1150 * decl2.c (struct mangled_decl_hash): New hash traits.
1151 (mangled_decls): Make hash_table<mangled_decl_hash>.
1152 (generate_mangling_alias, record_mangling): Adjust.
1154 2017-10-10 Jason Merrill <jason@redhat.com>
1156 More delayed lambda capture fixes.
1157 * call.c (add_function_candidate): Use build_address.
1158 (build_op_call_1): Call mark_lvalue_use early.
1159 (build_over_call): Handle error from build_this.
1160 * constexpr.c (cxx_bind_parameters_in_call): Use build_address.
1161 (cxx_eval_increment_expression): Don't use rvalue().
1162 * cvt.c (convert_to_void): Use mark_discarded_use.
1163 * expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR. Fix
1164 reference handling. Don't copy the expression.
1165 (mark_discarded_use): New.
1166 * lambda.c (insert_capture_proxy): Add some sanity checking.
1167 (maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
1168 * pt.c (register_local_specialization): Add sanity check.
1169 * semantics.c (process_outer_var_ref): Fix check for existing proxy.
1170 * typeck.c (cp_build_addr_expr_1): Handle error from
1172 (cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
1175 Handle generic lambda capture in dependent expressions.
1176 * lambda.c (need_generic_capture, dependent_capture_r)
1177 (do_dependent_capture): New.
1178 * pt.c (processing_nonlambda_template): Use need_generic_capture.
1179 * semantics.c (maybe_cleanup_point_expr)
1180 (maybe_cleanup_point_expr_void, finish_goto_stmt)
1181 (maybe_convert_cond): Call do_dependent_capture.
1182 * typeck.c (build_static_cast): Remove dependent capture handling.
1184 * typeck.c (condition_conversion): Assert !processing_template_decl.
1185 * semantics.c (finish_omp_clauses): Don't
1186 fold_build_cleanup_point_expr if processing_template_decl.
1187 (outer_var_p): A temporary can't be from an outer scope.
1188 * pt.c (type_dependent_expression_p): Fix dependency checking of
1189 functions without DECL_TEMPLATE_INFO.
1190 (instantiate_decl): Use lss_copy.
1191 * constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
1193 * typeck.c (check_return_expr): Check non-dependent conversion in
1195 * constraint.cc (check_function_concept): Don't complain about an
1196 empty concept if seen_error.
1198 2017-10-10 Richard Sandiford <richard.sandiford@linaro.org>
1200 * cvt.c (ignore_overflows): Use wi::to_wide when
1201 operating on trees as wide_ints.
1202 * decl.c (check_array_designated_initializer): Likewise.
1203 * mangle.c (write_integer_cst): Likewise.
1204 * semantics.c (cp_finish_omp_clause_depend_sink): Likewise.
1206 2017-10-10 Nathan Sidwell <nathan@acm.org>
1208 * name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
1210 2017-10-06 Paolo Carlini <paolo.carlini@oracle.com>
1213 * decl.c (finish_function): Take a bool intead of an int; adjust.
1214 * cp-tree.h (finish_function): Adjust declaration.
1215 * decl2.c (generate_tls_wrapper, finish_objects,
1216 finish_static_storage_duration_function): Adjust calls.
1217 * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
1219 * method.c (synthesize_method): Likewise.
1220 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
1221 * pt.c (instantiate_decl): Likewise.
1222 * parser.c (cp_parser_function_definition_after_declarator,
1223 cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
1225 (cp_parser_ctor_initializer_opt,
1226 cp_parser_ctor_initializer_opt_and_function_body,
1227 cp_parser_function_try_block,
1228 cp_parser_function_definition_after_declarator,
1229 cp_parser_function_transaction): Return void; adjust declarations.
1231 2017-10-06 Nathan Sidwell <nathan@acm.org>
1234 * name-lookup.c (check_local_shadow): Don't try and convert
1237 2017-10-06 Jakub Jelinek <jakub@redhat.com>
1240 * decl.c (reshape_init): Suppress warn_useless_cast for direct enum
1242 * typeck.c (convert_for_assignment): Likewise.
1244 P0704R1 - fixing const-qualified pointers to members
1245 * typeck2.c (build_m_component_ref): For -std=c++2a allow
1246 pointer to const & qualified method on rvalue.
1248 2017-10-06 Nathan Sidwell <nathan@acm.org>
1250 Use hash_table for extern "C" names
1251 * name-lookup.c (extern_c_fns): Use hash_table.
1252 (check_extern_c_conflict): Adjust.
1253 (c_linkage_bindings): Adjust.
1255 Use hash_table for namespace bindings
1256 * cp-tree.h (struct named_decl_hash): New.
1257 (lang_decl_ns): Change type of bindings field.
1258 * lex.c (maybe_add_lang_decl_raw): Adjust.
1259 * name-lookup.c (find_namespace_slot): Adjust.
1260 (do_pushdecl): Push NULL-named namespace.
1261 (do_push_nested_namespace): Adjust.
1262 (push_namespace): Push anonymous namespace as NULL name.
1264 2017-10-05 Jason Merrill <jason@redhat.com>
1266 Pass variadic class objects exactly like named by-value args.
1267 * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
1269 2017-10-05 Nathan Sidwell <nathan@acm.org>
1271 Warn on MVP declarations
1272 * cp-tree.h (struct cp_declarator): Add parenthesized field.
1273 * decl.c (grokdeclarator): Warn about unnecessary parens.
1274 * parser.c (make_declarator): Init parenthesized field.
1275 (cp_parser_direct_declarator): Set parenthesized field.
1277 Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE
1278 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
1279 SET_IDENTIFIER_GLOBAL_VALUE): Delete.
1280 * name-lookup.h (set_global_binding): Remove NAME parm.
1281 (get_global_binding): New inline fn.
1282 * name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
1283 (identifier_global_value): Move to ...
1284 * cp-objcp-common.c (identifier_global_value): ... here.
1285 * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
1286 * decl.c (record_builtin_type, expand_static_init,
1287 grokdeclarator): Adjust.
1288 * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
1289 get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
1290 * except.c (declare_library_fn, build_throw): Adjust.
1291 * init.c (throw_bad_array_length): Adjust.
1292 * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.
1294 * decl2.c (record_mangling): Fix spello and formatting from
1297 2017-10-04 Nathan Sidwell <nathan@acm.org>
1299 Give builtin types the correct name.
1300 * name-lookup.c (set_global_binding): Assert name is DECL_NAME.
1301 * decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for
1304 2017-10-04 Paolo Carlini <paolo.carlini@oracle.com>
1305 Andrew Pinski <apinski@cavium.com>
1308 * parser.c (cp_parser_lambda_body): Set parser->in_function_body.
1310 2017-10-04 Nathan Sidwell <nathan@acm.org>
1312 Move mangling aliases out of global namespace.
1313 * cp-tree.h (record_mangling): New.
1314 (maybe_remove_implicit_alias): Delete.
1315 * decl2.c (mangled_decls): New hash map.
1316 (generate_mangling_alias): Reimplement using mangled_decls.
1317 (record_mangling): New.
1318 * mangle.c (decl_implicit_alias_p,
1319 maybe_remove_implicit_alias): Delete.
1320 (mangle_decl): Use record_mangling.
1321 * name-lookup.c (supplement_binding_1): Remove
1322 maybe_remove_implicit_alias check.
1324 2017-10-04 Jakub Jelinek <jakub@redhat.com>
1327 * error.c (dump_function_decl): If show_return, call dump_type_suffix
1328 on the same return type dump_type_prefix has been called on.
1330 2017-10-04 Jason Merrill <jason@redhat.com>
1332 PR c++/81525 - broken handling of auto in generic lambda.
1333 * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
1335 2017-10-04 Nathan Sidwell <nathan@acm.org>
1337 * call.c (convert_arg_to_ellipsis): Correct comment about passing
1340 2017-10-02 Richard Sandiford <richard.sandiford@linaro.org>
1342 * constexpr.c (cxx_eval_store_expression): Use wi::to_widest
1343 when comparing the array bounds with an ARRAY_REF index.
1345 2017-09-30 Paolo Carlini <paolo.carlini@oracle.com>
1348 * method.c (defaulted_late_check): Early return if the defaulted
1349 declaration does not match the expected signature.
1351 2017-09-29 Jakub Jelinek <jakub@redhat.com>
1353 P0683R1 - default member initializers for bit-fields
1354 * cp-tree.h (grokbitfield): Add INIT parameter.
1355 * parser.c (cp_parser_constant_expression): Add STRICT_P argument,
1356 if true, parse a conditional-expression rather than
1357 assignment-expression.
1358 (cp_parser_member_declaration): For C++11 and later pass true
1359 as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield
1360 NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for
1362 (cp_parser_objc_class_ivars): Adjust grokbitfield caller.
1363 * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
1364 (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
1365 * decl2.c (grokbitfield): Add INIT parameter, pass it to
1367 * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
1370 * class.c (check_bitfield_decl): Retrieve and clear width from
1371 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
1372 (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
1374 (remove_zero_width_bit_fields): Adjust comment.
1375 * decl2.c (grokbitfield): Stash width into
1376 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
1377 * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr
1378 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width.
1380 * parser.c (cp_parser_member_declaration): Parse attributes before
1381 colon of a bitfield in addition to after colon.
1383 * Make-lang.in (check-c++-all): Test also c++2a.
1385 2017-09-28 Jason Merrill <jason@redhat.com>
1387 PR c++/56973, DR 696 - capture constant variables only as needed.
1388 * expr.c (mark_use): Split out from mark_rvalue_use and
1389 mark_lvalue_use. Handle lambda capture of constant variables.
1390 (mark_lvalue_use_nonread): New.
1391 * semantics.c (process_outer_var_ref): Don't capture a constant
1392 variable until forced.
1393 * pt.c (processing_nonlambda_template): New.
1394 * call.c (build_this): Check it.
1395 * decl2.c (grok_array_decl): Call mark_rvalue_use and
1396 mark_lvalue_use_nonread.
1397 * init.c (constant_value_1): Don't call mark_rvalue_use.
1398 * typeck.c (build_static_cast): Handle lambda capture.
1400 Use local_specializations to find capture proxies.
1401 * cp-tree.h (DECL_CAPTURED_VARIABLE): New.
1402 * lambda.c (build_capture_proxy): Set it.
1403 (add_capture): Pass initializer to build_capture_proxy.
1404 (start_lambda_function): Likewise.
1405 (insert_capture_proxy): Use register_local_specialization.
1406 (is_lambda_ignored_entity): Always ignore proxies.
1407 * name-lookup.c (qualify_lookup): Don't check
1408 is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
1409 * semantics.c (process_outer_var_ref): Use
1410 retrieve_local_specialization.
1411 * parser.c (cp_parser_lambda_body): Push local_specializations.
1412 * pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
1413 (tsubst_lambda_expr): Push local_specializations sooner.
1414 (tsubst_copy_and_build): Don't register_local_specialization.
1416 * call.c (build_special_member_call): Use the return value of
1418 * decl.c (compute_array_index_type): Likewise.
1419 * parser.c (cp_parser_oacc_wait_list): Likewise.
1420 * lambda.c (is_normal_capture_proxy): Handle *this capture.
1421 (add_capture): Clarify internal_error message.
1423 2017-09-22 Eric Botcazou <ebotcazou@adacore.com>
1426 * cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
1428 2017-09-22 Jakub Jelinek <jakub@redhat.com>
1431 * tree.c (struct replace_placeholders_t): Add pset field.
1432 (replace_placeholders_r): Call cp_walk_tree with d->pset as
1433 last argument instead of NULL. Formatting fix.
1434 (replace_placeholders): Add pset variable, add its address
1435 into data. Pass &pset instead of NULL to cp_walk_tree.
1437 2017-09-22 David Malcolm <dmalcolm@redhat.com>
1439 * call.c (get_fndecl_argument_location): New function.
1440 (convert_like_real): Use it when complaining about argument type
1442 * cp-tree.h (struct cp_parameter_declarator): Add "loc" field.
1443 * parser.c (make_parameter_declarator): Add "loc" param and use
1444 it to initialize the new field.
1445 (cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of
1446 the "no_parameters" parameter.
1447 (cp_parser_parameter_declaration_list): Set the location of the
1448 result of grokdeclarator to be the parameter's loc, assuming no
1450 (cp_parser_parameter_declaration): Generate a location for the
1451 parameter and pass to make_parameter_declarator.
1453 2017-09-20 Nathan Sidwell <nathan@acm.org>
1455 * name-lookup.c (member_name_cmp): Use DECL_UID for final
1458 2017-09-20 Jakub Jelinek <jakub@redhat.com>
1460 P0409R2 - allow lambda capture [=, this]
1461 * parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on
1462 redundant [=, this].
1464 2017-09-18 Jason Merrill <jason@redhat.com>
1466 PR c++/82069 - ICE with lambda in template
1467 * semantics.c (process_outer_var_ref): Check uses_template_parms
1468 instead of any_dependent_template_arguments_p.
1470 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
1471 Paolo Carlini <paolo.carlini@oracle.com>
1474 * decl2.c (finish_anon_union): Complain about "anonymous union with
1475 no members" with a pedwarn.
1477 2017-09-15 Bernd Edlinger <bernd.edlinger@hotmail.de>
1479 * typeck.c (build_reinterpret_cast_1,
1480 build_const_cast_1): Implement -Wcast-align=strict.
1482 2017-09-15 Jakub Jelinek <jakub@redhat.com>
1484 * decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
1485 adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
1486 to C++17 or -std=gnu++17 or -std=c++17. Adjust comments.
1487 (cxx_init_decl_processing, next_initializable_field,
1488 is_direct_enum_init, check_initializer, cp_finish_decl,
1489 mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
1490 finish_function): Likewise.
1491 * cp-tree.h (DECL_INLINE_VAR_P): Likewise.
1492 * pt.c (mark_template_parm, convert_nontype_argument,
1493 instantiate_class_template_1, type_unification_real, unify,
1494 get_partial_spec_bindings, dependent_type_p_r): Likewise.
1495 * typeck.c (cp_build_unary_op): Likewise.
1496 * constexpr.c (var_in_maybe_constexpr_fn): Likewise.
1497 * call.c (build_user_type_conversion_1, build_over_call,
1498 build_special_member_call): Likewise.
1499 * lambda.c (begin_lambda_type): Likewise.
1500 * typeck2.c (process_init_constructor_record): Likewise.
1501 * class.c (build_base_field, finalize_literal_type_property,
1502 explain_non_literal_class): Likewise.
1503 * parser.c (cp_parser_diagnose_invalid_type_name,
1504 cp_parser_primary_expression, cp_parser_lambda_introducer,
1505 cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
1506 cp_convert_range_for, cp_parser_perform_range_for_lookup,
1507 cp_parser_decomposition_declaration, cp_parser_linkage_specification,
1508 cp_parser_static_assert, cp_parser_simple_type_specifier,
1509 cp_parser_namespace_definition, cp_parser_using_declaration,
1510 cp_parser_init_declarator, cp_parser_type_parameter_key,
1511 cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
1512 cp_parser_constructor_declarator_p): Likewise.
1513 * mangle.c (struct globals): Rename need_cxx1z_warning to
1515 (write_exception_spec, start_mangling, mangle_decl): Likewise.
1516 * Make-lang.in (check-c++1z): Rename to check-c++17, depend on
1518 (check-c++17): New goal. Use 17 instead of 1z.
1519 (check-c++-all): Use 17 instead of 1z.
1521 2017-09-14 Jakub Jelinek <jakub@redhat.com>
1524 * cp-gimplify.c (omp_var_to_track): Look through references.
1525 (omp_cxx_notice_variable): Likewise.
1527 2017-09-13 Nathan Sidwell <nathan@acm.org>
1529 Conv-op identifers not in identifier hash table
1530 * lex.c (conv_type_hasher): Make member fns inline.
1531 (make_conv_op_name): Directly clone conv_op_identifier.
1533 Rename CLASSTYPE_METHOD_VEC to CLASSTYPE_MEMBER_VEC.
1534 * cp-tree.h (struct lang_type): Rename methods to members.
1535 (CLASSTYPE_METHOD_VEC): Rename to ...
1536 (CLASSTYPE_MEMBER_VEC): ... this.
1537 * name-lookup.h (get_method_slot): Rename to ...
1538 (get_member_slot): ... this.
1539 (resort_type_method_vec): Rename to ...
1540 (resort_type_member_vec): ... this.
1541 * class.c (add_method, warn_hidden): Adjust.
1542 * search.c (dfs_locate_field_accessor_pre): Adjust.
1543 * name-lookup.c (method_vec_binary_search): Rename to ...
1544 (member_vec_binary_search): ... this and adjust.
1545 (method_vec_linear_search): Rename to ...
1546 (member_vec_linear_search): ... this and adjust.
1547 (fields_linear_search, get_class_binding_direct): Adjust.
1548 (get_method_slot): Rename to ...
1549 (get_member_slot): ... this and adjust.
1550 (method_name_slot): Rename to ...
1551 (member_name_slot): ... this and adjust.
1552 (resort_type_method_vec): Rename to ...
1553 (resort_type_member_vec): ... this and adjust.
1554 (method_vec_append_class_fields): Rename to ...
1555 (member_vec_append_class_fields): ... this and adjust.
1556 (method_vec_append_enum_values): Rename to ...
1557 (member_vec_append_enum_values): ... this and adjust.
1558 (method_vec_dedup): Rename to ...
1559 (member_vec_dedup): ... this and adjust.
1560 (set_class_bindings, insert_late_enum_def_bindings): Adjust.
1562 2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
1565 * decl.c (start_decl): Early return error_mark_node if duplicate_decls
1566 returns it; avoid misleading error message.
1568 2017-09-12 Nathan Sidwell <nathan@acm.org>
1570 Kill CLASSTYPE_SORTED_FIELDS.
1571 * cp-tree.h (struct lang_type): Lose sorted_fields member.
1572 (CLASSTYPE_SORTED_FIELDS): Delete.
1573 * name-lookup.h (set_class_bindings): Add EXTRA arg.
1574 * name-lookup.c (fields_linear_search): New, broken out of ...
1575 (lookup_field_1): ... here. Delete remainder of function.
1576 (get_class_binding_direct): Reimplement without sorted_fields.
1577 (get_class_binding): Rename TYPE arg to KLASS, for consistency.
1578 (get_method_slot): Call set_class_binding when creating method_vec
1580 (method_name_cmp): Order identically named slots.
1581 (sorted_fields_type_new): Delete.
1582 (field_vc_append_class_fields): Rename to ...
1583 (method_vec_append_class_fields): ... here. Adjust.
1584 (field_vec_append_enum_values): Renme to ...
1585 (method_vec_append_enum_values): ... here. Adjust.
1586 (method_vec_dedup): New.
1587 (set_class_bindings): Reimplement.
1588 (insert_late_enum_def_bindings): Reimplement.
1590 * name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for
1592 (restort_data): Move later.
1593 (method_name_cmp, resort_method_name_cmp): Simplify.
1594 (resort_type_method_vec): Reformat.
1596 2017-09-09 Jason Merrill <jason@redhat.com>
1598 * constexpr.c (reduced_constant_expression_p): If
1599 CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized.
1601 2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
1604 * cp-objcp-common.c (struct debug_type_hasher): New class.
1605 (debug_type_hash): New variable.
1606 (cp_get_debug_type): Associate the OFFSET_TYPEs with the types.
1608 2017-09-08 Jason Merrill <jason@redhat.com>
1610 PR c++/70029 - ICE with ref-qualifier and -flto
1611 * tree.c (cxx_copy_lang_qualifiers): New.
1612 * cp-tree.h: Declare it.
1613 * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
1615 2017-09-06 Jason Merrill <jason@redhat.com>
1617 PR c++/82053 - ICE with default argument in lambda in template
1618 * pt.c (tsubst_arg_types): Substitute default arguments for lambdas
1620 (retrieve_specialization): Use lambda_fn_in_template_p.
1621 * cp-tree.h: Declare it.
1623 PR c++/82070 - error with nested lambda capture
1624 * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
1625 register_local_specialization.
1627 2017-09-06 Nathan Sidwell <nathan@acm.org>
1629 * name-lookup.h (lookup_field_1): Delete.
1630 (get_class_binding_direct, get_class_binding): Add type_or_fns arg.
1631 * name-lookup.c (lookup_field_1): make static
1632 (method_vec_binary_search, method_vec_linear_search): New. Broken
1634 (get_class_binding_direct): ... here. Add TYPE_OR_FNS argument.
1635 Do complete search of this level.
1636 (get_class_binding): Adjust.
1637 * decl.c (reshape_init_class): Call get_class_binding.
1638 * search.c (lookup_field_r): Move field searching into
1639 get_class_binding_direct.
1641 * class.c (warn_hidden): Don't barf on non-functions.
1642 * decl2.c (check_classfn): Likewise. Check template match earlier.
1644 * name-lookup.c (count_fields): Rename to ...
1645 (count_class_fields): ... here. Take a class, don't count
1647 (add_fields_to_record_type): Rename to ...
1648 (field_vec_append_class_fields): ... here. Take a class, don't
1649 add NULL-named fields.
1650 (add_enum_fields_to_record_type): Rename to ...
1651 (field_vec_append_enum_values): ... here.
1652 (set_class_bindings): Adjust, assert we added expected number.
1653 (insert_late_enum_def_bindings): Reimplement. Create vector if
1654 there are now sufficient entries.
1656 * name-lookup.h (lookup_fnfields_slot_nolazy,
1657 lookup_fnfields_slot): Rename to ...
1658 (get_class_binding_direct, get_class_binding): ... here.
1659 * name-lookup.c (lookup_fnfields_slot_nolazy,
1660 lookup_fnfields_slot): Rename to ...
1661 (get_class_binding_direct, get_class_binding): ... here.
1662 * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust.
1663 * call.c (build_user_type_conversion_1): Adjust.
1664 (has_trivial_copy_assign_p): Adjust.
1665 (has_trivial_copy_p): Adjust.
1666 * class.c (get_basefndecls) Adjust.
1667 (vbase_has_user_provided_move_assign) Adjust.
1668 (classtype_has_move_assign_or_move_ctor_p): Adjust.
1669 (type_build_ctor_call, type_build_dtor_call): Adjust.
1670 * decl.c (register_dtor_fn): Adjust.
1671 * decl2.c (check_classfn): Adjust.
1672 * pt.c (retrieve_specialization): Adjust.
1673 (check_explicit_specialization): Adjust.
1674 (do_class_deduction): Adjust.
1675 * search.c (lookup_field_r): Adjust.
1676 (look_for_overrides_here, lookup_conversions_r): Adjust.
1677 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust.
1678 * tree.c (type_has_nontrivial_copy_init): Adjust.
1679 * method.c (lazily_declare_fn): Adjust comment.
1681 2017-09-05 Nathan Sidwell <nathan@acm.org>
1683 * name-lookup.c (do_class_using_decl): Elide read-once temps.
1684 Move declarations to initializations.
1686 * class.c (add_method): Move slot search and insertion to ...
1687 * name-lookup.c (get_method_slot): ... this new function.
1688 (lookup_fnfields_slot_nolazy): Cope with NULL slot.
1689 * name-lookup.h (get_method_slot): Declare.
1690 * decl.c (cxx_init_decl_processinng): Give conv_op_marker a more
1692 (grok_special_member_properties): Set
1693 TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness.
1694 Improve TYPE_HAS_CONSTEXPR_CTOR setting.
1696 * cp-tree.h (lang_decl_base): Rename template_conv_p to
1698 (DECL_CONV_FN_P): Don't check NULL DECL_NAME.
1699 (DECL_CONV_FN_TYPE): FN must be conv op.
1700 (DECL_TEMPLATE_CONV_FN_P): Delete.
1701 (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): Adjust.
1702 * pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P
1705 * class.c (unreverse_member_declarations): Remove extraneous if.
1706 * pt.c (push_template_decl_real): Use string concatenation, not
1707 \<newline>. Add %<..%>.
1709 2017-09-05 Paolo Carlini <paolo.carlini@oracle.com>
1712 * cp-tree.h (LABEL_DECL_CDTOR): Add and document.
1713 * decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
1714 creating cdtor_label.
1715 * constexpr.c (returns): Add the case of a constructor/destructor
1716 returning via a LABEL_DECL_CDTOR label.
1717 (cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
1719 2017-09-01 Nathan Sidwell <nathan@acm.org>
1721 * cp-tree.h (resort_type_method_vec): Move declaration to ...
1722 * name-lookup.h (resort_type_method_vec): ... here.
1723 (set_class_bindings): Lose 2nd arg.
1724 * class.c (finish_struct_1, finish_struct): Adjust
1725 set_class_bindings call. Don't call finish_struct_methods.
1726 (resort_data, method_name_cmp, resort_method_name_cmp,
1727 resort_type_method_vec, finish_struct_methods): Move to ...
1728 * name-lookup.c (resort_data, method_name_cmp,
1729 resort_method_name_cmp, resort_type_method_vec): ... here.
1730 (set_class_bindings): Lose fields arg. Swallow finish_struct_methods.
1732 * class.c (finish_struct): Call set_class_bindings for the
1735 * class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here.
1736 Don't call maybe_warn_about_overly_private_class here.
1737 (warn_hidden): Cleanup declarations and comments.
1738 (type_has_user_provided_constructor): No need to check
1739 CLASSTYPE_METHOD_VEC.
1740 (type_has_user_provided_or_explicit_constructor): Likewise.
1741 (classtype_has_move_assign_or_move_ctor_p): Likewise.
1742 (check_bases_and_members): Don't call finish_struct_methods here.
1743 (finish_struct_1): Call finish_struct_methods and
1744 set_class_bindings immediately after layout. Clear DECL_IN_AGGR_P
1746 (finish_struct): For templates process USING_DECLS and clear
1747 DECL_IN_AGGR_P before calling finish_struct_methods. Call
1748 maybe_warn_about_overly_private_class here.
1750 Revert 2017-08-28 Nathan Sidwell <nathan@acm.org>
1751 Restore sorted_fields vector.
1752 * cp-tree.h (lang_type): Restore sorted_fields vector.
1753 (CLASSTYPE_SORTED_FIELDS): Restore.
1754 (CLASSTYPE_BINDINGS): Delete.
1755 * name-lookup.c (lookup_field_1): Restore binary search.
1756 (sorted_fields_type_new, count_fields,
1757 add_fields_to_record_type, add_enum_fields_to_record_type): Restore
1758 (set_class_bindings): Revert.
1759 (insert_late_enum_def_binding): Restore field_vec insertion.
1761 2017-09-01 Jakub Jelinek <jakub@redhat.com>
1764 * parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.
1766 2017-09-01 Marek Polacek <polacek@redhat.com>
1769 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
1771 2017-08-30 Jason Merrill <jason@redhat.com>
1773 PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
1774 * pt.c (enclosing_instantiation_of, lambda_fn_in_template_p)
1775 (regenerated_lambda_fn_p): New.
1776 (tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of.
1777 (tsubst_copy) [VAR_DECL]: Likewise.
1779 PR c++/82030 - ICE inheriting from multiple lambdas
1781 * call.c (compare_ics): Handle null candidate.
1783 2017-08-30 Ville Voutilainen <ville.voutilainen@gmail.com>
1785 Make taking the address of an overloaded function a non-deduced context
1787 * pt.c (unify_overload_resolution_failure): Remove.
1788 (unify_one_argument): Adjust.
1790 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1791 Alan Hayward <alan.hayward@arm.com>
1792 David Sherwood <david.sherwood@arm.com>
1794 * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE.
1796 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1797 Alan Hayward <alan.hayward@arm.com>
1798 David Sherwood <david.sherwood@arm.com>
1800 * cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE.
1802 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1803 Alan Hayward <alan.hayward@arm.com>
1804 David Sherwood <david.sherwood@arm.com>
1806 * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE
1807 instead of TYPE_MODE.
1809 2017-08-29 Jason Merrill <jason@redhat.com>
1811 PR c++/81236 - ICE with template-id in generic lambda
1812 * semantics.c (finish_id_expression): Remove special dependent case.
1813 Avoid some later pieces when dependent.
1814 (finish_qualified_id_expr): Do normal BASELINK handling in a
1815 template. Always build a SCOPE_REF for a destructor BIT_NOT_EXPR.
1816 (parsing_default_capturing_generic_lambda_in_template): Remove.
1817 * parser.c (cp_parser_postfix_dot_deref_expression): Always give an
1818 error for types that will never be complete.
1819 * mangle.c (write_expression): Add sanity check.
1820 * tree.c (build_qualified_name): Add sanity check.
1821 (cp_walk_subtrees): Walk into the class context of a BASELINK.
1822 * lambda.c (add_capture): Improve diagnostic for generic lambda
1824 * call.c (build_new_method_call_1): Print the right constructor
1827 Reimplement handling of lambdas in templates.
1828 * cp-tree.h (LAMBDA_FUNCTION_P): Check DECL_DECLARES_FUNCTION_P.
1829 * decl.c (start_preparsed_function): Call start_lambda_scope.
1830 (finish_function): Call finish_lambda_scope.
1831 * init.c (get_nsdmi): Call start/finish_lambda_scope.
1832 * lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function.
1833 * parser.c (cp_parser_function_definition_after_declarator): Don't
1834 call start/finish_lambda_scope.
1835 * pt.c (retrieve_specialization): Ignore lambda functions in
1837 (find_parameter_packs_r): Ignore capture proxies. Look into
1839 (check_for_bare_parameter_packs): Allow bare packs in lambdas.
1840 (tsubst_default_argument): Call start/finish_lambda_scope.
1841 (tsubst_function_decl): Handle lambda functions differently.
1842 (tsubst_template_decl): Likewise.
1843 (tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture
1845 (tsubst_lambda_expr): Create a new closure rather than instantiate
1846 the one from the template.
1847 (tsubst_copy_and_build): Don't register a specialization of a pack.
1848 (regenerate_decl_from_template): Call start/finish_lambda_scope.
1849 (instantiate_decl): Remove special lambda function handling.
1850 * semantics.c (process_outer_var_ref): Remove special generic lambda
1851 handling. Don't implicitly capture in a lambda in a template. Look
1852 for an existing proxy.
1853 * class.c (current_nonlambda_class_type): Use decl_type_context.
1855 * cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE.
1856 (LAMBDA_EXPR_RETURN_TYPE): Remove.
1857 (struct tree_lambda_expr): Remove closure and return_type fields.
1858 * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE.
1859 * pt.c (tsubst_copy_and_build): Likewise.
1860 * parser.c (cp_parser_lambda_declarator_opt): Track return type.
1861 (cp_parser_lambda_body): Adjust unspecified return type check.
1862 * ptree.c (cxx_print_lambda_node): Don't print closure or
1865 PR c++/80935 - wrong C++17 error with lambda
1866 * decl.c (check_for_uninitialized_const_var): Check
1867 is_instantiation_of_constexpr.
1868 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
1869 is_instantiation_of_constexpr.
1870 (potential_constant_expression_1): Check var_in_maybe_constexpr_fn.
1872 * lambda.c (build_lambda_object): Check for error_mark_node.
1873 * pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type
1875 (tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters.
1876 (tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node.
1878 PR c++/80767 - unnecessary instantiation of generic lambda
1879 * call.c (convert_like_real): Call build_user_type_conversion_1 if
1881 (add_conv_candidate): Build a ck_user conversion with no candidate.
1883 Fix lambdas in template default argument of inherited ctor.
1884 * method.c (synthesized_method_base_walk): Replace an inherited
1885 template with its specialization.
1886 (synthesized_method_walk): Make inheriting_ctor a pointer.
1887 (maybe_explain_implicit_delete, explain_implicit_non_constexpr)
1888 (deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
1890 * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
1891 template, not the function.
1892 (template_guide_p): Adjust.
1894 Support copying local_specializations.
1895 * cp-tree.h (enum lss_policy): New.
1896 (local_specialization_stack): Add policy parameter to default ctor.
1897 * pt.c (local_specialization_stack): Copy local_specializations if
1900 * constexpr.c (potential_constant_expression_1): Add "now" parm.
1901 (is_constant_expression, require_constant_expression): New.
1902 (is_static_init_expression, is_nondependent_constant_expression)
1903 (is_nondependent_static_init_expression): Drop "potential".
1904 * except.c (build_must_not_throw_expr): Do type conversion on
1905 value-dependent argument.
1906 * pt.c, semantics.c, typeck2.c: Use variants without "potential".
1908 Instantiate default arguments/member initializers once.
1909 * init.c (get_nsdmi): Remember NSDMI instantiations.
1910 * parser.c (inject_this_parameter): Be more picky about
1912 * pt.c (tsubst_copy): Simplify 'this' handling.
1913 (tsubst_default_argument): Remember default argument
1914 instantiations. Take parameter number.
1915 (tsubst_default_arguments): Pass it.
1916 * call.c (convert_default_arg): Likewise.
1918 Fix default argument conversion failure and SFINAE.
1919 * call.c (build_over_call): Check convert_default_arg result for
1921 * parser.c (cp_parser_late_parsing_default_args): Remember
1924 2017-08-28 Nathan Sidwell <nathan@acm.org>
1926 * cp-tree.h (lang_type): Replace sorted_fields vector with
1928 (CLASSTYPE_SORTED_FIELDS): Delete.
1929 (CLASSTYPE_BINDINGS): New.
1930 * decl.c (finish_enum_value_list): Swap args of
1931 insert_late_enum_def_bindings.
1932 * name-lookup.c (lookup_field_1): Replace binary search of sorted
1933 fields with map->get.
1934 (sorted_fields_type_new, count_fields,
1935 add_fields_to_record_type, add_enum_fields_to_record_type): Delete.
1936 (add_class_member, add_class_members): New.
1937 (set_class_bindings): Create map and insert.
1938 (insert_late_enum_def_binding): Swap parms. Use add_clasS_member.
1939 * ptree.c (cxx_print_type): Delete sorted fields printing.
1941 * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
1943 * name-lookup.h (set_class_bindings,
1944 insert_late_enum_def_bindings): Declare.
1945 * decl.c (finish_enum_value_list): Adjust for
1946 insert_late_enum_def_bindings name change.
1947 * class.c (finish_struct_1): Call set_class_bindings.
1948 (count_fields, add_fields_to_record_type,
1949 add_enum_fields_to_record_type, sorted_fields_type_new,
1950 insert_into_classtype_sorted_fields,
1951 insert_late_enum_def_into_classtype_sorted_fields): Move to ...
1952 * name-lookup.h (count_fields, add_fields_to_record_type,
1953 add_enum_fields_to_record_type, sorted_fields_type_new,
1954 set_class_bindings, insert_late_enum_def_bindings): ... here.
1956 2017-08-25 Nathan Sidwell <nathan@acm.org>
1958 * class.c (method_name_cmp, resort_method_name_cmp): Methods
1961 Conversion operators have a special name
1962 * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New.
1963 (conv_op_marker, conv_op_identifier): New.
1964 (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete.
1965 * decl.c (initialize_predefined_identifiers): Add
1967 (cxx_init_decl_processing): Create conv_op_marker.
1968 * decl2.c (check_classfn): Lookup conv-ops by name.
1969 * class.c (add_method): Use conv_op_identifier & conv_op_marker.
1970 (resort_type_method_vec): Don't skip conv-ops.
1971 (finish_struct_methods, warn_hidden): Likewise.
1972 * name-lookup.h (lookup_all_conversions): Delete.
1973 * name-lookup.c (lookup_conversion_operator): Replace with ...
1974 (extract_conversion_operator): ... this.
1975 (lookup_fnfields_slot_nolazy): Find conv-ops by name.
1976 (lookup_all_conversions): Delete.
1977 * pt.c (check_explicit_specialization): Find conv-ops by name.
1978 * search.c (lookup_conversions_r): Likewise.
1980 2017-08-24 Nathan Sidwell <nathan@acm.org>
1982 Conversion operators kept on single overload set
1983 * class.c (add_method): Keep all conv-ops on one slot.
1984 * name-lookup.c (lookup_conversion_operator): Pull the desired
1985 conv op out of overload set.
1986 * search.c (lookup_conversions_r): Lose template/non-template
1988 (lookup_conversions): Likewise.
1990 2017-08-23 Nathan Sidwell <nathan@acm.org>
1992 * cp-tree.h (lookup_field_1, lookup_fnfields_slot,
1993 lookup_fnfields_slot_nolazy, lookup_all_conversions): Move
1995 * name-lookup.h (lookup_field_1, lookup_fnfields_slot,
1996 lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here.
1997 * search.c (lookup_conversion_operator,
1998 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1999 lookup_all_conversions): Move to ...
2000 * name-lookup.c (lookup_conversion_operator,
2001 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
2002 lookup_all_conversions): ... here.
2004 * semantics.c (finish_member_declaration): Move USING_DECL check
2005 earlier. Always set C++ linkage. Commonize TYPE_FIELD and
2006 template decl list insertion.
2008 * cp-tree.h (maybe_version_functions): Declare.
2009 * decl.c (decls_match): Break function versioning check to
2010 separate function. Call it.
2011 (maybe_version_functions): Broken out of decls_match.
2012 * class.c (add_method): Use maybe_version_functions.
2014 * cp-tree.h (print_search_statistics,
2015 reinit_search_statistics): Don't declare.
2016 * search.c (n_fields_searched, n_calls_lookup_field,
2017 n_calls_lookup_field_1, n_calls_lookup_fnfields,
2018 n_calls_lookup_fnfields_1, n_calls_get_base_type,
2019 n_outer_fields_searched, n_contexts_saved): Delete.
2020 (lookup_field_1, lookup_member,
2021 lookup_fnfields_slot_nolazy): Remove stat gathering.
2022 (print_search_statistics, reinit_search_statistics): Delete.
2023 * tree.c (cxx_print_statistics): Don't print search stats.
2025 2017-08-21 Nathan Sidwell <nathan@acm.org>
2027 * search.c (lookup_field_r): Remove obsolete code for type-named
2030 * search.c (lookup_field_1): Assert TYPE is a class and VFIELD
2032 (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
2033 (lookup_field_fuzzy_r): Adjust.
2035 2017-08-21 David Malcolm <dmalcolm@redhat.com>
2037 * call.c (build_over_call): Pass NULL for new parameter to
2038 check_function_arguments.
2039 * typeck.c (cp_build_function_call_vec): Likewise.
2041 2017-08-21 Nathan Sidwell <nathan@acm.org>
2044 * pt.c (instantiate_class_template_1):
2045 BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected.
2047 2017-08-18 David Malcolm <dmalcolm@redhat.com>
2050 * name-lookup.c (maybe_suggest_missing_header): Convert return
2051 type from void to bool; return true iff a suggestion was offered.
2052 (suggest_alternative_in_explicit_scope): Move call to
2053 maybe_suggest_missing_header to before use of best_match, and
2054 return true if the former offers a suggestion.
2056 2017-08-18 H.J. Lu <hongjiu.lu@intel.com>
2059 * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN.
2060 * decl2.c (grokbitfield): Don't allow bit-field with
2061 warn_if_not_aligned type.
2063 2017-08-17 Nathan Sidwell <nathan@acm.org>
2065 * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment.
2066 * cp-tree.h (ENUM_TEMPLATE_INFO): Delete.
2067 (TYPE_TEMPLATE_INFO): Simplify.
2068 (SET_TYPE_TEMPLATE_INFO): Simplify.
2070 * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs
2071 don't need lang_type.
2072 (cxx_make_type): Use maybe_add_lang_type_raw return value.
2073 * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on
2076 * cp-tree.h (struct lang_type): Remove template_info field.
2077 (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
2078 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
2080 2017-08-14 Martin Sebor <msebor@redhat.com>
2083 * error.c (cp_printer): Handle 'G'.
2085 2017-08-11 Martin Liska <mliska@suse.cz>
2087 * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
2088 TARGET_SUPPORTS_ALIASES.
2089 (handle_tls_init): Likewise.
2090 (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for
2092 * optimize.c (can_alias_cdtor): Likewise.
2094 2017-08-11 Jason Merrill <jason@redhat.com>
2096 PR c++/81671 - nullptr_t template parameter
2097 * pt.c (convert_nontype_argument): Fix nullptr_t check.
2099 2017-08-10 Jason Merrill <jason@redhat.com>
2101 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
2102 * method.c (synthesized_method_walk): Don't diagnose lack of
2105 PR c++/80452 - Core 1579, implicit move semantics on return/throw
2106 * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
2107 tentatively changed the lvalue to an rvalue.
2108 * call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling.
2109 (build_over_call): If LOOKUP_PREFER_RVALUE, check that the first
2110 parameter is an rvalue reference.
2111 * except.c (build_throw): Do maybe-rvalue overload resolution twice.
2112 * typeck.c (check_return_expr): Likewise.
2114 2017-08-10 David Malcolm <dmalcolm@redhat.com>
2116 * parser.c (cp_parser_error): Update for new param to
2118 (class token_pair): New class.
2119 (struct matching_paren_traits): New struct.
2120 (matching_parens): New typedef.
2121 (struct matching_brace_traits): New struct.
2122 (matching_braces): New typedef.
2123 (cp_parser_statement_expr): Convert explicit parsing of
2124 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of
2125 class matching_parens, so that the pertinent open parenthesis is
2126 highlighted when there are problems locating the close
2128 (cp_parser_primary_expression): Likewise.
2129 (cp_parser_compound_literal_p): Remove consumption of opening
2131 (cp_parser_postfix_expression): Convert explicit parsing of
2132 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as
2133 above. Use it to consume the opening paren previously consumed by
2134 cp_parser_compound_literal_p.
2135 (cp_parser_parenthesized_expression_list): Likewise.
2136 (cp_parser_unary_expression): Likewise.
2137 (cp_parser_new_expression): Likewise.
2138 (cp_parser_cast_expression): Likewise.
2139 (cp_parser_builtin_offsetof): Likewise.
2140 (cp_parser_trait_expr): Likewise.
2141 (cp_parser_lambda_declarator_opt): Likewise.
2142 (cp_parser_lambda_body): Likewise, for matching_braces.
2143 (cp_parser_compound_statement): Likewise.
2144 (cp_parser_selection_statement): Likewise, for matching_parens.
2145 (cp_parser_iteration_statement): Likewise.
2146 (cp_parser_already_scoped_statement): Likewise, for
2148 (cp_parser_linkage_specification): Likewise.
2149 (cp_parser_static_assert): Likewise, for matching_parens.
2150 (cp_parser_decltype): Likewise.
2151 (cp_parser_operator): Likewise.
2152 (cp_parser_enum_specifier): Likewise.
2153 (cp_parser_namespace_definition): Likewise.
2154 (cp_parser_direct_declarator): Likewise.
2155 (cp_parser_braced_list): Likewise.
2156 (cp_parser_class_specifier_1): Likewise, for matching_braces.
2157 (cp_parser_constant_initializer): Likewise.
2158 (cp_parser_noexcept_specification_opt): Likewise, for
2160 (cp_parser_exception_specification_opt): Likewise.
2161 (cp_parser_handler): Likewise.
2162 (cp_parser_asm_specification_opt): Likewise.
2163 (cp_parser_asm_operand_list): Likewise.
2164 (cp_parser_gnu_attributes_opt): Likewise.
2165 (cp_parser_std_attribute_spec): Likewise.
2166 (cp_parser_requirement_parameter_list): Likewise.
2167 (cp_parser_requirement_body): Likewise, for matching_braces.
2168 (cp_parser_compound_requirement): Likewise.
2169 (cp_parser_template_introduction): Likewise.
2170 (cp_parser_sizeof_pack): Likewise, for matching_parens.
2171 (cp_parser_sizeof_operand): Likewise; use it to consume the
2172 opening paren previously consumed by cp_parser_compound_literal_p.
2173 (get_matching_symbol): New function.
2174 (cp_parser_required_error): Add param "matching_location". Remove
2175 calls to cp_parser_error, instead setting a non-NULL gmsgid, and
2176 handling it if set by calling c_parse_error, potentially with a
2177 secondary location if matching_location was set.
2178 (cp_parser_require): Add param "matching_location", with a default
2179 value of UNKNOWN_LOCATION.
2180 (cp_parser_require_keyword): Update for new param of
2181 cp_parser_required_error.
2182 (cp_parser_objc_encode_expression): Update to class matching_parens
2184 (cp_parser_objc_defs_expression): Likewise.
2185 (cp_parser_objc_protocol_expression): Likewise.
2186 (cp_parser_objc_selector_expression): Likewise.
2187 (cp_parser_objc_typename): Likewise.
2188 (cp_parser_objc_superclass_or_category): Likewise.
2189 (cp_parser_objc_try_catch_finally_statement): Likewise.
2190 (cp_parser_objc_synchronized_statement): Likewise.
2191 (cp_parser_objc_at_property_declaration): Likewise.
2192 (cp_parser_oacc_single_int_clause): Likewise.
2193 (cp_parser_oacc_shape_clause): Likewise.
2194 (cp_parser_omp_clause_collapse): Likewise.
2195 (cp_parser_omp_clause_default): Likewise.
2196 (cp_parser_omp_clause_final): Likewise.
2197 (cp_parser_omp_clause_if): Likewise.
2198 (cp_parser_omp_clause_num_threads): Likewise.
2199 (cp_parser_omp_clause_num_tasks): Likewise.
2200 (cp_parser_omp_clause_grainsize): Likewise.
2201 (cp_parser_omp_clause_priority): Likewise.
2202 (cp_parser_omp_clause_hint): Likewise.
2203 (cp_parser_omp_clause_defaultmap): Likewise.
2204 (cp_parser_omp_clause_ordered): Likewise.
2205 (cp_parser_omp_clause_schedule): Likewise.
2206 (cp_parser_omp_clause_num_teams): Likewise.
2207 (cp_parser_omp_clause_thread_limit): Likewise.
2208 (cp_parser_omp_clause_aligned): Likewise.
2209 (cp_parser_omp_clause_linear): Likewise.
2210 (cp_parser_omp_clause_safelen): Likewise.
2211 (cp_parser_omp_clause_simdlen): Likewise.
2212 (cp_parser_omp_clause_depend): Likewise.
2213 (cp_parser_omp_clause_device): Likewise.
2214 (cp_parser_omp_clause_dist_schedule): Likewise.
2215 (cp_parser_oacc_clause_async): Likewise.
2216 (cp_parser_omp_critical): Likewise.
2217 (cp_parser_omp_for_loop): Likewise.
2218 (cp_parser_omp_sections_scope): Likewise.
2219 (cp_parser_omp_declare_reduction_exprs): Likewise.
2220 Update for new param to cp_parser_required_error.
2221 (cp_parser_oacc_routine): Likewise.
2222 (cp_parser_transaction_expression): Likewise.
2223 (cp_parser_cilk_simd_vectorlength): Likewise.
2225 2017-08-09 Jason Merrill <jason@redhat.com>
2227 PR c++/81525 - wrong constant value with generic lambda
2228 * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
2229 (tsubst_copy) [VAR_DECL]: Handle auto.
2231 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
2232 * init.c (get_nsdmi): Add complain parm.
2233 * typeck2.c (digest_nsdmi_init): Add complain parm.
2234 (process_init_constructor_record): Pass complain to get_nsdmi.
2235 * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool.
2236 * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into
2237 synthesized_method_walk.
2238 (synthesized_method_walk): Adjust.
2239 (walk_field_subobs): Pass complain to get_nsdmi.
2240 (defaulted_late_check): Skip other checks if deleted.
2241 * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept.
2242 * call.c (build_aggr_conv): Pass complain to get_nsdmi.
2243 * parser.c (defarg_location): New.
2244 * error.c (location_of): Use it.
2246 2017-08-09 Marek Polacek <polacek@redhat.com>
2248 * parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0.
2249 * typeck.c (build_binary_op): Change the type of a parameter to bool.
2250 (cp_truthvalue_conversion): Use true instead of 1.
2252 2017-08-08 Marek Polacek <polacek@redhat.com>
2255 * cp-gimplify.c (cp_fold): If folding exposed a branch of
2256 a COND_EXPR, convert it to the original type of the COND_EXPR, if
2259 2017-08-08 Martin Liska <mliska@suse.cz>
2261 * call.c: Include header files.
2262 * cp-gimplify.c: Likewise.
2263 * cp-ubsan.c: Likewise.
2266 * search.c: Likewise.
2267 * semantics.c: Likewise.
2268 * typeck.c: Likewise.
2270 2017-08-07 Martin Liska <mliska@suse.cz>
2272 * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an
2274 (cp_parser_std_attribute): Likewise.
2275 * tree.c: Add new include.
2277 2017-08-04 Paolo Carlini <paolo.carlini@oracle.com>
2280 * pt.c (do_class_deduction): Handle the case of no viable implicit
2281 deduction guides; simplify the code generating implicit deduction
2284 2017-08-03 Paolo Carlini <paolo.carlini@oracle.com>
2287 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
2288 destructor as expressions.
2290 2017-08-02 Jakub Jelinek <jakub@redhat.com>
2293 * call.c (build_user_type_conversion_1): Only call
2294 lookup_fnfields_slot if totype is CLASS_TYPE_P.
2296 2017-07-31 Jason Merrill <jason@redhat.com>
2298 * decl.c (declare_global_var): Set DECL_CONTEXT.
2300 2017-07-31 Jan Hubicka <hubicka@ucw.cz>
2301 Martin Liska <mliska@suse.cz>
2303 * pt.c (tsubst_copy): Copy PREDICT_EXPR.
2304 * semantics.c (finish_goto_stmt): Build gimple predict
2306 * constexpr.c (potential_constant_expression_1): Handle
2309 2017-07-31 Martin Liska <mliska@suse.cz>
2312 * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
2313 also with current_function_decl non-null equality.
2314 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
2315 * decl.c (compute_array_index_type): Likewise.
2316 * init.c (finish_length_check): Likewise.
2317 * typeck.c (cp_build_binary_op): Likewise.
2319 2017-07-29 Jakub Jelinek <jakub@redhat.com>
2321 * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
2322 DW_AT_export_symbols.
2323 * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
2324 argument, pass it through to the debug hook.
2325 (finish_namespace_using_directive): Adjust
2326 emit_debug_info_using_namespace caller.
2327 (push_namespace): Likewise. Call it after setting
2328 DECL_NAMESPACE_INLINE_P.
2329 (cp_emit_debug_info_for_using): Pass false as new argument to
2330 the imported_module_or_decl debug hook.
2332 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
2334 * lex.c (copy_decl): Adjust.
2335 (copy_type): Likewise.
2337 2017-07-26 Paolo Carlini <paolo.carlini@oracle.com>
2340 * lambda.c (add_capture): Early return if we cannot capture by
2343 2017-07-26 Jason Merrill <jason@redhat.com>
2345 P0702R1 - List deduction of vector.
2346 * pt.c (do_class_deduction): Special-case deduction from a single
2347 element of related type.
2349 2017-07-26 Leonid Koppel <lkoppel@uwaterloo.ca>
2351 PR c++/67054 - Inherited ctor with non-default-constructible members
2352 * method.c (walk_field_subobs) Consider member initializers (NSDMIs)
2353 when deducing an inheriting constructor.
2355 2017-07-21 Nathan Sidwell <nathan@acm.org>
2357 * search.c (lookup_conversion_operator): Return overloads.
2358 (lookup_fnfields_idx_nolazy): Absorb into ...
2359 (lookup_fnfields_slot_nolaxy): ... here.
2360 (lookup_fnfields_1): Absorb into ...
2361 (lookup_fnfields_slot): ... here.
2363 Remove special CDtor METHOD_VEC slots.
2364 * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT,
2365 CLASSTYPE_DESTRUCTOR_SLOT): Delete.
2366 (CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
2367 (CLASSTYPE_DESTRUCTOR): Likewise.
2368 * class (add_method): Don't use special cdtor slots.
2369 * search.c (lookup_fnfields_idx_nolazy): Likewise.
2370 (look_for_overrides_here): Use lookup_fnfields_slot.
2371 * semantics (classtype_has_nothrow_assign_or_copy_p): Likewise.
2373 * call.c (add_candidates): Move decls to initialization. Don't
2376 2017-07-20 Nathan Sidwell <nathan@acm.org>
2378 Remove TYPE_METHODS.
2379 * class.c (maybe_warn_about_overly_private_class,
2380 finish_struct_methods, one_inheriting_sig, count_fields,
2381 add_fields_to_record_type, check_field_decls, check_methods,
2382 clone_function_decl, set_method_tm_attributes,
2383 finalize_literal_type_property, check_bases_and_members,
2384 create_vtable_ptr, determine_key_method,
2385 unreverse_member_declarations, finish_struct,
2386 add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS.
2387 * decl.c (fixup_anonymous_aggr): Likewise.
2388 * decl2.c (reset_type_linkage_2): Likewise.
2389 * method.c (after_nsdmi_defaulted_late_checks,
2390 lazily_declare_fn): Likewise.
2391 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
2392 * pt.c (instantiate_class_template_1, tsubst_expr,
2393 do_type_instantiation, instantiate_pending_templates): Likewise.
2394 * search.c (lookup_field_1): Likewise.
2395 * semantics.c (finish_member_declaration,
2396 finish_omp_declare_simd_methods): Likewise.
2398 2017-07-19 Nathan Sidwell <nathan@acm.org>
2400 * class.c (add_implicitly_declared_members): Use
2401 classtype_has_move_assign_or_move_ctor_p.
2402 (classtype_has_move_assign_or_move_ctor,
2403 classtype_has_user_move_assign_or_move_ctor_p): Merge into ...
2404 (classtype_has_move_assign_or_move_ctor_p): ... this new function.
2405 * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p):
2407 (classtype_has_move_assign_or_move_ctor_p): ... this.
2408 * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust.
2409 * tree.c (type_has_nontrivial_copy_init): Adjust.
2411 * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS,
2412 PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}_VALUE_RAW.
2414 2017-07-18 Nathan Sidwell <nathan@acm.org>
2416 * cp-array-notation.c (build_array_notation_ref): Use
2417 TYPE_{MIN,MAX}_VALUE.
2419 * class.c (classtype_has_move_assign_or_move_ctor): Declare.
2420 (add_implicitly_declared_members): Use it.
2421 (type_has_move_constructor, type_has_move_assign): Merge into ...
2422 (classtype_has_move_assign_or_move_ctor): ... this new function.
2423 * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
2425 2017-07-17 Volker Reichelt <v.reichelt@netcologne.de>
2427 * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for
2428 friend outside class and obsolete auto as storage-class-specifier.
2430 2017-07-17 Nathan Sidwell <nathan@acm.org>
2432 * class.c (maybe_warn_about_overly_private_class): Ignore public
2435 * class.c (type_has_user_declared_move_constructor,
2436 type_has_user_declared_move_assign): Combine into ...
2437 (classtype_has_user_move_assign_or_move_ctor_p): ... this new function.
2438 * cp-tree.h (type_has_user_declared_move_constructor,
2439 type_has_user_declared_move_assign): Combine into ...
2440 (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare.
2441 * method.c (maybe_explain_implicit_delete): Use it.
2442 (lazily_declare_fn): Use it.
2443 * tree.c (type_has_nontrivial_copy_init): Use it.
2445 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify
2446 semantics, simplify implementation.
2448 2017-07-16 Volker Reichelt <v.reichelt@netcologne.de>
2450 * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
2451 in old-style cast diagnostic.
2452 * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
2453 in useless cast diagnostic.
2454 * error.c (type_to_string): Remove enum special handling.
2456 2017-07-14 David Malcolm <dmalcolm@redhat.com>
2458 * name-lookup.c (get_std_name_hint): Add '<' and '>' around
2460 (maybe_suggest_missing_header): Update for addition of '<' and '>'
2461 to above. Provide a fix-it hint.
2462 * pt.c: Include "gcc-rich-location.h"
2463 (listify): Attempt to add fix-it hint for missing
2464 #include <initializer_list>.
2465 * rtti.c: Include "gcc-rich-location.h".
2466 (typeid_ok_p): Attempt to add fix-it hint for missing
2467 #include <typeinfo>.
2469 2017-07-12 Jason Merrill <jason@redhat.com>
2471 P0512R0 - Deduction from an initializer list.
2472 * pt.c (do_class_deduction): Do list deduction in two phases.
2474 2017-07-12 Nathan Sidwell <nathan@acm.org>
2476 * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR,
2477 DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at
2479 * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
2480 DECL_CXX_DESTRUCTOR explicitly.
2481 * decl2.c (grokclassfn): Likewise.
2482 * friend.c (do_friend): Likewise.
2483 * method.c (make_thunk, make_alias_for,
2484 implicitly_declare_fn): Likewise.
2486 2017-07-11 Jason Merrill <jason@redhat.com>
2489 * decl.c (grokparms): Downgrade error about array of unknown bound
2490 to pedwarn and disable it for C++17.
2492 2017-07-11 Nathan Sidwell <nathan@acm.org>
2494 * decl2.c (reset_type_linkage_2): Dont't change ctor name.
2496 2017-07-10 Martin Sebor <msebor@redhat.com>
2498 * cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document.
2500 2017-07-06 Jason Merrill <jason@redhat.com>
2502 PR c++/81204 - parse error with dependent template-name
2503 * parser.c (cp_parser_lookup_name): Revert previous change.
2505 2017-07-06 David Malcolm <dmalcolm@redhat.com>
2507 * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
2508 selftest::run_cp_tests.
2509 (selftest::run_cp_tests): New function.
2510 * cp-tree.h (selftest::run_cp_tests): New decl.
2512 2017-07-04 Jakub Jelinek <jakub@redhat.com>
2514 * parser.c (cp_parser_decomposition_declaration): Replace
2515 decomposition declaration with structured binding in diagnostics.
2516 * decl.c (cp_finish_decomp): Likewise.
2517 (grokdeclarator): Likewise.
2520 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid
2521 forms of structured binding initializers.
2523 2017-07-03 Paolo Carlini <paolo.carlini@oracle.com>
2526 * decl.c (grokdeclarator): Move checks on function return type after
2527 the splice_late_return_type call; if declspecs->locations[ds_type_spec]
2528 is UNKNOWN_LOCATION fall back to input_location.
2530 2017-07-03 David Malcolm <dmalcolm@redhat.com>
2532 * parser.c (enum required_token): Fix spelling of
2533 RT_INTERATION to RT_ITERATION.
2534 (cp_parser_iteration_statement): Likewise.
2535 (cp_parser_required_error): Likewise.
2537 2017-06-30 Jason Merrill <jason@redhat.com>
2539 PR c++/81257 - ICE with invalid ::template.
2540 PR c++/54769 - wrong lookup of dependent template-name.
2541 * parser.c (cp_parser_template_name): Revert part of last change.
2543 2017-06-30 Nathan Sidwell <nathan@acm.org>
2545 * config-lang.in (gtfiles): Add cp/lex.c.
2546 * cp-tree.h (mangle_convop_name_for_type): Rename ...
2547 (make_conv_op_name): ... here. Move to lex.
2548 * lambda.c (maybe_add_lambda_conv_op): Update.
2549 * parser.c (cp_parser_conversion_function_id): Update.
2550 * pt.c (tsubst_decl, tsubst_baselink, tsubst_copy,
2551 tsubst_copy_and_build): Update.
2552 * semantics.c (apply_deduced_return_type): Update.
2553 * mangle.c (conv_type_hasher, conv_type_names,
2554 mangle_conv_op_name_for_type): Move to ...
2555 * lex.c (conv_type_hasher, conv_type_names, make_convop_name):
2558 2017-06-30 David Malcolm <dmalcolm@redhat.com>
2561 * parser.c (cp_parser_postfix_expression): Construct a location
2562 for typeid expressions.
2564 2017-06-30 Nathan Sidwell <nathan@acm.org>
2566 * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
2568 (lookup_all_conversions): Declare.
2569 * class.c (get_basefndecls): Use lookup_fnfields_slot.
2570 * decl.c (register_dtor_fn): Use lookup_fnfields_slot.
2571 * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework
2573 * pt.c (retrieve_specialization): Use lookup_fnfields_slot.
2574 (check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
2575 lookup_all_conversions.
2576 * search.c (lookup_fnfields_1): Make static.
2577 (lookup_all_conversions): New.
2578 (class_method_index_for_fn): Delete.
2579 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
2580 lookup_fnfields_slot.
2582 * call.c (build_new_method_call_1): Use constructo_name to get
2583 ctor name. Move argument processing earlier to merge cdtor
2585 * decl.c (grokfndecl): Cdtors have special names.
2586 * method.c (implicitly_declare_fn): Likewise. Simplify flag setting.
2587 * pt.c (check_explicit_specialization): Cdtor name is already
2589 * search.c (class_method_index_for_fn): Likewise.
2592 * name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding
2593 a matching TYPE_DECL.
2595 2017-06-29 Paolo Carlini <paolo.carlini@oracle.com>
2597 * class.c (add_method): Change pair of errors to error + inform.
2598 (handle_using_decl): Likewise.
2600 2017-06-29 Jason Merrill <jason@redhat.com>
2602 * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling.
2604 PR c++/81180 - ICE with C++17 deduction of member class template.
2605 * pt.c (build_deduction_guide): Correct member template handling.
2607 PR c++/81188 - matching decltype of member function call.
2608 * tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
2610 2017-06-29 Nathan Sidwell <nathan@acm.org>
2613 * parser.c (cp_parser_namespace_definition): Immediately close the
2614 namespace if there's no open-brace.
2615 * name-lookup.c (do_pushdecl): Reset OLD when pushing into new
2618 2017-06-29 Jason Merrill <jason@redhat.com>
2620 PR c++/81164 - ICE with invalid inherited constructor.
2621 * search.c (binfo_direct_p): New.
2622 * name-lookup.c (do_class_using_decl): Use it.
2624 2017-06-29 Nathan Sidwell <nathan@acm.org>
2626 * cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
2627 VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
2628 * decl.c (initialize_predefined_identifiers): Name cdtor special
2629 names consistently. Use literals for above deleted defines.
2630 (cxx_init_decl_processing): Use literal for vtbl_ptr_type name,
2632 * lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
2635 * call.c (check_dtor_name): Use constructor_name for enums too.
2636 (build_new_method_call_1): Use constructor_name for cdtors and
2638 * class.c (build_self_reference): Use TYPE_NAME to get name of
2640 * name-lookup (constructor_name): Use DECL_NAME directly.
2641 (constructor_name_p): Reimplement.
2642 (push_class_level_binding_1): Use TYPE_NAME directly.
2644 * class.c (finish_struct): Use OVL_P.
2645 (get_vfield_name): Measure constructor_name length.
2646 * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
2647 (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
2648 * cxx-pretty-print.c (is_destructor_name): Delete.
2649 (pp_cxx_unqualified_id): Remove bogus destructor name checking.
2650 * decl.c (grokfndecl): Move cheap checks first when looking for
2651 implicit extern cness.
2653 * parser.c (cp_parser_direct_declarator): Reorder if to avoid
2654 indentation. Remove unnecessary assignment of constructor name.
2656 Whitespace cleanups.
2657 * call.c (name_as_c_string): Move CONST_CAST to return.
2658 (build_new_method_call_1): Remove unneeded bracing.
2659 * class.c (include_empty_classes): Unbreak line.
2660 * constraint.cc (tsubst_check_constraint): Add space.
2661 * cp-tree.h (lang_decl_ns): Add comment.
2662 (PTRMEM_CST_MEMBER): Break line.
2663 * decl.c (grokfndecl): Add blank lines. Unbreak some others.
2664 (grokdeclarator): Remove lines, move declaration to first use.
2665 * decl2.c (decl_needed_p): Fix indentation.
2666 (c_parse_final_cleanups): Remove blank line.
2667 * method.c (implicitly_declare_fn): Move declaration to first use.
2668 * search.c (current_scope): Add blank lines.
2670 2017-06-28 Jason Merrill <jason@redhat.com>
2672 PR c++/72764 - ICE with invalid template typename.
2673 * decl.c (build_typename_type): No longer static.
2674 * tree.c (strip_typedefs): Use it instead of make_typename_type.
2676 PR c++/69300 - ICE with self-referential noexcept
2677 * pt.c (maybe_instantiate_noexcept): Check for recursion.
2679 PR c++/61022 - error with variadic template template parm
2680 * pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.
2682 PR c++/72801 - ICE with variadic partial specialization
2683 * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.
2685 PR c++/55639 - partial specialization with ::template
2686 * parser.c (cp_parser_class_head): Handle ::template.
2688 PR c++/45976 - error with ::template in declarator.
2689 * pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling.
2691 PR c++/54769 - wrong lookup of dependent template-name.
2692 * parser.c (cp_parser_template_name): Handle dependent object type.
2693 (cp_parser_nested_name_specifier_opt): Make template_keyword_p a
2695 (cp_parser_id_expression): Pass it.
2696 (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.
2698 * parser.c (cp_parser_template_id): Use the range location on the
2701 PR c++/81204 - parse error with dependent template-name
2702 * parser.c (cp_parser_lookup_name): Disqualify function templates
2705 2017-06-27 Nathan Sidwell <nathan@acm.org>
2707 * pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
2708 initialization point. Don't unnecessarily check for ctor name.
2710 * cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
2711 (CLASSTYPE_DESTRUCTOR): ... this.
2712 * class.c (accessible_nvdtor_p,
2713 maybe_warn_about_overly_private_class,
2714 add_implicitly_declared_members,
2715 clone_constructors_and_destructors, type_has_virtual_destructor):
2716 Adjust for CLASSTYPE_DESTRUCTOR.
2717 (deduce_noexcept_on_destructors): Absorb into ...
2718 (check_bases_and_members): ... here.
2719 * except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
2720 * init.c (build_delete): Likewise.
2721 * parser.c (cp_parser_lookup_name): Likewise.
2722 * pt.c (check_explicit_specialization): Likewise.
2723 * rtti.c (emit_support_tinfos): Likewise.
2724 * search.c (lookup_fnfields_idx_nolazy): Likewise.
2726 Kill IDENTIFIER_TEMPLATE.
2727 * cp-tree.h (lang_identifier): Remove class_template_info field.
2728 (IDENTIFIER_TEMPLATE): Delete.
2729 * name-lookup.c (constructor_name_full): Subsume into ...
2730 (constructor_name): ... here. Don't check IDENTIFIER_TEMPLATE.
2731 (constructor_name_p): Likewise.
2732 * mangle.c (write_source_name): Likewise.
2733 * ptree.c (cxx_print_identifier): Likewise.
2735 2017-06-27 Marek Polacek <polacek@redhat.com>
2738 * parser.c (cp_parser_already_scoped_statement): Initialize
2741 2017-06-26 Jason Merrill <jason@redhat.com>
2743 PR c++/81215 - deduction failure with variadic TTP.
2744 * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.
2746 2017-06-26 Martin Sebor <msebor@redhat.com>
2749 * call.c (maybe_warn_class_memaccess): Preserve explicit conversions
2750 to detect casting away cv-qualifiers.
2752 2017-06-26 Nathan Sidwell <nathan@acm.org>
2754 * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
2755 (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
2757 (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
2758 DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
2759 (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
2760 * decl.c (grok_op_properties): Adjust identifier checking.
2761 * init.c (expand_default_init): Adjust identifier descision.
2762 * method.c (implicitly_declare_fn): Don't use
2763 DECL_ASSIGNMENT_OPERATOR_P.
2764 * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
2766 * call.c (in_charge_arg_for_name): Reimplement.
2767 (build_special_member_call): Use IDENTIFIER_CDTOR_P,
2770 2017-06-26 Marek Polacek <polacek@redhat.com>
2773 * parser.c (cp_parser_statement): Add a default argument. Save the
2774 location of the expression-statement after labels have been parsed.
2775 (cp_parser_implicitly_scoped_statement): Set the location of the
2776 body of the conditional after parsing all the labels. Call
2777 warn_for_multistatement_macros.
2778 (cp_parser_already_scoped_statement): Likewise.
2780 2017-06-24 Paolo Carlini <paolo.carlini@oracle.com>
2783 * parser.c (cp_parser_diagnose_invalid_type_name): Don't print
2784 'typename' in error messages about missing 'typename'.
2786 2017-06-23 Jason Merrill <jason@redhat.com>
2788 PR c++/79056 - C++17 ICE with invalid template syntax.
2789 * parser.c (cp_parser_simple_type_specifier): Don't assume that type
2791 (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
2792 * pt.c (template_placeholder_p): New.
2793 * cp-tree.h: Declare it.
2795 2017-06-23 Marc Glisse <marc.glisse@inria.fr>
2797 * decl.c (duplicate_decls): Use builtin_structptr_types.
2799 2017-06-22 Nathan Sidwell <nathan@acm.org>
2801 Reorder IDENTIFIER flags
2803 * cp-tree.h (enum cp_identifier_kind): New.
2804 (IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
2805 IDENTIFIER_KIND_BIT_2): New.
2806 (IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
2807 (IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
2808 (C_IS_RESERVED_WORD): Replace with ...
2809 (IDENTIFIER_KEYWORD_P): ... this.
2810 (IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
2811 (IDENTIFIER_CDTOR_P): ... this.
2812 (IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
2813 (IDENTIFIER_OPNAME_P): Replace with ...
2814 (IDENTIFIER_ANY_OP_P): ... this.
2815 (IDENTIFIER_ASSIGN_OP_P): New.
2816 (IDENTIFIER_TYPENAME_P): Replace with ...
2817 (IDENTIFIER_CONV_OP_P): ... this.
2818 (NEW_DELETE_OPNAME_P): Replace with ...
2819 (IDENTIFIER_NEWDEL_OP_P): ... this.
2820 (DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
2821 (get_identifier_kind_name, set_identifier_kind): Declare.
2822 * lex.c (get_identifier_kind_name, set_identifier_kind): New.
2823 (init_operators): Adjust to avoid keywords, use
2824 set_identifier_kind. Copy TYPE_EXPR slot.
2825 (init_reswords): Call set_identifier_kind.
2826 (unqualified_name_lookup_error): Adjust.
2827 * operators.def (TYPE_EXPR): Remove.
2828 * decl.c (struct predefined_identifier): Move into ...
2829 (initialize_predefined_identifiers): ... here. Call
2830 set_identifier_kind.
2831 (grokfndecl, check_var_type, grokdeclarator): Adjust.
2832 (grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
2834 * call.c (name_as_c_string): Adjust.
2835 (build_new_method_call_1): Likewise.
2836 * cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
2837 * cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
2838 * dump.c (cp_dump_tree): Adjust.
2839 * error.c (dump_decl_name): Adjust.
2840 * mangle.c (write_unqualified_id, write_member_name,
2841 write_expression): Adjust.
2842 (mangle_conv_op_name_for_type): Use set_identifier_kind.
2843 * name-lookup.c (do_class_using_decl): Adjust.
2844 (lookup_name_fuzzy, lookup_name_real_1): Likewise.
2845 * parser.c (cp_lexer_get_preprocessor_token,
2846 cp_parser_direct_declarator): Likewise.
2847 * pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
2848 tsubst_copy, tsubst_copy_and_build): Adjust.
2849 * ptree.c (cxx_print_identifier): Print identifier kind.
2850 * search.c (lookup_field_r, lookup_member,
2851 lookup_fnfields_idx_nolazy): Adjust.
2852 * semantics.c (finish_id_expression): Adjust..
2853 * typeck.c (cp_build_addr_expr_1): Adjust.
2855 2017-06-21 Jakub Jelinek <jakub@redhat.com>
2858 * semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
2859 Complain about t not being a variable if t is OVERLOAD even
2860 when processing_template_decl.
2862 2017-06-21 David Malcolm <dmalcolm@redhat.com>
2864 * parser.c (get_cast_suggestion): New function.
2865 (maybe_add_cast_fixit): New function.
2866 (cp_parser_cast_expression): Capture the location of the closing
2867 parenthesis. Call maybe_add_cast_fixit when emitting warnings
2868 about old-style casts.
2870 2017-06-20 Jason Merrill <jason@redhat.com>
2872 PR c++/80972 - C++17 ICE with attribute packed.
2873 * call.c (build_over_call): Allow a TARGET_EXPR from reference
2876 2017-06-20 Nathan Sidwell <nathan@acm.org>
2878 * cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete.
2879 (nelts_identifier): Delete.
2880 * decl.c (initialize_predefined_identifiers): Remove nelts.
2882 PR c++/67074 - namespace aliases
2883 * decl.c (duplicate_decls): Don't error here on mismatched
2885 * name-lookup.c (name_lookup::add_value): Matching namespaces are
2887 (diagnose_name_conflict): Namespaces are never redeclarations.
2888 (update_binding): An alias can match a real namespace.
2890 2017-06-19 Jason Merrill <jason@redhat.com>
2892 PR c++/80562 - ICE with constexpr if.
2893 * semantics.c (finish_if_stmt_cond): Call
2894 instantiate_non_dependent_expr.
2896 PR c++/80829 - ICE with constexpr copy of base subobject.
2897 * constexpr.c (clear_no_implicit_zero): New.
2898 (cxx_eval_call_expression): Call it.
2900 2017-06-19 Nathan Sidwell <nathan@acm.org>
2904 * name-lookup.c (set_decl_namespace): Don't follow using
2905 directives and ignore using decls. Only check overly-explicit
2906 scope after discovering decl.
2908 2017-06-19 Jason Merrill <jason@redhat.com>
2910 PR c++/81073 - constexpr and static var in statement-expression.
2911 * typeck2.c (store_init_value): Always call
2912 require_potential_constant_expression.
2913 * pt.c (convert_nontype_argument): Likewise.
2914 * constexpr.c (potential_constant_expression_1): Adjust message.
2915 Use decl_maybe_constant_var_p instead of decl_constant_var_p.
2916 * decl2.c (decl_maybe_constant_var_p): Consider initializer.
2918 2017-06-19 Nathan Sidwell <nathan@acm.org>
2920 * pt.c (coerce_template_parms): Fix indentation.
2921 (tsubst_decl): Remove repeated SET_DECL_RTL. Move VAR_P handling
2925 * name-lookup.c (update_binding): Only warn about constructors
2926 hidden by functions.
2928 2017-06-17 Jason Merrill <jason@redhat.com>
2930 PR c++/60063 - -Wunused-local-typedefs and templates.
2931 * decl2.c (is_late_template_attribute): Return false for "used".
2933 PR c++/70844 - -Wuseless-cast and inheriting constructor.
2934 * method.c (forward_parm): Suppress warn_useless_cast.
2936 2017-06-16 Jason Merrill <jason@redhat.com>
2938 PR c++/81045 - Wrong type-dependence with auto return type.
2939 * pt.c (type_dependent_expression_p): An undeduced auto outside the
2940 template isn't dependent.
2941 * call.c (build_over_call): Instantiate undeduced auto even in a
2944 PR c++/80465 - ICE with generic lambda with noexcept-specifier.
2945 * lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
2946 set longer for a generic lambda.
2948 PR c++/80614 - Wrong mangling for C++17 noexcept type
2949 * mangle.c (write_type): Put the eh spec back on the function type.
2951 PR c++/81102 - Wrong error with partial specialization.
2952 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing
2953 types. Do type deduction later.
2955 PR c++/81074 - ICE with partial specialization of member template.
2957 * pt.c (get_partial_spec_bindings): Only coerce innermost args.
2959 PR c++/80831 - ICE with -fsyntax-only.
2960 * decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
2962 PR c++/80639 - ICE with invalid PMF initialization.
2963 PR c++/80043 - ICE with -fpermissive
2964 * typeck.c (convert_for_assignment): Recurse when instantiate_type
2965 returns without an error.
2967 2017-06-16 Nathan Sidwell <nathan@acm.org>
2969 * pt.c (tsubst_baselink): Fix & clarify formatting.
2971 * cp-tree.h (build_this_parm, cp_build_parm_decl,
2972 build_artificial_parm): Add FN parm.
2973 * decl.c (start_cleanup_fn): Adjust.
2974 (build_this_parm): Add FN parm, pass it through.
2975 (grokfndecl): Adjust parm building.
2976 * decl2.c (cp_build_parm_decl): Add FN parm, set context.
2977 (build_artificial_parm): Add FN parm, pass through.
2978 (maybe_retrofit_in_chrg): Adjust parm building.
2979 (start_static_storage_duration_function): Likwise.
2980 * lambda.c (maybe_aadd_lambda_conv_op): Likewise.
2981 * method.c (implicitly_declare_fn): Likewise.
2982 * parser.c (inject_this_parameter): Likewise.
2984 Symbol tables are insert only.
2985 * cp-tree.h (default_hash_traits <lang_identifier *>): Don't
2986 derive from pointer_hash. Make undeletable.
2988 * class.c (resort_type_method_vec): Avoid potential unsigned
2991 Don't defer noexcept_deferred_spec.
2992 * cp-tree.h (unevaluated_noexcept_spec): Don't declare.
2993 * decl.c (cxx_init_decl_processing): Initialize
2994 noexcept_deferred_spec.
2995 * except.c (unevaluated_noexcept_spec): Delete.
2996 * class.c (deduce_noexcept_on_destructor): Use
2997 noexcept_deferred_spec directly.
2998 * method.c (implicitly_declare_fn): Likewise.
3000 Make keyed_classes a vector.
3001 * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
3002 (keyed_classes): Declare as vector.
3003 * decl.c (keyed_classes): Define.
3004 (cxx_init_decl_processing): Allocate it.
3005 (record_key_method_defined): Use vec_safe_push.
3006 * class.c (finish_struct_1): Likewise.
3007 * pt.c (instantiate_class_template_1): Likewise.
3008 * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
3011 * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
3012 TK_VMI_CLASS_TYPES, TK_MAX. Delete TK_FIXED.
3014 (typeid_ok_p): Add quotes to error messages. Use get_tinfo_desc.
3015 (get_tinfo_decl): Use get_tinfo_desc.
3016 (get_pseudo_ti_init): Likewise. Adjust VMI construction.
3017 (create_pseudo_type_info): Delete.
3018 (get_pseudo_ti_index): Just determine the index.
3019 (get_tinfo_desc): New. Create all types lazily.
3020 (create_tinfo_types): Just allocate the descriptor array.
3021 (emit_support_tinfos): Use non-inserting type lookup. Set builtin
3024 2017-06-15 Martin Sebor <msebor@redhat.com>
3027 * call.c (first_non_public_field, maybe_warn_class_memaccess): New
3029 (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
3030 (build_cxx_call): Call maybe_warn_class_memaccess.
3032 2017-06-14 Jakub Jelinek <jakub@redhat.com>
3034 * cp-gimplify.c (cp_genericize_r): Turn most of the function
3035 into a switch (TREE_CODE (stmt)) statement from long else if
3038 2017-06-13 Jakub Jelinek <jakub@redhat.com>
3041 * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
3042 argument even if it has REFERENCE_TYPE.
3045 * cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
3046 BLOCK_VARS (outer) chain.
3047 (cxx_omp_const_qual_no_mutable): Likewise.
3049 2017-06-13 Martin Liska <mliska@suse.cz>
3052 * class.c (build_base_path): Use sanitize_flags_p.
3053 * cp-gimplify.c (cp_genericize_r): Likewise.
3054 (cp_genericize_tree): Likewise.
3055 (cp_genericize): Likewise.
3056 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
3057 * decl.c (compute_array_index_type): Likewise.
3058 (start_preparsed_function): Likewise.
3059 * decl2.c (one_static_initialization_or_destruction): Likewise.
3060 * init.c (finish_length_check): Likewise.
3061 * lambda.c (maybe_add_lambda_conv_op): Likewise.
3062 * typeck.c (cp_build_binary_op): Likewise.
3063 (build_static_cast_1): Likewise.
3065 2017-06-11 Jason Merrill <jason@redhat.com>
3067 * error.c (dump_expr): Use is_this_parameter.
3069 * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
3072 2017-06-09 Jason Merrill <jason@redhat.com>
3074 Missing bits from N4268, constant evaluation for all non-type args.
3075 * call.c (build_converted_constant_expr): Rename from
3076 build_integral_nontype_arg_conv, handle all types.
3077 * pt.c (convert_nontype_argument): In C++17 call it for all types.
3078 Move NOP stripping inside pointer case, don't strip ADDR_EXPR.
3079 * cvt.c (strip_fnptr_conv): Also strip conversions to the same type.
3081 Overhaul pointer-to-member conversion and template argument handling.
3082 * call.c (standard_conversion): Avoid creating ck_pmem when the
3083 class type is the same.
3084 * cvt.c (can_convert_qual): Split from
3085 perform_qualification_conversions.
3086 * constexpr.c (cxx_eval_constant_expression): Check it.
3087 * typeck.c (convert_ptrmem): Only cplus_expand_constant if
3088 adjustment is necessary.
3089 * pt.c (check_valid_ptrmem_cst_expr): Compare class types.
3090 (convert_nontype_argument): Avoid redundant error.
3092 * call.c (convert_like_real): Remove "inner" parameter.
3093 Don't replace a constant with its value.
3094 * cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue.
3096 * pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
3099 * parser.c (cp_parser_constant_expression): Check
3100 potential_rvalue_constant_expression after decay_conversion.
3101 * pt.c (convert_nontype_argument): Don't require linkage in C++17.
3103 PR c++/80384 - ICE with dependent noexcept-specifier
3104 * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
3107 * constexpr.c (potential_constant_expression_1): Allow 'this' capture.
3109 2017-06-09 Jan Hubicka <hubicka@ucw.cz>
3111 * class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
3112 * decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise.
3113 (excpet.c): Mark terminate as cold.
3115 2017-06-08 Jakub Jelinek <jakub@redhat.com>
3118 * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
3119 to sizetype before size_binop.
3122 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause
3123 to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE
3124 and OMP_CLAUSE_SHARED_READONLY flags.
3126 2017-06-08 Jan Hubicka <hubicka@ucw.cz>
3128 * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
3130 2017-06-07 Nathan Sidwell <nathan@acm.org>
3132 * class.c (layout_class_type): Restructure overlong-bitfield tpe
3135 2017-06-07 Jonathan Wakely <jwakely@redhat.com>
3138 * pt.c (do_class_deduction): Build qualified type.
3140 2017-06-06 Nathan Sidwell <nathan@acm.org>
3142 * name-lookup.c (suggest_alternatives_for): Use qualified lookup
3143 sans using directives. Don't walk into inline namespaces.
3146 * name-lookup.c (adl_class_only): Don't add visible friends.
3148 2017-06-05 Volker Reichelt <v.reichelt@netcologne.de>
3150 * parser.c (cp_parser_base_specifier): Fix typos in error messages.
3152 2017-06-02 Nathan Sidwell <nathan@acm.org>
3154 Remove lang_type_ptrmem.
3155 * cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
3157 (lang_type_class): ... this. Reorder bitfields. Rename to ...
3158 (lang_type): ... this. Delete old definition.
3159 (lang_type_ptrmem): Delete.
3160 (LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC. Adjust uses.
3161 (LANG_TYPE_PTRMEM_CHECK): Delete.
3162 (TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
3163 (TYPE_PTRMEMFUNC_TYPE): New. Use TYPE_LANG_SLOT_1.
3164 * decl.c (build_ptrmemfunc_type): Adjust.
3165 * lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
3166 (maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.
3168 * class.c (check_bases_and_members): Adjust vec_new_uses_cookie
3171 Remove cp_binding_level::namespaces
3172 * name-lookup.h (cp_binding_level): Lose namespaces field.
3173 * name-lookup.c (add_decl_to_level): Chain namespaces on the names
3175 (suggest_alternatives_for): Adjust for namespace list. Do
3176 breadth-first search.
3177 * decl2.c (collect_source_refs): Namespaces are on the regulr
3179 (collect_ada_namespace): Likewise.
3181 2017-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
3183 * typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div
3186 2017-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
3189 * method.c (constructible_expr): Strip array types before calling
3192 2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
3195 * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
3196 for case INDIRECT_REF too in the main switch.
3198 2017-05-31 Jason Merrill <jason@redhat.com>
3200 PR c++/80840 - ICE with constexpr and reference
3201 * pt.c (convert_nontype_argument): Don't test whether a decl is
3202 value-dependent when binding to a reference.
3204 2017-05-31 Nathan Sidwell <nathan@acm.org>
3206 * cp-tree.h (lang_decl_slector): New enum.
3207 (lang_decl_base): Make selector an enum. Drop decomposition_p
3209 (lang_decl): Use enum for discrimination.
3210 (LANG_DECL_FN_CHECK, LANG_DECL_NS_CHECK, LANG_DECL_PARM_CHECK,
3211 LANG_DECL_DEOMP_CHECK): Use enum.
3212 (DECL_DECOMPOSITION_P): Use selector value.
3213 (SET_DECL_DECOMPOSITION_P): Delete.
3214 (retrofit_lang_decl): Lose SEL parm.
3215 (fit_decomposition_lang_decl): Declare.
3216 * decl.c (cp_finish_decomp, grokdeclarator): Use
3217 fit_decomposition_lang_decl.
3218 * lex.c (maybe_add_lang_decl_raw): New. Broken out of
3220 (set_decl_linkage): New. Broken out of retrofit_lang_decl. Use enum.
3221 (fit_decomposition_lang_decl): Likewise.
3222 (retrofit_lang_decl): Use worker functions.
3223 (cxx_dup_lang_specific_decl): Use selector enum.
3224 (maybe_add_lang_type_raw): New. Broken out of ...
3225 (cxx_make_type_name): ... here. Call it.
3227 2017-05-30 Jason Merrill <jason@redhat.com>
3229 PR c++/80856 - ICE with local extern in template
3230 * semantics.c (finish_call_expr): Replace a local extern overload
3231 set in a template with the IDENTIFIER_NODE.
3233 2017-05-30 David Malcolm <dmalcolm@redhat.com>
3235 * call.c (perform_implicit_conversion_flags): Convert
3236 "from %qT to %qT" to "from %qH to %qI" in diagnostic.
3237 (print_conversion_rejection): Replace pairs of %qT with
3238 %qH and %qI in various places.
3239 (build_user_type_conversion_1): Likewise.
3240 (build_integral_nontype_arg_conv): Likewise.
3241 (build_conditional_expr_1): Likewise.
3242 (convert_like_real): Likewise.
3243 (convert_arg_to_ellipsis): Likewise.
3245 (initialize_reference): Likewise.
3246 * cvt.c (cp_convert_to_pointer): Likewise.
3247 (cp_convert_to_pointer): Likewise.
3248 (convert_to_reference): Likewise.
3249 (ocp_convert): Likewise.
3250 * error.c (cp_printer): Gain bool and const char ** parameters.
3251 (struct deferred_printed_type): New struct.
3252 (class cxx_format_postprocessor): New class.
3253 (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor
3254 to pp->m_format_postprocessor.
3255 (comparable_template_types_p): New function.
3256 (newline_and_indent): New function.
3257 (arg_to_string): New function.
3258 (print_nonequal_arg): New function.
3259 (print_template_differences): New function.
3260 (type_to_string_with_compare): New function.
3261 (print_template_tree_comparison): New function.
3262 (append_formatted_chunk): New function.
3263 (add_quotes): New function.
3264 (cxx_format_postprocessor::handle): New function.
3265 (defer_phase_2_of_type_diff): New function.
3266 (cp_printer): Add "quoted" and "buffer_ptr" params. Implement
3268 * typeck.c (cp_build_binary_op): Replace pairs of %qT with
3269 %qH and %qI in various places.
3270 (convert_member_func_to_ptr): Likewise.
3271 (build_reinterpret_cast_1): Likewise.
3272 (convert_for_assignment): Likewise.
3273 * typeck2.c (check_narrowing): Likewise.
3275 2017-05-30 Nathan Sidwell <nathan@acm.org>
3277 Kill IDENTIFIER_NAMESPACE_BINDINGS
3278 * cp-tree.h (lang_identifier): Delete namespace_bindings.
3279 (IDENTIFIER_NAMESPACE_BINDINGS): Delete.
3280 (lang_decl_ns): Add bindings.
3281 (DECL_NAMESPACE_BINDINGS): New.
3282 * lex.c (retrofit_lang_decl): Create namespace hash table.
3283 * name-lookup.c (find_namespace_slot): Change to use hash-map.
3284 * ptree.c (cxx_print_binding): Delete.
3285 (cxx_print_identifier): Remove NAMESPACE_BINDING printing.
3287 * cp-tree.def (OVERLOAD): Fix comment.
3288 * cp-tree.h: Fix comments and whitespace.
3289 * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
3290 * name-lookup.c (add_decl_to_level): Assert not class.
3291 (check_local_shadow): Use OVL_P.
3292 (pushdecl_with_scope_1): Rename to ...
3293 (do_pushdecl_with_Scope): ... here.
3294 (do_nonmember_using_decl): Use qualified_namespace_lookup return
3296 (push_class_level_binding_1): Use OVL_P.
3297 (pushdecl_namespace_level): Use do_pushdecl_with_scope.
3298 (pushtag_1): Rename to ...
3299 (do_pushtag): ... here. Adjust do_pushdecl_with_scope call.
3301 (store_class_bindings): Do not time here.
3302 * name-lookup.h (pushdecl_outermost_localscope): Reorder.
3303 * pt.c (listify): Declare argvec at point of initialization.
3306 * name-lookup.c (add_decl_to_level): Assert not making a circular
3308 (update_binding): Don't prematurely slide artificial decl.
3310 2017-05-29 Alexandre Oliva <aoliva@redhat.com>
3312 * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused.
3314 2017-05-29 Nathan Sidwell <nathan@acm.org>
3316 PR c++/80891 (#1,#5)
3317 * cp-tree.h (lookup_maybe_add): Add DEDUPING argument.
3318 * name-lookup.c (name_lookup): Add deduping field.
3319 (name_lookup::preserve_state, name_lookup::restore_state): Deal
3321 (name_lookup::add_overload): New.
3322 (name_lookup::add_value, name_lookup::add_fns): Call add_overload.
3323 (name_lookup::search_adl): Set deduping. Don't unmark here.
3324 * pt.c (most_specialized_instantiation): Revert previous change,
3325 Assert not given duplicates.
3326 * tree.c (lookup_mark): Just mark the underlying decls.
3327 (lookup_maybe_add): Dedup using marked decls.
3330 * ptree.c (cxx_print_xnode): Show internal OVERLOAD structure.
3331 * tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert.
3333 Stat hack representation
3334 * name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
3335 MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
3337 (find_namespace_binding): Replace with ...
3338 (find_namespace_slot): ... this.
3339 (find_namespace_value): New.
3340 (name_lookup::search_namespace_only,
3341 name_lookup::adl_namespace_only): Adjust.
3342 (update_binding): Add SLOT parameter, adjust.
3343 (check_local_shadow): Use find_namespace_value.
3344 (set_local_extern_decl_linkage): Likewise.
3345 (do_pushdecl): Adjust for namespace slot.
3346 (push_local_binding): Assert not a namespace binding.
3347 (check_for_out_of_scope_variable): Use find_namespace_value.
3348 (set_identifier_type_value_with_scope): Likewise.
3349 (get_namespace_binding): Likewise.
3350 (set_namespace_binding): Delete.
3351 (set_global_binding): Directly update the binding.
3352 (finish_namespace_using_decl): Likewise.
3353 (lookup_type_scope_1): Use find_namespace_slot and update.
3354 (do_push_nested_namespace): Use find_namespace_value.
3357 * pt.c (most_specialized_instantiation): Cope with duplicate
3361 * cp-tree.h (build_min_nt_call_vec): Declare.
3362 * decl.c (build_offset_ref_call_from_tree): Call it.
3363 * parser.c (cp_parser_postfix_expression): Likewise.
3364 * pt.c (tsubst_copy_and_build): Likewise.
3365 * semantics.c (finish_call_expr): Likewise.
3366 * tree.c (build_min_nt_loc): Keep unresolved lookups.
3367 (build_min): Likewise.
3368 (build_min_non_dep): Likewise.
3369 (build_min_non_dep_call_vec): Likewise.
3370 (build_min_nt_call_vec): New.
3373 * tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP.
3375 (lookup_keep): Call it.
3377 2017-05-26 Nathan Sidwell <nathan@acm.org>
3380 * name-lookup.c (push_inline_namespaces): New.
3381 (push_namespace): Look inside inline namespaces.
3383 Inline and using namespace representation change.
3384 * cp-tree.h (struct lang_decl_ns): Delete ns_using. Add usings,
3386 (DECL_NAMESPACE_USING): Adjust.
3387 (DECL_NAMESPACE_INLINEES): New.
3388 * name-lookup.h (struct cp_binding_level): Change usings
3390 * name-lookup.c (name_lookup::do_queue_usings,
3391 name_lookup::queue_usings): Adjust.
3392 (name_lookup::search_namespace, name_lookup::search_usings,
3393 name_lookup::queue_namespace): Adjust.
3394 (name_lookup::adl_namespace_only): Adjust.
3395 (add_using_namespace, push_namespace): Push onto vector.
3396 (pop_namespace): Add timing logic.
3398 * call.c (build_operator_new_call): Do namelookup and ADL here.
3399 (build_new_op_1): Likewise.
3400 * name-lookup.h (lookup_function_nonclass): Delete declaration.
3401 (do_using_directive): Likewise.
3402 * name-lookup.c (set_namespace_binding, push_local_binding): Don't
3404 (struct scope_binding): Delete.
3405 (EMPTY_SCOPE_BINDING): Delete.
3406 (set_decl_namespace): Use OVL_P.
3407 (finish_local_using_decl): Lose unnecesary checks.
3408 (lookup_function_nonclass): Delete.
3409 (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
3411 * cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
3412 (ovl_iterator): Add allow_inner field. Adjust ctor. Make
3414 (ovl_iterator::maybe_push, ovl_iterator::pop): New.
3415 (lkp_iterator): Add outer field. Adjust ctor.
3416 (lkp_iterator::operator++): New.
3417 (lookup_mark, lookup_maybe_add): Declare.
3418 * name-lookup.c (name_lookup): Delete fn_set member.
3419 (name_lookup::preserve_state, name_lookup::restore_state): Unmark
3421 (name_lookup::add_value): Use lookup_add directly.
3422 (name_lookup::add_fns: Use lookup_maybe_add.
3423 (name_lookup::search_adl): Mark and unmark fns.
3425 * pt.c (check_explicit_specialization): Use lookup_add directly.
3426 * ptree.c (cxx_print_xnode): Show complete overload structure.
3427 * tree.c (lookup_mark, lookup_maybe_add): New.
3429 * name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args.
3431 2017-05-26 Jakub Jelinek <jakub@redhat.com>
3433 * cp-tree.h (struct lang_decl_decomp): New type.
3434 (struct lang_decl): Add u.decomp.
3435 (LANG_DECL_DECOMP_CHECK): Define.
3436 (DECL_DECOMPOSITION_P): Note it is set also on the vars
3437 for user identifiers.
3438 (DECL_DECOMP_BASE): Define.
3439 (retrofit_lang_decl): Add extra int = 0 argument.
3440 * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
3441 use it to influence the selector choices and for selector
3442 0 to non-zero transition copy old content.
3443 (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
3444 * decl.c (poplevel): For DECL_DECOMPOSITION_P, check
3445 !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning
3446 wording if decl is a structured binding.
3447 (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
3448 Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization
3449 of individual variables for tuple structured bindings.
3450 (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
3451 Clear DECL_DECOMP_BASE.
3452 * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
3453 * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
3455 * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
3458 2017-05-25 Jason Merrill <jason@redhat.com>
3460 PR c++/80605 - __is_standard_layout and zero-length array
3461 * class.c (check_bases): Use DECL_FIELD_IS_BASE.
3463 2017-05-25 Nathan Sidwell <nathan@acm.org>
3465 Kill OVL_CURRENT, OVL_NEXT.
3466 * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
3467 * name-lookup.c (set_decl_namespace): Use ovl_iterator.
3468 (consider_binding_level): Use OVL_FIRST.
3469 (cp_emit_debug_info_for_using): Use lkp_iterator.
3470 * pt.c (check_explicit_specialization): Use ovl_iterator.
3472 Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS.
3473 * cp-tree.h (lang_decl_ns): Remove ns_users field.
3474 (DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete.
3475 (TREE_INDIRECT_USING): Delete.
3476 * name-lookup.h (is_associated_namespace): Delete.
3477 * name-lookup.c (name_lookup::search_usings,
3478 name_lookup::do_queue_usings): Usings are always direct.
3479 (is_associated_namespace): Delete.
3480 (handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P.
3481 (namespace_ancestor_1, namespace_ancestor): Delete.
3482 (push_using_directive_1, push_using_directive): Delete.
3483 (add_using_namespace_1): Delete.
3484 (add_using_namespace): Reimplement.
3485 (emit_debug_info_using_namespace): New.
3486 (finish_namespace_using_directive, finish_local_using_directive,
3487 push_namespace): Adjust.
3488 * tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling.
3490 2017-05-25 Volker Reichelt <v.reichelt@netcologne.de>
3492 * semantics.c (finish_handler_parms): Warn about non-reference type
3495 2017-05-25 Nathan Sidwell <nathan@acm.org>
3497 Reimplement unqualified namespace lookup.
3498 * name-lookup.c (name_lookup::using_pair,
3499 name_lookup::using_queue): New typedefs.
3500 (name_lookup::queue_namespace, name_lookup::do_queue_usings,
3501 name_lookup::queue_usings): New.
3502 (name_lookup::search_unqualified): New.
3503 (merge_functions, same_entity_p, ambiguous_decl,
3504 unqualified_namespace_lookup_1, unqualified_namespace_lookup,
3505 lookup_using_namespace): Delete.
3506 (lookup_name_real_1): Adjust.
3508 Reimplement qualified namespace lookup.
3509 * name-lookup.c (name_lookup::flags): New member. Adjust ctor.
3510 (name_lookup::ambiguous, name_lookup::add_value,
3511 name_lookup::add_type, name_lookup::process_binding): New.
3512 (name_lookup::search_namespace_only,
3513 name_lookup::search_namespace, name_lookup::search_usings): New.
3514 (name_lookup::search_qualified): New.
3515 (do_nonmember_using_decl, suggest_alternatives_for,
3516 lookup_qualified_name): Adjust.
3517 (tree_vec_contains): Delete.
3518 (qualified_lookup_using_namespace): Rename to ...
3519 (qualified_namespace_lookup): ... here. Reimplement.
3522 * cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New.
3523 * name-lookup.h (lookup_arg_dependent): Return plain tree.
3524 * name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args,
3525 arg_assoc_args_vec, arg_assoc_type, add_function,
3526 arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases,
3527 arg_assoc_class, arg_assoc_template_arg, arg_assoc,
3528 lookup_arg_dependent_1): Delete.
3529 (name_lookup): New lookup object.
3530 (name_lookup::preserve_state, name_lookup::restore_state,
3531 name_lookup::mark_seen, name_lookup::find_and_mark,
3532 name_lookup::add_fns, name_lookup::adl_namespace_only,
3533 name_lookup::adl_namespace, name_lookup::adl_class_only,
3534 name_lookup::adl_bases, name_lookup::adl_class,
3535 name_lookup::adl_expr, name_lookup::adl_type,
3536 name_lookup::adl_template_arg, name_lookup::search_adl): New.
3537 (lookup_arg_dependent): Return a plain tree. Adjust.
3538 (is_associated_namespace): Move later.
3540 2017-05-24 Nathan Sidwell <nathan@acm.org>
3542 * friend.c (do_friend): Remove check for existing decl.
3543 * name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
3544 * name-lookup.c (push_local_binding): Directly look for binding.
3545 (lookup_name_innermost_nonclass_level_1): Delete.
3546 (lookup_name_innermost_nonclass_level): Delete.
3548 * Make-lang.in (CXX_AND_OBJCXX_OBJS): Alphabetize.
3550 * cp-tree.h (cp_free_lang_data): Add extern.
3551 (ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
3553 (type_unknown_p): Return bool, make inline, lose TREE_LIST check.
3554 * typeck.c (type_unknown_p): Delete.
3555 * tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
3556 overload management.
3557 (dependent_name): Likewise.
3558 (decl_anon_ns_mem_p): Simplify.
3560 2017-05-24 Jonathan Wakely <jwakely@redhat.com>
3563 * tree.c (reshape_init): Use unqualified type for direct enum init.
3564 * typeck.c (maybe_warn_about_cast_ignoring_quals): New.
3565 (build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
3566 non-class destination types.
3567 (build_const_cast_1): Strip cv-quals from destination types.
3568 (build_static_cast, build_reinterpret_cast, build_const_cast)
3569 (cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.
3571 2017-05-24 Martin Sebor <msebor@redhat.com>
3574 * call.c (fully_fold_internal): Adjust.
3576 2017-05-24 Nathan Sidwell <nathan@acm.org>
3578 * cp-tree.h (ovl_skip_hidden): Declare.
3579 * tree.c (ovl_skip_hidden): New.
3580 * name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden.
3581 (lookup_arg_dependent_1): Likewise.
3582 (ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden.
3583 (hidden_name_p, remove_hidden_names): Delete.
3584 (lookup_name_real_1): Do not strip hidden names.
3585 * name-lookup.h (hidden_name_p, remove_hidden_names): Delete.
3587 * cp-tree.h (OVL_HIDDEN_P): New.
3588 (ovl_iterator::hidden_p, ovl_iterator::reveal_node): New.
3589 (ovl_iterator::reveal_node): Declare.
3590 * tree.c (ovl_copy): Copy OVL_HIDDEN_P.
3591 (ovl_insert): Order on hiddenness.
3592 (ovl_iterator::reveal_node): New.
3593 * name-lookup.c (anticipated_builtin_p): New.
3594 (supplement_binding_1): Use it.
3595 (set_local_extern_decl_linkage): Use hidden_p.
3596 (do_pushdecl): Deal with unhiding a hidden decl, use
3597 anticipated_builtin_p.
3598 (do_nonmember_using_decl): Use anticipated_decl_p.
3599 (lookup_name_real_1): Use DECL_HIDDEN_P.
3601 2017-05-23 Jason Merrill <jason@redhat.com>
3603 -Wunused and C++17 structured bindings
3604 * decl.c (poplevel): Don't warn about unused structured bindings,
3605 only real variables.
3606 * error.c (dump_simple_decl): Handle structured bindings.
3607 * expr.c (mark_exp_read): Look through DECL_VALUE_EXPR.
3609 2017-05-23 Nathan Sidwell <nathan@acm.org>
3611 * cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
3612 * name-lookup.c (create_local_binding): New.
3613 (update_binding): New.
3614 (pushdecl_maybe_friend_1): Rename to ...
3615 (do_pushdecl): ... this. Reimplement.
3617 (push_overloaded_decl_1, push_overloaded_decl): Delete.
3619 2017-05-23 Jason Merrill <jason@redhat.com>
3621 PR c++/80396 - built-in for make_integer_sequence.
3622 * pt.c (builtin_pack_fn_p, builtin_pack_call_p)
3623 (expand_integer_pack, expand_builtin_pack_call): New.
3624 (find_parameter_packs_r): Check builtin_pack_call_p.
3625 (check_for_bare_parameter_packs): Handle it.
3626 (tsubst_pack_expansion): Call expand_builtin_pack_call.
3627 (declare_integer_pack): New.
3628 (init_template_processing): Call it.
3629 * decl2.c (mark_used): Check builtin_pack_fn_p.
3631 2017-05-23 Nathan Sidwell <nathan@acm.org>
3633 * name-lookup.c (find_namespace_binding): New.
3634 (pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT.
3635 (set_identifier_type_value_with_scope): Use find_namespace_binding.
3636 (find_binding, cp_binding_level_find_binding_for_name,
3637 binding_for_name, namespace_binding_1): Delete.
3638 (push_overloaded_decl_1): Use CP_DECL_CONTEXT.
3639 (get_namespace_binding, set_namespace_binding,
3640 finish_namespace_using_decl, unqualified_namespace_lookup_1,
3641 qualified_lookup_using_namespace, lookup_type_scope_1,
3642 lookup_name_innermost_nonclass_level_1): Use find_namespace_binding.
3645 * parser.c (cp_parser_template_id): Keep the lookup when stashing
3648 * cp-tree.h (DECL_HIDDEN_P): New.
3649 * name-lookup.c (set_decl_context,
3650 set_local_extern_decl_linkage): New, broken out of ...
3651 (pushdecl_maybe_friend_1): ... here. Call them.
3653 2017-05-23 Thomas Schwinge <thomas@codesourcery.com>
3655 * parser.c (OACC_KERNELS_CLAUSE_MASK): Add
3656 "PRAGMA_OACC_CLAUSE_NUM_GANGS", "PRAGMA_OACC_CLAUSE_NUM_WORKERS",
3659 2017-05-23 Nathan Sidwell <nathan@acm.org>
3661 * cp-tree.h (OVL_P): New.
3662 * name-lookup.h (push_local_binding): Delete.
3663 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3664 (finish_namespace_using_decl, finish_local_using_decl): ... here
3665 * name-lookup.c (add_decl_to_level): Swap args.
3666 (pop_bindings_and_leave_scope): Look inside TREE_LIST.
3667 (diagnose_name_conflict): Check contexts are same for redecl.
3668 (update_local_overload): New.
3669 (compparms_for_decl_and_using): Rename to ...
3670 (matching_fn_p): ... here.
3671 (pushdecl_maybe_friend_1): Adjust add_decl_to_level,
3672 push_local_bindings call.
3673 (push_local_binding): Make static, replace FLAGS arg with
3675 (validate_nonmember_using_decl): Use OVL_FIRST.
3676 (do_nonmember_using_decl): Use in/out parameters. Use
3677 lkp_iterator and simplify.
3678 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3679 (finish_namespace_using_decl, finish_local_using_decl): ... here.
3681 (lookup_type_current_level): Delete.
3682 * parser.c (cp_parser_using_declaration): Adjust.
3683 * pt.c (tsubst_expr): Adjust.
3685 2017-05-22 Nathan Sidwell <nathan@acm.org>
3687 * name-lookup.h (parse_using_directive): Replace with ...
3688 (finish_namespace_using_directive): ... this and ...
3689 (finish_local_using_directive): ... this.
3690 * name-lookup.c (add_using_namespace_1): Move later.
3691 (add_using_namespace): Move later, add namespace_p arg, remove
3693 (push_using_directive_1): Directly recurse.
3694 (do_using_directive, parse_using_directive): Delete, split into ...
3695 (finish_namespace_using_directive): ... this and ...
3696 (finish_local_using_directive): ... this.
3697 (push_namespace): Use add_using_namespace.
3698 * parser.c (cp_parser_using_directive): Call
3699 finish_namespace_using_directive or finish_local_using_directive.
3700 * pt.c (tsubst_expr): Call finish_local_using_directive.
3702 * cp-objcp-common.c (cp_register_dumps): Register raw dumper.
3703 * cp-tree.h (raw_dump_id): Declare.
3704 * decl2.c (raw_dump_id): Define.
3705 (dump_tu): Use raw_dump_id.
3707 * config-lang.in (gtfiles): Sort list, break lines.
3709 * cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
3710 (CPTI_TERMINATE_FN, CPTI_CALL_UNEXPECTED_FN): ... here.
3711 ( CPTI_GET_EXCEPTION_PTR_FN, CPTI_BEGIN_CATCH_FN, CPTI_END_CATCH_FN,
3712 CPTI_ALLOCATE_EXCEPTION_FN, CPTI_FREE_EXCEPTION_FN, CPTI_THROW_FN,
3713 CPTI_RETHROW_FN): New.
3714 (noexcept_deferred_spec): New.
3715 (terminate_node, call_unexpected_node): Rename to ...
3716 (terminate_fn, call_unexpected_fn): ... here.
3717 (get_exception_ptr_fn, begin_catch_fn, end_catch_fn,
3718 allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New.
3719 * except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete.
3720 (init_exception_processing): Adjust.
3721 (declare_library_fn): Create and push the fns here.
3722 (do_get_exception_ptr, do_begin_catch, do_end_catch,
3723 do_allocate_exception_ptr, do_free_exception_ptr): Adjust
3724 declare_library_fn use.
3725 (unevaluated_noexcept_spec): Adjust.
3726 * cp-gimplify.c (genericize_eh_spec_block,
3727 gimplify_most_not_throw_expr): Adjust.
3729 * name-lookup.c (pushdecl_top_level,
3730 pushdecl_top_level_and_finish): Move after namespace pushing and
3732 (push_to_top_level): Rename to ...
3733 (do_push_to_top_level): ... here. Remove timing code.
3734 (pop_from_top_level_1): Rename to ...
3735 (do_pop_from_top_level): ... here.
3736 (do_push_nested_namespace, do_pop_nested_namespace)
3737 (push_to_top_level): New wrapper for do_push_to_top_level.
3738 (pop_from_top_level): Adjust.
3739 (push_nested_namepace, pop_nested_namespace): Wrappers for workers.
3741 2017-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
3743 * config-lang.in (gtfiles): Add c-family/c-format.c,
3744 except.c, init.c, lambda.c and friend.c.
3745 * class.c (dvirt_fn): Move out of function scope,
3747 * except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise.
3748 * init.c (fn): Likewise.
3749 * lambda.c (ptr_id, max_id): Likewise.
3750 * friend.c (global_friend): Add GTY attribute.
3752 2017-05-19 Nathan Sidwell <nathan@acm.org>
3754 * call.c (add_list_candidates): Use OVL_FIRST.
3755 (build_new_method_call_1): Likewise.
3756 * cp-tree.h (OVL_SINGLE_P): New.
3757 (TYPE_HIDDEN_P): New.
3758 * decl.c (xref_tag_1): Use TYPE_HIDDEN_P.
3759 * dump.c (cp_tump_tree): Adjust overload dumping.
3760 * error.c (dump_decl): Use OVL_SINGLE_P, simplify context
3762 * method.c (lazily_declare_fn): Assert we added it.
3763 * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
3765 (cp_parser_template_name): Use lkp_iterator.
3766 * pt.c (begin_template_parm_list): Fixup comment.
3767 (instantiate_class_template_1): Use TYPE_HIDDEN_P.
3768 * tree.c (ovl_iterator::remove_node): Cope with inherited ctors.
3769 (ovl_scope): Use lkp_iterator.
3771 2017-05-19 Thomas Schwinge <thomas@codesourcery.com>
3773 * parser.c (cp_parser_omp_clause_default): Handle
3774 "OMP_CLAUSE_DEFAULT_PRESENT".
3776 * parser.c (cp_parser_omp_clause_default): Avoid printing more
3777 than one syntax error message.
3779 2017-05-19 Nathan Sidwell <nathan@acm.org>
3781 * class.c (class_dump_id): Define.
3782 (dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
3783 * cp-objcp-common.c (cp_register_dumps): New.
3784 * cp-objcp-common.h (cp_register_dumps): Declare.
3785 (LANG_HOOKS_REGISTER_DUMPS): Override.
3786 * cp-tree.h (class_dump_id): Declare.
3788 2017-05-18 Nathan Sidwell <nathan@acm.org>
3790 * cp-tree.h (OVL_ARG_DEPENDENT): Delete.
3792 (lookup_keep): Declare.
3793 * name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT.
3794 * pt.c (tsubst_copy): Assert lookup is persistent.
3795 * semantics.c (finish_call_expr): Use lkp_iterator, call
3797 * tree.c (ovl_copy): New.
3798 (ovl_insert, ovl_iterator::remove_node): Copy immutable nodes.
3801 * cp-tree.h (OVL_USED): Replace with ...
3802 (OVL_USING_P): ... this.
3803 (ovl_iterator::using_p): Adjust.
3804 * name-lookup.c (push_overloaded_decl_1,
3805 do_nonmember_using_decl): Adjust.
3806 * search.c (lookup_field_r): Adjust.
3807 * tree.c (ovl_insert, ovl_scope): Adjust.
3809 * cp-tree.h (lookup_add): Swap args.
3810 (ovl_cons, build_overload): Delete.
3811 * name-lookup.c (add_function, push_overloaded_decl_1,
3812 do_nonmember_using_decl, merge_functions, remove_hidden_names):
3813 Use lookup_add, ovl_insert.
3814 * pt.c (check_explicit_specialization): Use lookup_add.
3815 (do_class_deduction): Likewise. Refactor if.
3816 * tree.c (lookup_add): Swap args.
3817 (ovl_cons, build_overload): Delete.
3819 * name-lookup.c (find_local_binding): New, broken out of ...
3820 (lookup_name_innermost_nonclass_level_1): ... here. Call it.
3821 (set_namespace_binding): Swap scope & name args.
3822 (namespace_binding_1): Likewise.
3823 (pushdecl_maybe_friend_1): Adjust set_namespace_binding call.
3824 (push_overloaded_decl_1): Likewise.
3825 (set_global_binding): Likewise.
3826 (get_namespace_binding): Adjust namespace_binding_1 call.
3828 2017-05-17 Nathan Sidwell <nathan@acm.org>
3830 * cp-tree.h (default_hash_traits <lang_identifier *>): New
3832 * name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete.
3833 (extern_c_fns): New hash table.
3834 (check_extern_c_conflict): New, broken out of ...
3835 (pushdecl_maybe_friend_1): ... here. Call it.
3836 (c_linkage_bindings): Just look in hash table.
3838 2017-05-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3842 Implement new C++ intrinsics __is_assignable and __is_constructible.
3843 * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
3845 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3846 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3847 * method.c (constructible_expr): Set cp_unevaluated.
3848 (is_xible_helper): New.
3849 (is_trivially_xible): Adjust.
3851 * parser.c (cp_parser_primary_expression): Handle
3852 RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
3853 (cp_parser_trait_expr): Likewise.
3854 * semantics.c (trait_expr_value): Handle
3855 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3857 2017-05-17 Nathan Sidwell <nathan@acm.org>
3859 * cp-tree.h (ovl_iterator::using_p): New predicate.
3860 (ovl_iterator::remove_node): New worker.
3861 (ovl_insert): Declare.
3862 * tree.c (ovl_insert): New.
3863 (ovl_iterator::remove_node): New.
3864 * class.c (add_method): Use ovl_iterator, ovl_insert.
3865 (clone_function_decl): Fix description.
3866 (clone_constructors_and_destructors): Use ovl_iterator.
3868 * class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator.
3869 (maybe_warn_about_overly_private_class): Use ovl_iterator.
3870 (method_name_cmp, resort_method_name_cmp): Use OVL_NAME.
3871 (resort_type_method_vec, finish_struct_methods): Use OVL_FIRST.
3872 (get_base_fndecls): Use ovl_iterator.
3873 (warn_hidden): Use OVL_NAME, ovl_iterator.
3874 (add_implicitly_declared_members): Use ovl_iterator.
3875 * constraint.cc (normalize_template_id_expression): Use OVL_FIRST,
3877 (finish_shorthand_constraint): Simplify, use ovl_make.
3878 * pt.c (make_constrained_auto): Simplify. Use ovl_make.
3879 * search.c (shared_member_p): Use ovl_iterator.
3880 (lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME.
3881 (lookup_conversion_operator): Use OVL_FIRST.
3882 (lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME.
3883 (look_for_overrides_here): Use ovl_iterator.
3884 (lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator.
3885 * typeck.c (build_x_unary_op): Use ovl_make.
3887 2017-05-17 Martin Liska <mliska@suse.cz>
3889 * class.c (dump_class_hierarchy): Introduce dump_flags_t type and
3890 use it instead of int type.
3891 (dump_vtable): Likewise.
3892 (dump_vtt): Likewise.
3893 * decl2.c (dump_tu): Likewise.
3895 2017-05-16 David Malcolm <dmalcolm@redhat.com>
3897 * call.c (enforce_access): Add access_failure_info * param and use
3898 it to record access failures.
3899 * cp-tree.h (class access_failure_info): New class.
3900 (enforce_access): Add access_failure_info * param, defaulting to
3902 (lookup_member): Likewise.
3903 (locate_field_accessor): New function decl.
3904 (perform_or_defer_access_check): Add access_failure_info * param,
3906 * search.c (lookup_member): Add access_failure_info * param and
3907 pass it on to call to perform_or_defer_access_check.
3908 (matches_code_and_type_p): New function.
3909 (field_access_p): New function.
3910 (direct_accessor_p): New function.
3911 (reference_accessor_p): New function.
3912 (field_accessor_p): New function.
3913 (struct locate_field_data): New struct.
3914 (dfs_locate_field_accessor_pre): New function.
3915 (locate_field_accessor): New function.
3916 * semantics.c (perform_or_defer_access_check): Add
3917 access_failure_info * param, and pass it on to call to
3919 * typeck.c (access_failure_info::record_access_failure): New method.
3920 (access_failure_info::maybe_suggest_accessor): New method.
3921 (finish_class_member_access_expr): Pass an access_failure_info
3922 instance to the lookup_member call, and call its
3923 maybe_suggest_accessor method afterwards.
3925 2017-05-16 Marek Polacek <polacek@redhat.com>
3929 * cp-gimplify.c (cp_fold): Handle SAVE_EXPR.
3931 2017-05-16 Nathan Sidwell <nathan@acm.org>
3933 * name-lookup.c (check_local_shadow): New, broke out of ...
3934 (pushdecl_maybe_friend_1): ... here. Call it.
3936 * cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New.
3937 (ovl_first): Move inline definition to end of file.
3938 (ovl_make, lookup_add): Declare.
3939 (get_fns, get_first_fn): Make pure.
3940 * tree.c (ovl_cache): New.
3941 (ovl_make, lookup_add): New.
3942 * pt.c (do_class_deduction): Don't add candidates that will be
3945 * call.c (build_user_type_conversion_1): Use OVL_FIRST.
3946 (print_error_for_call_failure): Use OVL_NAME.
3947 (build_op_call_1): Use ovl_iterator.
3948 (add_candidates): Use OVL_FIRST & lkp_iterator.
3949 (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
3951 * class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
3952 (type_has_user_nondefault_constructor,
3953 in_class_defaulted_default_constructor,
3954 type_has_user_provided_constructor,
3955 type_has_user_provided_or_explicit_constructor,
3956 type_has_non_user_provided_default_constructor,
3957 vbase_has_user_provided_move_assign,
3958 type_has_move_constructor, type_has_move_assign,
3959 type_has_user_declared_move_constructor,
3960 type_has_user_declared_move_assign,
3961 type_build_ctor_call, type_build_dtor_call,
3962 type_requires_array_cookie, explain_non_literal_class): Likewise.
3963 (finish_struct): Use lkp_iterator.
3964 (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
3965 (note_name_declared_in_class): Use OVL_NAME.
3966 * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
3967 (pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
3968 cxx_pretty_printer::expression): Likewise.
3969 * decl2.c (check_classfn): Use ovl_iterator.
3970 * pt.c (retrieve_specialization): Use ovl_iterator.
3971 * tree.c (cp_tree_equal): Use lkp_iterator.
3972 (type_has_nontrivial_copy_init): Use ovl_iterator.
3974 * typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
3975 check is_overloaded_fn.
3977 2017-05-16 Martin Liska <mliska@suse.cz>
3979 * parser.c (cp_lexer_print_token): Add default value for flags
3980 argument of print_gimple_stmt, print_gimple_expr,
3981 print_generic_stmt and print_generic_expr.
3983 2017-05-16 Nathan Sidwell <nathan@acm.org>
3985 * cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD
3987 (MAYBE_BASELINK_FUNCTIONS): New.
3988 * constraint.cc (resolve_constraint_check): Use lkp_iterator.
3989 * decl2.c (maybe_warn_sized_delete): Use ovl_iterator.
3990 * lambda.c (maybe_generic_this_capture): Use lkp_iterator.
3991 * method.c (inherited_ctor_binfo): Use ovl_iterator.
3992 (binfo_inherited_from): Likewise.
3993 * parser.c (lookup_literal_operator): Use lkp_iterator.
3994 * pt.c (iterative_hash_template_arg): Use lkp_iterator.
3995 (print_candidates_1): Likewise.
3996 (determine_specialization): Likewise.
3997 (resolve_overloaded_unification): Likewise.
3998 (resolve_nondeduced_context): Likewise.
3999 (type_dependent_expression_p): Likewise.
4000 (dependent_template_p): Likewise.
4001 * ptree.c (cxx_print_xnode): Likewise.
4002 * semantics.c (omp_reduction_lookup): Use lkp_iterator.
4003 (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator.
4004 * typeck.c (check_template_keyword): Use lkp_iterator.
4006 * cp-tree.h (OVL_FIRST, OVL_NAME): New.
4008 * constexpr.c (function_concept_check): Use OVL_FIRST.
4009 * cvt.c (build_expr_type_conversion): Likewise.
4010 * decl.c (poplevel, grokdeclarator): Use OVL_NAME.
4011 * decl2.c (mark_used): Use OVL_FIRST.
4012 * error.c (dump_decl): Use OVL_FIRST, OVL_NAME.
4013 (dump_expr, location_of): Use OVL_FIRST.
4014 * friend.c (do_friend): Use OVL_NAME.
4015 * init.c (build_offset_ref): Use OVL_FIRST.
4016 * mangle.c (write_member_name): Likewise.
4017 (write_expression): Use OVL_NAME.
4018 * method.c (strip_inheriting_ctors): Use OVL_FIRST.
4019 * name-lookup.c (pushdecl_class_level): Use OVL_NAME.
4020 * pt.c (check_explicit_specialization): Use OVL_FIRST.
4021 (check_template_shadow): Likewise.
4022 (tsubst_template_args): Use OVL_NAME.
4023 (tsubst_baselink): Use OVL_FIRST.
4024 * semantics.c (perform_koenig_lookup): Use OVL_NAME.
4025 * tree.c (get_first_fn): Use OVL_FIRST.
4026 * typeck.c (finish_class_member_access_expr): Use OVL_NAME.
4027 (cp_build_addr_expr_1): Use OVL_FIRST.
4029 * pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF
4031 * semantics.c (finish_id_expression): Directly init local var.
4032 (finish_omp_reduction_clause): Use really_overloaded_fn.
4033 * tree.c (get_fns): Document. Assert we got an overload.
4034 (get_first_fn) Document.
4035 * typeck.c (cp_build_addr_expr_1): Pass arg directly to
4036 really_overloaded_fn.
4037 * typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly.
4039 * cp-tree.h (SCOPE_DEPTH): New.
4040 * name-lookup.h (is_nested_namespace): Declare.
4041 * name-lookup.c (is_nested_namespace): New.
4042 (is_ancestor): Use it.
4043 (set_decl_namespace): Likewise.
4044 (push_namespace): Set SCOPE_DEPTH.
4045 * pt.c (check_specialization_namespace): Use is_nested_namespace.
4046 (check_unqualigied_spec_or_inst): Likewise.
4048 2017-05-15 Nathan Sidwell <nathan@acm.org>
4051 * cp-tree.h (DECL_NAMESPACE_INLINE_P): New.
4052 * name-lookup.h (push_namespace): Return int, add make_inline arg.
4053 * name-lookup.c (push_namespace): Deal with inline directly.
4054 Return pushed count.
4055 * parser.c (cp_parser_namespace_definition): Adjust for
4056 push_namespace change.
4058 2017-05-11 Nathan Sidwell <nathan@acm.org>
4060 * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS,
4061 LANG_HOOKS_PUSHDECL): Move to ...
4062 * cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
4063 LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here.
4064 * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare.
4066 * name-lookup.h (pushdecl): Add default friend parm.
4067 (pushdecl_maybe_friend): Delete.
4068 (pushdecl_top_level): Add default friend parm.
4069 (pushdecl_top_level_maybe_friend): Delete.
4070 * name-lookup.c (pushdecl_maybe_friend): Delete.
4071 (pushdecl): Add is_friend parm.
4072 (pushdecl_top_level): Add is friend_parm.
4073 (pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete.
4074 (pushdecl_top_level_and_finish): Do pushing and finishing directly.
4075 * friend.c (do_friend): Adjust.
4076 * pt.c (tsubst_friend_class): Adjust.
4078 Revert pushdecl_top_level_and_finish name change.
4079 * name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name.
4080 * name-lookup.c (pushdecl_top_level_and_finish): Likewise.
4081 * decl.c (cp_make_fname_decl): Adjust.
4082 * decl2.c (get_guard, handle_tls_init): Adjust.
4083 * rtti.c (get_tinfo_decl, tinfo_base_init): Adjust.
4085 * name-lookup.c (pushdecl_outermost_localscope): Always
4086 conditionally stop timer.
4088 * decl.c (xref_tag_1): Don't frob ts_lambda scope here.
4089 * name-lookup.c (pushtag_1): Deal with ts_lambda scope.
4091 * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag,
4092 pushtag_top_level_maybe_friend,
4093 pushdecl_top_level_and_finish): Move declarations to ...
4094 * name-lookup.h: ... here. Group pushdecl variants.
4095 (pushdecl_top_level_and_finish): Rename to ...
4096 (pushdecl_top_level_with_init): ... here.
4097 * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init.
4098 * decl2.c (get_guard, handle_tls_init): Likewise.
4099 * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
4100 * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
4101 * method.c (implicitly_declare_fn): Likewise.
4102 * searchc (node_debug_info_needed): Likewise.
4103 * name-lookup.c (pushdecl_top_level_and_finish): Rename to ...
4104 (pushdecl_top_level_with_init): ... here.
4105 (pop_everything): Use namespace_bindings_p.
4107 * name-lookup.h (pop_binding): Rename to pop_local_binding.
4108 (getdecls): Rename to get_local_decls.
4109 * name-lookup.c (pop_binding): Rename to ...
4110 (pop_local_binding): ... here.
4111 (pop_bindings_and_leave_scope): Adjust.
4112 (getdecls): Rename to ...
4113 (get_local_decls): ... here. Assert local scope.
4114 * decl.c (poplevel): Assert not namespace. Adjust and simplify
4116 (store_parm_decls): Adjust get_local_decls call.
4117 (parser.c (synthesize_implicit_template_parm): Likewise.
4119 2017-05-11 Ville Voutilainen <ville.voutilainen@gmail.com>
4122 * method.c (is_trivially_xible): Reject void types.
4124 2017-05-10 Nathan Sidwell <nathan@acm.org>
4126 * class.c (handle_using_decl): Always use OVL_CURRENT.
4127 (resolve_address_of_overloaded_function): Move iterator decl into
4128 for scope. Don't strip anticipated decls here.
4130 * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
4132 (print_candidates): Adjust.
4134 * cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix
4136 * call.c (build_new_function_call): Lose koenig_p arg. Remove
4137 koenig_p handling here.
4138 * pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
4139 (tsubst_omp_clauses): Likewise.
4140 (do_class_deduction): Adjust buld_new_function_call calls.
4141 * semantics.c (finish_call_expr): Likewise.
4143 2017-05-10 Jason Merrill <jason@redhat.com>
4145 * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
4146 (unify_type_mismatch, unify_parameter_pack_mismatch)
4147 (unify_ptrmem_cst_mismatch, unify_expression_unequal)
4148 (unify_parameter_pack_inconsistent, unify_inconsistency)
4149 (unify_vla_arg, unify_method_type_error, unify_arity)
4150 (unify_arg_conversion, unify_no_common_base)
4151 (unify_inconsistent_template_template_parameters)
4152 (unify_template_deduction_failure)
4153 (unify_template_argument_mismatch)
4154 (unify_overload_resolution_failure): Call unify_invalid.
4156 CWG 1847 - Clarifying compatibility during partial ordering
4157 * pt.c (more_specialized_fn): No order between two non-deducible
4160 * pt.c (dependent_type_p): Make sure we aren't called with
4163 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
4164 * pt.c (convert_template_argument): Just return an argument pack.
4165 (coerce_template_parameter_pack, template_parm_to_arg)
4166 (extract_fnparm_pack, make_argument_pack, tsubst_template_args)
4167 (tsubst_decl, tsubst, type_unification_real, unify_pack_expansion):
4168 Don't set the type of a NONTYPE_ARGUMENT_PACK.
4169 * parser.c (make_char_string_pack, make_string_pack): Likewise.
4171 2017-05-10 Nathan Sidwell <nathan@acm.org>
4173 * cp-tree.h (add_method, clone_function_decl): Change last arg to
4175 * class.c (add_method): Change third arg to bool. Adjust.
4176 (one_inheriting_sig, one_inherited_ctor): Adjust.
4177 (clone_function_decl): Change 2nd arg to bool. Adjust.
4178 (clone_constructors_and_destructors): Adjust.
4179 * lambda.c (maybe_add_lambda_conv_op): Adjust.
4180 * method.c (lazily_declare_fn): Adjust.
4181 * pt.c (tsubst_decl, instantiate_template_1): Adjust.
4182 * semantics.c (finish_member_declaration): Adjust.
4184 2017-05-10 Paolo Carlini <paolo.carlini@oracle.com>
4187 * decl.c (finish_function): To improve error recovery, change the
4188 logic for calling apply_deduced_return_type.
4190 2017-05-09 Jason Merrill <jason@redhat.com>
4192 PR c++/80605 - __is_standard_layout and empty base
4193 * class.c (check_bases): Ignore empty bases.
4195 PR c++/70979 - literal class and closure types
4196 * class.c (finalize_literal_type_property): Handle closures
4198 (explain_non_literal_class): Likewise.
4200 PR c++/66297, DR 1684 - literal class and constexpr member fns
4201 * constexpr.c (is_valid_constexpr_fn): Only complain about
4202 non-literal enclosing class in C++11.
4203 * class.c (finalize_literal_type_property): Likewise.
4205 2017-05-09 Paolo Carlini <paolo.carlini@oracle.com>
4208 * pt.c (tsubst_decl): Early return error_mark_node if
4209 grok_ctor_properties returns false.
4211 2017-05-09 Jason Merrill <jason@redhat.com>
4213 PR c++/70167 - array prvalue treated as lvalue
4214 * cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New.
4216 * semantics.c (finish_compound_literal): Add fcl_context parameter.
4217 Only make a static variable for C99 syntax.
4218 * parser.c (cp_parser_postfix_expression): Pass it.
4219 * pt.c (tsubst_copy_and_build): Likewise.
4220 * call.c (extend_ref_init_temps): Set
4221 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
4223 2017-05-09 Nathan Sidwell <nathan@acm.org>
4225 * cp-lang.c (get_global_decls, cxx_pushdecl): New.
4226 (LANG_HOOKS_GETDECLS, LANG_HOOKS_PUSHDECL): Override.
4227 * name-lookup.h (pushdecl_top_level): Declare.
4229 2017-05-08 Jason Merrill <jason@redhat.com>
4231 PR c++/80178 - parameter passing for uncopyable classes
4232 * tree.c (type_has_nontrivial_copy_init): True for classes with only
4233 deleted copy/move ctors.
4234 (remember_deleted_copy, maybe_warn_parm_abi): New.
4235 * decl.c (require_complete_types_for_parms, check_function_type):
4236 Call maybe_warn_parm_abi.
4237 * call.c (convert_for_arg_passing, build_cxx_call): Likewise.
4239 2017-05-08 Nathan Sidwell <nathan@acm.org>
4241 * decl.c (builtin_function_1): Set DECL_ANTICIPATED before pushing.
4242 (start_preparsed_function): Do decl pushing before setting
4243 current_funciton_decl and announcing it.
4245 * name-lookup.h (pushdecl_with_scope): Replace with ...
4246 (pushdecl_outermost_localscope): ... this.
4247 * name-lookup.c (pushdecl_with_scope): Replace with ...
4248 (pushdecl_outermost_localscope): ... this.
4249 (pushdecl_namespace_level): Adjust.
4250 * decl.c (cp_make_fname_decl): Use pushdecl_outermost_localscope.
4251 * lambda.c (insert_capture_proxy): Likewise.
4253 * class.c (build_vtbl_initializer): Don't shadow outer variable
4256 Revert _binding -> _value change.
4257 * name-lookup.h (get_namespace_value, set_global_value): Rename to ...
4258 (get_namespace_binding, set_global_binding): ... these.
4259 * name-lookup.c (get_namespace_value, set_global_value): Rename to ...
4260 (get_namespace_binding, set_global_binding): ... these.
4261 (arg_assoc_namespace, pushdecl_maybe_friend_1,
4262 check_for_out_of_scope_variable, push_overloaded_decl_1,
4263 lookup_name_innermost_nonclass_level, push_namespace): Adjust.
4264 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
4265 SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
4266 * decl.c (poplevel): Adjust.
4267 * pt.c (make_constrained_auto): Likewise.
4269 2017-05-07 Volker Reichelt <v.reichelt@netcologne.de>
4271 PR translation/80280
4272 * call.c (print_z_candidate): Fix quoting.
4274 2017-05-05 David Malcolm <dmalcolm@redhat.com>
4276 * error.c (pedwarn_cxx98): Replace report_diagnostic
4277 with diagnostic_report_diagnostic.
4279 2017-05-05 Nathan Sidwell <nathan@acm.org>
4281 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
4282 (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value.
4283 (IDENTIFIER_NAMESPACE_VALUE): Delete.
4284 * name-lookup.h (namespace_binding, set_namespace_binding): Replace
4286 (get_namespace_value, set_global_value): ... these.
4287 (get_global_value_if_present, is_typename_at_global_scope): Delete.
4288 * decl.c (poplevel): Use get_namespace_value.
4289 (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE.
4290 * class.c (build_vtbl_initializer): Stash library decl in
4291 static var. Use IDENTIFIER_GLOBAL_VALUE.
4292 * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
4293 do_allocate_exception, do_free_exception, build_throw): Likewise.
4294 * init.c (throw_bad_array_new_length): Likewise.
4295 * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise.
4296 * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1,
4297 check_for_our_of_scope_variable, push_overloaded_decl_1): Use
4298 get_namespace_value.
4299 (set_namespace_binding_1): Rename to
4300 (set_namespace_binding): ... here.
4301 (set_global_value): New.
4302 (lookup_name_innermost_nonclass_level_1, push_namespace): Use
4303 get_namespace_value.
4304 * pt.c (listify): Use get_namespace_value.
4306 * call.c (make_temporary_var_for_ref_to_temp): Push decl into
4308 * lex.c (unqualified_name_lookup_error): Likewise.
4310 * class.c (alter_class): Use retrofit_lang_decl directly.
4311 * decl.c (push_local_name, dupliate_decls): Likewise.
4312 * semantics.c (omp_privatize_field): Likewise.
4314 Kill walk_namespaces.
4315 * cp-tree.h (walk_namespaces_fn, walk_namespaces): Delete.
4316 * decl.c (walk_namespaces_r, walk_namespaces): Delete.
4318 Kill per-namespace static_decls.
4319 * cp-tree.h (static_decls): Declare.
4320 (wrapup_globals_for_namespace,
4321 diagnose_inline_vars_for_namespace): Replace with ...
4322 (wrapup_namespace_globals): ... this.
4323 * decl.c (static_decls): Define.
4324 (wrapup_globals_for_namespace,
4325 diagnose_inline_vars_for_namespace): Replace with ...
4326 (wrapup_namespace_globals): ... this.
4327 (cxx_init_decl_processing): Initialize static_decls.
4328 * decl2.c (c_parse_final_cleanups): Adjust.
4329 * name-lookup.h (cp_binding_level): Remove static_decls member.
4330 * name-lookup.c (add_decl_to_level): Adjust.
4331 (begin_scope): Adjust.
4333 2017-05-05 Paolo Carlini <paolo.carlini@oracle.com>
4336 * decl.c (reshape_init): Unconditionally return error_mark_node
4337 upon error about too many initializers.
4339 2017-05-04 Nathan Sidwell <nathan@acm.org>
4341 * constraint.cc (diagnose_check_constraint): Fix %E thinko.
4343 2017-05-04 Martin Sebor <msebor@redhat.com>
4345 PR translation/80280
4346 * call.c (print_z_candidate): Add missing quoting to %D and other
4348 (build_op_call_1): Same.
4349 * constraint.cc (diagnose_check_constraint): Same.
4350 * mangle.c (mangle_decl): Same.
4351 * name-lookup.c (cp_binding_level_debug): Same.
4352 (set_decl_namespace): Same.
4353 * parser.c (cp_parser_tx_qualifier_opt): Same.
4354 * pt.c (print_candidates_1): Same.
4355 (check_template_variable): Same.
4356 (tsubst_default_argument): Same.
4357 (most_specialized_partial_spec): Same.
4358 * semantics.c (omp_reduction_lookup): Same.
4359 * tree.c (check_abi_tag_redeclaration): Same.
4360 * typeck.c (comptypes): Same.
4361 * typeck2.c (abstract_virtuals_error_sfinae): Same.
4363 2017-05-04 Nathan Sidwell <nathan@acm.org>
4366 * cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL,
4367 CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER,
4368 CPTI_INIT_LIST_IDENTIFIER.
4369 (global_namespace, global_type_node, global_identifier,
4370 anon_identifier, init_list_identifier): New.
4371 * decl.c (global_type_node, global_scope_name): Delete.
4372 (initialize_predefined_identifiers): Add new identifiers.
4373 (cxx_init_decl_processing): Adjust.
4374 * name-lookup.h (global_namespace, global_type_node): Delete.
4375 * name-lookup.c (global_namespace, anonymous_namespace_name,
4376 get_anonymous_namespace_name): Delete.
4377 (namespace_scope_ht_size, begin_scope, pushtag_1,
4378 push_namespace): Adjust,
4379 * call.c (type_has_extended_temps): Use init_list_identifier.
4380 * pt.c (listify): Likewise.
4382 * name-lookup.c: Reorder functions to make merging from modules
4385 2017-05-03 Jason Merrill <jason@redhat.com>
4387 * constexpr.c (cxx_eval_outermost_constant_expr): Use TV_CONSTEXPR.
4389 2017-05-03 Nathan Sidwell <nathan@acm.org>
4391 * cp-tree.h (enum cp_tree_index, cp_global_trees): Move earlier,
4392 along with #defines, to before name-lookup include.
4394 2017-05-02 Paolo Carlini <paolo.carlini@oracle.com>
4396 * pt.c (is_auto_or_concept): Remove.
4397 (type_uses_auto_or_concept): Remove, unused.
4398 (find_parameter_packs_r, extract_autos_r, is_auto_r): Adjust.
4399 * parser.c (tree_type_is_auto_or_concept): Remove, unused.
4400 * cp-tree.h (is_auto_or_concept): Remove.
4402 2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
4405 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't
4406 add pedigree operation and detach call here.
4407 * cp-gimplify.c (cp_gimplify_expr): Remove the calls to
4408 cilk_cp_gimplify_call_params_in_spawned_fn.
4409 (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function.
4410 * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN.
4412 2017-04-29 Volker Reichelt <v.reichelt@netcologne.de>
4414 * parser.c (cp_parser_member_declaration): Add fix-it hints for
4415 stray comma and missing semicolon at end of member declaration.
4417 2017-04-27 Volker Reichelt <v.reichelt@netcologne.de>
4419 * parser.c (cp_parser_cast_expression): Add target type of cast to
4421 * error.c (type_to_string): Add '{enum}' suffix to enumeration types.
4423 2017-04-26 Paolo Carlini <paolo.carlini@oracle.com>
4425 * decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change
4426 return type to bool.
4427 * cp-tree.h (grok_ctor_properties): Update.
4429 2017-04-26 Volker Reichelt <v.reichelt@netcologne.de>
4431 * parser.c (cp_parser_nested_name_specifier_opt): Add fix-it
4432 information to diagnostic of invalid colon in nested-name-specifier.
4434 2017-04-25 Volker Reichelt <v.reichelt@netcologne.de>
4436 * parser.c (cp_parser_elaborated_type_specifier): Add fix-it to
4437 diagnostic of invalid class/struct keyword after enum.
4439 2017-04-25 David Malcolm <dmalcolm@redhat.com>
4441 * parser.c (cp_parser_member_declaration): Add fix-it hint
4442 for removing stray semicolons.
4444 2017-04-25 David Malcolm <dmalcolm@redhat.com>
4446 * name-lookup.c (get_std_name_hint): New function.
4447 (maybe_suggest_missing_header): New function.
4448 (suggest_alternative_in_explicit_scope): Call
4449 maybe_suggest_missing_header.
4451 2017-04-25 David Malcolm <dmalcolm@redhat.com>
4454 * name-lookup.c (suggest_alternative_in_explicit_scope): Convert
4455 candidate type of bm from tree to const char *.
4456 (consider_binding_level): Likewise.
4457 (lookup_name_fuzzy): Likewise, using this to merge the best
4458 result from the preprocessor into bm, rather than immediately
4459 returning, so that better matches from reserved words can "win".
4460 Guard the rejection of keywords that don't start decl-specifiers
4461 so it only happens for FUZZY_LOOKUP_TYPENAME.
4463 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
4465 * decl.c (grokdeclarator): Use %qT instead of %<%T%> in diagnostics.
4466 (start_enum): Likewise.
4467 (build_enumerator): Likewise. Use %qE instead of plain %E.
4468 * parser.c (cp_parser_mem_initializer_list): Use %qD instead of
4469 %<%D%> in diagnostics.
4470 (cp_parser_elaborated_type_specifier): Likewise.
4471 * pt.c (make_pack_expansion): Use %qT and %qE instead of
4472 %<%T%> and %<%E%> in diagnostics.
4473 (tsubst_pack_expansion): Likewise.
4475 2017-04-24 David Malcolm <dmalcolm@redhat.com>
4478 * parser.c (cp_parser_unary_expression): Generate a location
4479 range for alignof and sizeof expressions.
4481 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
4483 * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to
4485 (cp_parser_virt_specifier_seq_opt): Likewise.
4486 (set_and_check_decl_spec_loc): Likewise twice.
4488 2017-04-21 Jason Merrill <jason@redhat.com>
4490 PR c++/80179 - ICE with initialized flexible array member.
4491 * constexpr.c (verify_ctor_sanity): Handle flexible array members.
4493 2017-04-21 Richard Biener <rguenther@suse.de>
4495 * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO.
4496 (copy_type): Likewise.
4497 * lex.c (copy_decl): Pass down mem-stat info.
4498 (copy_type): Likewise.
4500 2017-04-20 Jonathan Wakely <jwakely@redhat.com>
4503 * init.c (build_new_1): Suppress notes about over-aligned new when
4504 the warning is suppressed.
4506 2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
4508 * parser.c (cp_parser_member_declaration): Add warning with fixit
4509 information for extra semicolon after in-class function definition.
4511 2017-04-20 Jakub Jelinek <jakub@redhat.com>
4514 * tree.c (build_cplus_array_type): Call build_array_type
4515 with the intended TYPE_TYPELESS_STORAGE flag value, instead
4516 of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
4519 2017-04-18 Marek Polacek <polacek@redhat.com>
4521 PR c++/80244 - ICE with attribute in template alias.
4522 * tree.c (strip_typedefs): Handle UNDERLYING_TYPE.
4524 PR c++/80241 - ICE with alignas pack expansion.
4525 * error.c (dump_expr): Handle TREE_LIST.
4526 * parser.c (cp_parser_std_attribute_list): Return error_mark if
4527 make_pack_expansion returns an error.
4529 2017-04-17 Bernd Edlinger <bernd.edlinger@hotmail.de>
4532 * class.c (fixup_may_alias): Fix all type variants.
4534 2017-04-17 Jason Merrill <jason@redhat.com>
4536 PR c++/80415 - wrong error with default arg and array reference.
4537 * tree.c (lvalue_kind): Return clk_class for an array prvalue.
4539 * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
4541 2017-04-15 Alexandre Oliva <aoliva@redhat.com>
4543 * decl.c (name_unnamed_type): Split out of...
4544 (grokdeclarator): ... this.
4545 * decl.h (name_unnamed_type): Declare.
4547 2017-04-12 Richard Biener <rguenther@suse.de>
4548 Bernd Edlinger <bernd.edlinger@hotmail.de>
4551 * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE
4552 for arrays of character or std::byte type.
4554 2017-04-11 Jason Merrill <jason@redhat.com>
4556 PR c++/80294 - ICE with constexpr and inheritance.
4557 * constexpr.c (reduced_constant_expression_p):
4558 A null constructor element is non-constant.
4559 (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before
4560 returning an empty base.
4562 2017-04-11 Jakub Jelinek <jakub@redhat.com>
4565 * decl.c (cp_finish_decomp): If processing_template_decl on
4566 non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't
4567 change their DECL_VALUE_EXPR nor cp_finish_decl them. Instead make
4568 sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst
4570 * pt.c (value_dependent_expression_p) <case VAR_DECL>: For variables
4571 with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type
4574 2017-04-11 Jakub Jelinek <jakub@redhat.com>
4577 * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR.
4579 2017-04-10 Jakub Jelinek <jakub@redhat.com>
4582 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second
4583 operand, if it is a static member function, recurse on the
4586 2017-04-10 Marek Polacek <polacek@redhat.com>
4589 * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL. Set
4590 ORIG_TYPE earlier and not only when shortening.
4592 2017-04-07 Jason Merrill <jason@redhat.com>
4594 PR c++/80356 - ICE with reference to function template argument.
4596 * pt.c (convert_nontype_argument_function): Adjust type even with a
4597 value-dependent argument.
4599 PR c++/80267 - ICE with nested capture of reference
4601 * pt.c (tsubst_copy): Handle lookup finding a capture proxy.
4603 2017-04-07 Marek Polacek <polacek@redhat.com>
4606 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE.
4609 * call.c (build_over_call): Don't check cxx_dialect.
4610 * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor
4611 whether SUB is a CONSTRUCTOR.
4612 * init.c (build_new_1): Don't check cxx_dialect.
4613 * tree.c (replace_placeholders): Add a function comment. Return if
4614 not in C++14, or if the object isn't a (member of a) class.
4615 * typeck2.c (store_init_value): Don't check cxx_dialect nor whether
4616 TYPE is CLASS_TYPE_P.
4618 2017-04-05 Jakub Jelinek <jakub@redhat.com>
4621 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
4622 of a loop doing vec_safe_push of NULL. Formatting fixes.
4623 (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
4624 to newidx before calling canonical_type_parameter on newtype.
4626 2017-04-04 Volker Reichelt <v.reichelt@netcologne.de>
4629 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
4630 UNARY_PLUS_EXPR case.
4632 2017-04-03 Jason Merrill <jason@redhat.com>
4634 * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
4636 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
4638 * class.c (update_vtable_entry_for_fn): Fix typo in comment.
4639 * decl2.c (one_static_initialization_or_destruction): Likewise.
4640 * name-lookup.c (store_bindings): Likewise.
4641 * parser.c (make_call_declarator): Likewise.
4642 * pt.c (check_explicit_specialization): Likewise.
4644 2017-04-03 Jason Merrill <jason@redhat.com>
4646 PR sanitizer/79993 - ICE with VLA initialization from string
4647 PR c++/69487 - wrong VLA initialization from string
4648 * init.c (finish_length_check): Split out from build_vec_init.
4649 (build_vec_init): Handle STRING_CST.
4650 * typeck2.c (split_nonconstant_init): Handle STRING_CST.
4651 (digest_init_r): Don't give a STRING_CST VLA type.
4653 2017-03-31 Jakub Jelinek <jakub@redhat.com>
4656 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
4657 REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller
4658 for NOP_EXPR to REFERENCE_TYPE.
4661 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
4662 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
4664 * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
4665 Remove extraneous parens.
4666 (finish_trait_expr): Handle CPTK_IS_AGGREGATE.
4667 * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
4668 (cp_parser_trait_expr): Likewise.
4670 2017-03-27 Jakub Jelinek <jakub@redhat.com>
4673 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
4674 * typeck.c (cxx_mark_addressable): Likewise. Look through
4675 VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
4677 (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
4679 2017-03-24 Jason Merrill <jason@redhat.com>
4681 PR c++/77339 - ICE with invalid use of alias template.
4682 * pt.c (lookup_template_class_1): Don't try to enter the scope of an
4685 2017-03-24 Marek Polacek <polacek@redhat.com>
4688 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
4689 doesn't have side effects.
4691 2017-03-23 Jason Merrill <jason@redhat.com>
4693 PR c++/80150 - ICE with overloaded variadic deduction.
4694 * pt.c (try_one_overload): Remove asserts.
4696 PR c++/77563 - missing ambiguous conversion error.
4697 * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
4699 2017-03-23 Marek Polacek <polacek@redhat.com>
4701 * cp-tree.h: Remove a C_RID_YYCODE reference.
4703 2017-03-22 Jakub Jelinek <jakub@redhat.com>
4706 * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
4707 case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
4708 processing_template_decl.
4710 2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
4713 * name-lookup.c (pushtag_1): Add check for bogus, non template,
4714 std::initializer_list.
4716 2017-03-21 Jakub Jelinek <jakub@redhat.com>
4719 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
4721 2017-03-21 Ville Voutilainen <ville.voutilainen@gmail.com>
4724 * init.c (std_placement_new_fn_p): New.
4725 (build_new_1): Call it.
4727 2017-03-20 Jason Merrill <jason@redhat.com>
4729 PR c++/80096 - ICE with C++17 non-type auto.
4730 * pt.c (tsubst): Delay tsubst of type of template non-type
4733 PR c++/79519 - ICE with deleted template friend.
4734 * decl.c (grokdeclarator): Complain about misplaced function
4735 definition using =, as well.
4737 PR c++/79640 - infinite recursion with generic lambda.
4738 * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
4739 before substituting its initializer.
4741 2017-03-20 Marek Polacek <polacek@redhat.com>
4742 Paolo Carlini <paolo.carlini@oracle.com>
4744 PR c++/80059 - ICE with noexcept and __transaction_atomic
4745 * except.c (build_must_not_throw_expr): Call
4746 instantiate_non_dependent_expr.
4748 2017-03-19 Jason Merrill <jason@redhat.com>
4750 PR c++/80084 - wrong C++17 decomposition by reference of parameter.
4751 * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
4752 reference decomposition.
4754 PR c++/80077 - error with constexpr and -fno-elide-constructors.
4755 * constexpr.c (cxx_eval_call_expression): Set ctx->call while
4756 expanding trivial constructor.
4758 2017-03-17 Jason Merrill <jason@redhat.com>
4760 PR c++/78345 - ICE initializing array from lambda.
4761 * init.c (build_aggr_init): Check array initializer.
4762 (build_vec_init): Check the type of a CONSTRUCTOR.
4764 PR c++/80073 - C++17 ICE with virtual base.
4765 * decl.c (xref_basetypes): Also check for indirect vbases.
4767 2017-03-16 Jason Merrill <jason@redhat.com>
4769 * decl.c (start_enum): std::byte aliases anything.
4772 * constexpr.c (lookup_placeholder): Tweak.
4774 2017-03-15 Jason Merrill <jason@redhat.com>
4776 PR c++/80043 - ICE with -fpermissive
4777 * typeck.c (convert_for_assignment): Handle instantiate_type
4778 not giving an error.
4780 2017-03-14 Nathan Sidwell <nathan@acm.org>
4782 PR c++/79393 DR 1658 workaround
4783 * method.c (synthesized_method_base_walk): Inihibit abstract class
4784 virtual base access check here.
4785 (synthesized_method_walk): Not here.
4787 2017-03-13 Nathan Sidwell <nathan@acm.org>
4789 PR c++/79393 DR 1658 workaround
4790 * method.c (synthesized_method_walk): Check vbases of abstract
4791 classes for dtor walk.
4793 2017-03-10 David Malcolm <dmalcolm@redhat.com>
4795 PR translation/79848
4796 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
4798 2017-03-10 Jason Merrill <jason@redhat.com>
4800 PR c++/79960 - alias templates and partial ordering
4801 * pt.c (comp_template_args): Add partial_order parm.
4802 (template_args_equal): Likewise.
4803 (comp_template_args_porder): New.
4804 (get_partial_spec_bindings): Use it.
4806 2017-03-10 Marek Polacek <polacek@redhat.com>
4809 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
4811 2017-03-10 Jakub Jelinek <jakub@redhat.com>
4814 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
4815 Use XALLOCAVEC macro.
4818 * decl.c (finish_enum_value_list): If value is error_mark_node,
4819 don't copy it and change its type.
4820 * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
4821 of CONST_DECL is error_mark_node.
4823 2017-03-09 Marek Polacek <polacek@redhat.com>
4825 PR c++/79900 - ICE in strip_typedefs
4826 * tree.c (strip_typedefs): Skip the attribute handling if T is
4827 a variant type which hasn't been updated yet.
4829 PR c++/79687 - wrong code with pointer-to-member
4830 * init.c (constant_value_1): Break if the variable has a dynamic
4833 2017-03-08 Jason Merrill <jason@redhat.com>
4835 PR c++/79797 - ICE with self-reference in array DMI.
4836 * constexpr.c (lookup_placeholder): Split out...
4837 (cxx_eval_constant_expression): ...from here.
4839 2017-03-07 Jakub Jelinek <jakub@redhat.com>
4842 * parser.c (cp_parser_omp_cancellation_point,
4843 cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
4844 cp_parser_omp_target_update): Change "may only be used in compound
4845 statements" diagnostics, such that the same translatable string is
4846 used for all pragmas.
4847 (cp_parser_pragma): Likewise. Use error_at instead of
4848 cp_parser_error for that diagnostics.
4850 2017-03-06 Marek Polacek <polacek@redhat.com>
4852 PR c++/79796 - ICE with NSDMI and this pointer
4853 * call.c (build_over_call): Handle NSDMI with a 'this' by calling
4854 replace_placeholders.
4856 2017-03-06 Jakub Jelinek <jakub@redhat.com>
4859 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
4862 2017-03-06 Jason Merrill <jason@redhat.com>
4864 Revert "Allow deduction guides to look into primary template."
4865 * cp-tree.h, parser.c, pt.c, search.c: Revert.
4867 2017-03-05 Paolo Carlini <paolo.carlini@oracle.com>
4870 * except.c (build_must_not_throw_expr): Perform the implicit
4871 conversions on the condition.
4873 2017-03-03 Jason Merrill <jason@redhat.com>
4875 * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
4878 Core issues 2273 and 2277
4879 * call.c (joust): Adjust using-declaration tiebreaker to handle
4880 the intermediate base case.
4881 * method.c (strip_inheriting_ctors): Just return the argument if
4882 !flag_new_inheriting_ctors.
4884 2017-03-03 Richard Biener <rguenther@suse.de>
4887 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
4889 2017-03-03 Marek Polacek <polacek@redhat.com>
4892 * typeck.c (string_conv_p): In C++11, always call pedwarn with
4895 2017-03-02 Jason Merrill <jason@redhat.com>
4897 Update overload resolution with deduction guides.
4898 * pt.c (do_class_deduction): Always build the copy guide.
4899 (copy_guide_p, template_guide_p): New.
4900 (build_deduction_guide): Remember the original constructor.
4901 * call.c (joust): Prefer the copy guide and non-template guides.
4903 Allow deduction guides to look into primary template.
4904 * cp-tree.h (struct saved_scope): Add deduction_guide_type.
4905 (struct cp_decl_specifier_seq): Add constructor_p.
4906 * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
4907 (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p.
4908 Clear deduction_guide_type. Don't handle deduction guide names.
4909 (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
4910 (cp_parser_direct_declarator): Likewise. Handle deduction guides.
4911 (cp_parser_member_declaration, cp_parser_cache_defarg)
4912 (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
4913 * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
4914 (build_deduction_guide): Set deduction_guide_type.
4915 (dependent_scope_p): Check deduction_guide_type.
4916 * search.c (lookup_member): Likewise.
4918 2017-03-02 Jakub Jelinek <jakub@redhat.com>
4921 * init.c (mark_exp_read_r): New function.
4922 (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
4923 whole arguments instead of plain mark_exp_read on TREE_LIST values.
4925 2017-03-01 Jason Merrill <jason@redhat.com>
4927 Class template argument deduction in new-expression
4928 * init.c (build_new): Handle deduction from no initializer.
4929 * parser.c (cp_parser_new_expression): Don't require a single
4930 expression for class template deduction.
4931 * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
4932 class template placeholder.
4933 * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
4934 (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
4935 (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
4937 2017-03-01 Jakub Jelinek <jakub@redhat.com>
4940 * init.c (emit_mem_initializers): When not constructing vbases of
4941 abstract classes, mark arguments as read for
4942 -Wunused-but-set-parameter.
4944 2017-02-28 Jason Merrill <jason@redhat.com>
4946 Class template argument deduction refinements
4947 * call.c (joust): Move deduction guide tiebreaker down.
4948 * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
4949 deduction with no initializer.
4950 * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
4951 (do_class_deduction): Use that rather than special case.
4952 (do_auto_deduction): Handle null initializer.
4954 2017-02-28 Jakub Jelinek <jakub@redhat.com>
4956 * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
4957 instead of just cond ? "..." : "...".
4958 (grokdeclarator): Likewise.
4959 (build_enumerator): Likewise.
4960 * init.c (build_new_1): Likewise.
4961 * call.c (build_new_method_call_1): Likewise.
4962 * parser.c: Include intl.h.
4963 (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
4964 "enter"/"exit" keyword.
4965 (cp_finalize_oacc_routine): Don't use %s to supply portions of the
4968 2017-02-27 Jason Merrill <jason@redhat.com>
4970 PR c++/71568 - SFINAE forming pointer to member function
4971 * init.c (build_offset_ref): Check the return value of
4972 perform_or_defer_access_check.
4974 2017-02-27 Marek Polacek <polacek@redhat.com>
4976 * decl.c (expand_static_init): Add missing } in a comment.
4978 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de>
4980 * init.c: Include intl.h.
4981 (build_new_1): Move message strings into pedwarn to make them
4982 -Wformat-security friendly. Mark string for translation.
4983 * pt.c (tsubst_copy_and_build): Mark string for translation.
4984 Make the pointer const.
4985 * semantics.c (finish_id_expression): Mark strings for translation.
4987 2017-02-25 Jakub Jelinek <jakub@redhat.com>
4989 * call.c (build_op_delete_call): Make msg1 and msg2 const.
4991 2017-02-24 Jakub Jelinek <jakub@redhat.com>
4994 * call.c (build_over_call): Call check_function_arguments even for
4995 -Wrestrict, adjust check_function_arguments caller.
4996 * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
4998 * typeck.c (cp_build_function_call_vec): Adjust
4999 check_function_arguments caller.
5001 2017-02-24 Marek Polacek <polacek@redhat.com>
5003 PR translation/79705
5004 * decl.c (check_redeclaration_exception_specification): Mark a string
5005 for translation. Make the pointer const.
5007 2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
5010 * pt.c (register_specialization): Check duplicate_decls return value
5011 for error_mark_node and pass it back.
5013 2017-02-22 Jason Merrill <jason@redhat.com>
5015 PR c++/79679 - missing destructor for argument
5016 * call.c (build_over_call): Don't pass tf_no_cleanup to argument
5019 * pt.c (do_class_deduction): Handle 0 argument case.
5021 2017-02-22 Jakub Jelinek <jakub@redhat.com>
5024 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
5025 SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
5026 * constexpr.c (potential_constant_expression_1): Handle
5027 OMP_*, OACC_* and CILK_* trees. Use error_at with
5028 EXPR_LOC_OR_LOC (t, input_location) computed early
5029 instead of error, or error_at with location_of (t).
5031 2017-02-22 Marek Polacek <polacek@redhat.com>
5034 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
5035 if the alignas expression is erroneous.
5036 * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
5040 * semantics.c (finish_underlying_type): Bail out for incomplete enums.
5042 2017-02-21 Jason Merrill <jason@redhat.com>
5044 PR c++/50308 - wrong deprecated warning with ADL
5045 PR c++/17729 - duplicate deprecated warning
5046 * semantics.c (finish_id_expression): Only call mark_used on a
5047 function if we aren't building a call.
5049 PR c++/41727 - ICE with partial spec of partial instantiation
5050 * pt.c (process_partial_specialization): For now, don't check more
5051 specialized if there is more than one level of args.
5053 2017-02-21 Marek Polacek <polacek@redhat.com>
5056 * cp-tree.h (maybe_reject_flexarray_init): Declare.
5057 * init.c (maybe_reject_flexarray_init): No longer static.
5058 Add check for current_function_decl.
5059 * parser.c (cp_parser_late_parse_one_default_arg): Reject
5060 a default mem-initializer for a flexible array.
5062 2017-02-21 Jakub Jelinek <jakub@redhat.com>
5063 Paolo Carlini <paolo.carlini@oracle.com>
5066 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
5068 * pt.c (tsubst_decomp_names): Return error_mark_node if the first
5069 decl after the decomposition artificial decl has error_mark_node.
5070 * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
5071 instead of just == error_mark_node comparison.
5073 2017-02-21 Jakub Jelinek <jakub@redhat.com>
5076 * decl.c: Include gimplify.h.
5077 (cp_finish_decomp): Make sure there is no sharing of trees
5078 in between DECL_VALUE_EXPR of decomposition decls.
5081 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
5084 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
5085 call cplus_expand_constant on it first.
5087 2017-02-19 Jason Merrill <jason@redhat.com>
5089 PR c++/78139 - destructor needed by new-expression
5090 * call.c (build_special_member_call): Use tf_no_cleanup.
5092 PR c++/78282 - auto template and pack expansion
5093 * pt.c (find_parameter_packs_r): Don't walk into the type of
5094 templates other than template template-parameters.
5096 PR c++/79606 - ICE with this->base_member in NSDMI
5097 * class.c (build_base_path): Check processing_template_decl.
5099 PR c++/79607 - ICE with T{} initializer
5100 * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
5102 PR c++/79566 - elaborated-type-specifier in range for
5103 * parser.c (cp_parser_simple_declaration): Fix check for type
5106 PR c++/79400 - confusing suggestion of 'noexcept'
5107 * parser.c (cp_parser_exception_specification_opt): Remove
5108 suggestion for deprecated dynamic exception-specification.
5110 PR c++/79470 - partial ordering with reference parameters
5111 * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
5113 PR c++/79500 - ICE with non-template deduction guide
5114 * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
5115 DECL_TEMPLATE_RESULT.
5117 PR c++/79580 - ICE with compound literal
5118 * parser.c (cp_parser_class_head): If we're in the middle of an
5119 expression, use ts_within_enclosing_non_class.
5121 PR c++/79503 - inherited ctor taking base class
5122 * call.c (add_function_candidate): Also check that
5123 DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
5125 2017-02-19 Paolo Carlini <paolo.carlini@oracle.com>
5128 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
5131 2017-02-19 Eric Fiselier <eric@efcs.ca>
5132 Jonathan Wakely <jwakely@redhat.com>
5135 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
5136 control warning about literal suffix identifiers without a leading
5139 2017-02-17 Jason Merrill <jason@redhat.com>
5141 PR c++/79508 - lookup error with member template
5142 * parser.c (cp_parser_template_name): Clear
5143 parser->context->object_type if we aren't doing lookup.
5145 PR c++/78690 - ICE with using and global type with same name
5146 * pt.c (type_dependent_object_expression_p): True for
5149 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
5150 * pt.c (convert_template_argument): Just return an auto arg pack.
5151 (tsubst_template_args): Don't tsubst an auto pack type.
5153 PR c++/79556 - C++17 ICE with non-type auto
5154 * pt.c (do_auto_deduction): Don't try to deduce from null type.
5156 PR c++/79533 - C++17 ICE with temporary cast to reference
5157 * call.c (build_over_call): Conversion to a reference prevents copy
5160 2017-02-16 Jakub Jelinek <jakub@redhat.com>
5161 Jason Merrill <jason@redhat.com>
5163 PR c++/79502 - lost nodiscard attribute
5164 * pt.c (apply_late_template_attributes): Do apply non-dependent
5165 attributes to types.
5167 2017-02-16 Jason Merrill <jason@redhat.com>
5169 PR c++/78572 - ICE with self-modifying array initializer
5170 * constexpr.c (cxx_eval_store_expression): The object we're
5171 initializing is outside the constant-expression.
5172 (cxx_eval_call_expression): Set ctx->call.
5174 PR c++/79050 - ICE with undeduced auto and LTO
5175 * decl.c (poplevel): Remove undeduced auto decls.
5177 2017-02-16 Jakub Jelinek <jakub@redhat.com>
5180 * parser.c (cp_parser_omp_target): For -fopenmp-simd
5181 ignore #pragma omp target even when not followed by identifier.
5183 2017-02-15 Jason Merrill <jason@redhat.com>
5184 Jakub Jelinek <jakub@redhat.com>
5186 PR c++/79464 - ICE in IPA with omitted constructor parms
5187 * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
5188 (adjust_clone_args): Adjust.
5189 (add_method): Remember omitted parms.
5190 * call.c (add_function_candidate): Likewise.
5191 * mangle.c (write_method_parms): Likewise.
5192 * method.c (ctor_omit_inherited_parms): Return false if there are no
5195 2017-02-15 Martin Sebor <msebor@redhat.com>
5198 * init.c (maybe_reject_flexarray_init): New function.
5199 (perform_member_init): Call it.
5201 2017-02-15 Jakub Jelinek <jakub@redhat.com>
5204 * parser.c (cp_parser_std_attribute): Don't pedwarn about
5205 [[deprecated]] with -std=c++11 and [[fallthrough]] with
5206 -std=c++11 and -std=c++14.
5209 * decl.c (grokdeclarator): For static data members, handle thread_p
5210 only after handling inline.
5212 2017-02-14 Marek Polacek <polacek@redhat.com>
5216 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
5217 clobbering if the postfix expression isn't an EXPR_P.
5219 2017-02-13 Jason Merrill <jason@redhat.com>
5221 PR c++/79461 - ICE with lambda in constexpr constructor
5222 * constexpr.c (build_data_member_initialization): Ignore
5223 initialization of a local variable.
5225 2017-02-13 Jakub Jelinek <jakub@redhat.com>
5227 * init.c (warn_placement_new_too_small): Add missing space in
5229 * parser.c (cp_parser_oacc_declare): Likewise.
5230 * mangle.c (maybe_check_abi_tags): Likewise.
5233 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
5234 on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
5235 in the rightmost operand.
5237 2017-02-13 Nathan Sidwell <nathan@acm.org>
5239 PR c++/79296 - ICE mangling localized template instantiation
5240 * decl2.c (determine_visibility): Use template fn context for
5241 local class instantiations.
5243 2017-02-11 Jason Merrill <jason@redhat.com>
5245 PR c++/77659 - ICE with new and C++14 aggregate NSDMI
5246 * init.c (build_new): Make backups of any CONSTRUCTORs in init.
5247 (build_new_1): Use replace_placeholders.
5248 * tree.c (replace_placeholders_t): Also track whether we've seen a
5250 (replace_placeholders, replace_placeholders_r): Adjust.
5251 * cp-tree.h: Adjust.
5253 PR c++/77790 - ICE with auto function in C++11 mode
5254 * decl.c (undeduced_auto_decl): Remove C++14 limitation.
5255 (require_deduced_type): Add complain parm, return bool.
5256 * cp-tree.h: Adjust.
5257 * decl2.c (mark_used): Use require_deduced_type.
5259 2017-02-10 Jason Merrill <jason@redhat.com>
5261 PR c++/78908 - template ops and bitfields
5262 * tree.c (build_min_non_dep): Use unlowered_expr_type.
5264 PR c++/78897 - constexpr union
5265 * constexpr.c (cxx_eval_store_expression): A store to a union member
5266 erases a previous store to another member.
5268 PR c++/71285 - member of fold-expression
5269 * semantics.c (finish_unary_fold_expr)
5270 (finish_binary_fold_expr): Use null type for fold-expressions.
5272 PR c++/79401 - protected inherited constructor
5273 * call.c (enforce_access): For inheriting constructor, find a base
5274 binfo in the path we already have.
5276 2017-02-10 Marek Polacek <polacek@redhat.com>
5279 * pt.c (type_dependent_expression_p): Check if the expression type
5283 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
5284 if warnings shouldn't be given.
5286 2017-02-10 Paolo Carlini <paolo.carlini@oracle.com>
5289 * pt.c (tsubst_decl): Don't try to preserve a typedef that names
5290 an error_mark_node as type.
5292 2017-02-09 Jakub Jelinek <jakub@redhat.com>
5293 Jason Merrill <jason@redhat.com>
5296 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
5297 from pattern to type.
5299 2017-02-09 Jason Merrill <jason@redhat.com>
5301 PR c++/79316 - default argument in deduction guide
5302 PR c++/79350 - explicit deduction guide
5303 * parser.c (cp_parser_constructor_declarator_p)
5304 (cp_parser_direct_declarator): Parse deduction guides more like
5306 * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
5307 * tree.c (special_function_p): Return it.
5308 * decl.c (check_special_function_return_type): Handle it.
5309 (grokdeclarator, grokfndecl): Adjust.
5310 (cp_finish_decl): Pass flags to do_auto_deduction.
5311 * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
5312 * pt.c (dguide_name_p): Take a const_tree.
5313 (do_class_deduction): Handle explicit.
5314 (do_auto_deduction): Pass flags through.
5315 (build_deduction_guide): Copy explicit flag.
5317 2017-02-09 Jakub Jelinek <jakub@redhat.com>
5320 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
5321 non-pragma_compound context here.
5322 (cp_parser_omp_target): Likewise.
5323 (cp_parser_pragma): Don't call push_omp_privatization_clauses and
5324 parsing for ordered and target omp pragmas in non-pragma_stmt
5325 non-pragma_compound contexts.
5328 * parser.c (cp_parser_oacc_declare): Formatting fix.
5329 (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
5330 automatic variables.
5332 2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
5333 Chung-Lin Tang <cltang@codesourcery.com>
5335 * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix
5336 parsing. Parse constant expression. Remove semantic checking.
5337 (cp_parser_omp_clause_collapse): Disallow tile.
5338 (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse
5339 error about missing for after already emitting one. Use more
5340 conventional for idiom for unbounded loop.
5341 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
5342 * semantics.c (finish_omp_clauses): Correct TILE semantic check.
5343 (finish_omp_for): Deal with tile clause.
5345 2017-02-07 Nathan Sidwell <nathan@acm.org>
5347 * method.c (synthesized_method_base_walk): New. Broken out of ...
5348 (synthesized_method_walk): ... here. Call it. Cleanup
5351 2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
5354 * typeck2.c (process_init_constructor_union): Consider only
5355 FIELD_DECLs when looking for an NSDMI.
5357 2017-02-06 Jason Merrill <jason@redhat.com>
5359 PR c++/71193 - incomplete types in templates
5360 * parser.c (cp_parser_postfix_dot_deref_expression): In a template
5361 handle incomplete type by pedwarning and then treating as dependent.
5363 2017-02-06 Jakub Jelinek <jakub@redhat.com>
5366 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
5367 (potential_constant_expression_1): Likewise.
5370 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
5371 allow one fewer than expected arguments if flag_permissive.
5374 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
5375 * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
5376 with error_mark_node type.
5378 2017-02-03 Jason Merrill <jason@redhat.com>
5380 PR c++/78689 - ICE on constructor with label
5381 * optimize.c (maybe_clone_body): Replace omitted parameters with
5383 * class.c (build_clone): Fix logic for omitting inherited parms.
5385 PR c++/12245 - excessive memory use
5386 * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
5387 back in. Don't cache constants.
5388 (maybe_constant_init): Don't cache constants.
5390 PR c++/79294 - ICE with invalid template argument
5391 * pt.c (convert_nontype_argument_function): Check value-dependence.
5392 (convert_nontype_argument): Don't check it here for function ptrs.
5394 2017-02-02 Richard Biener <rguenther@suse.de>
5397 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
5398 it lazily on the first changed element only and copy it
5399 fully upfront, only storing changed elements.
5401 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
5404 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
5407 2017-01-31 Jakub Jelinek <jakub@redhat.com>
5410 * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
5413 2017-01-31 David Malcolm <dmalcolm@redhat.com>
5416 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
5417 any namespace aliases.
5419 2017-01-31 Nathan Sidwell <nathan@acm.org>
5422 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
5426 * pt.c: (instantiate_decl): Push to top level when current
5427 function scope doesn't match. Only push lmabda scope stack when
5430 * cp-tree.h (instantiate_decl): Make defer_ok bool.
5431 * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
5432 (instantiate_decl): Simplify and reorder state saving and restoration.
5435 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
5436 * semantics.c (finish_member_declaration): Assert class is being
5439 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
5441 Introduce C++ support in libcc1.
5442 * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
5443 (ansi_opname): Rename to...
5444 (cp_operator_id): ... this. Adjust all callers.
5445 (ansi_assopname): Rename to...
5446 (cp_assignment_operator_id): ... this. Adjust all callers.
5447 (cp_literal_operator_id): Declare.
5448 (set_global_friend): Declare.
5449 (is_global_friend): Declare.
5450 (enum cp_oracle_request): New type.
5451 (cp_binding_oracle_function): New type.
5452 (cp_binding_oracle): Declare.
5453 (cp_finish_injected_record_type): Declare.
5454 * friend.c (global_friend): New var.
5455 (set_global_friend): New fn.
5456 (is_global_friend): New fn.
5457 (is_friend): Call is_global_friend.
5458 * name-lookup.c (cp_binding_oracle): New var.
5459 (query_oracle): New fn.
5460 (qualified_lookup_using_namespace): Call query_oracle.
5461 (lookup_name_real_1): Likewise.
5462 * parser.c (cp_literal_operator_id): Drop static.
5463 * search.c (friend_accessible_p): Call is_global_friend.
5464 * semantics.c (is_this_parameter): Accept a variable if the
5465 binding oracle is enabled.
5467 2017-01-27 Jason Merrill <jason@redhat.com>
5469 PR c++/78771 - ICE with inherited constructor.
5470 * call.c (build_over_call): Call deduce_inheriting_ctor here.
5471 * pt.c (tsubst_decl): Not here.
5472 * class.c (add_method): Or here.
5473 * method.c (deduce_inheriting_ctor): Handle clones.
5474 (implicitly_declare_fn): Don't deduce inheriting ctors yet.
5476 2017-01-27 Adam Butcher <adam@jessamine.co.uk>
5479 * parser.c (parsing_default_capturing_generic_lambda_in_template):
5481 * cp-tree.h: Declare it.
5482 * semantics.c (finish_id_expression): Resolve names within a default
5483 capturing generic lambda defined within a template prior to
5484 instantiation to allow for captures to be added to the closure type.
5486 2017-01-26 Jakub Jelinek <jakub@redhat.com>
5489 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
5490 * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
5491 * parser.c (cp_parser_builtin_offsetof): Pass result of
5492 build_static_cast of null_pointer_node to finish_offsetof.
5493 * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
5494 it for -Winvalid-offsetof pedwarn instead of trying to guess
5495 original offsetof type from EXPR. Save OBJECT_PTR as a new
5496 second operand to OFFSETOF_EXPR.
5497 * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
5498 finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
5501 2017-01-26 Jason Merrill <jason@redhat.com>
5503 * name-lookup.c (parse_using_directive): Deprecate strong using.
5505 PR c++/79176 - lambda ICE with -flto -Os
5506 * decl2.c (vague_linkage_p): Handle decloned 'tors.
5507 * tree.c (decl_linkage): Likewise.
5509 2017-01-25 Martin Sebor <msebor@redhat.com>
5511 * decl.c (grokdeclarator): Fix a typo in a comment.
5513 2017-01-25 Jakub Jelinek <jakub@redhat.com>
5516 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
5520 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
5521 OPT_Wpedantic on lambda templates for -std=c++14 and higher.
5523 2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
5526 * decl.c (cxx_init_decl_processing): Pass main_input_filename
5527 to build_translation_unit_decl.
5529 2017-01-24 Jakub Jelinek <jakub@redhat.com>
5532 * cp-gimplify.c (cp_genericize_r): Add result of
5533 convert_from_reference on invisiref parm to p_set.
5535 2017-01-24 Nathan Sidwell <nathan@acm.org>
5537 PR c++/78469 - defaulted ctor and inaccessible dtor
5538 * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
5539 * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
5540 * tree.c (build_target_expr): Check tf_no_cleanup.
5542 PR c++/79118 - anon-members and constexpr
5543 * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
5544 ctor decl. Recursively check anonymous members.
5545 (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
5547 (explain_invalid_constexpr_fn): Likewise.
5549 2017-01-23 Nathan Sidwell <nathan@acm.org>
5551 PR c++/71710 - template using directive of field
5552 * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
5555 PR c++/71406 - ICE with scope-ref'd template id exprs
5557 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
5558 before breaking up TEMPLATE_ID_EXPR.
5560 2017-01-20 Nathan Sidwell <nathan@acm.org>
5562 PR c++/78495 - wrong code inherited ctor and invisi-ref parm
5563 * cp-gimplify.c (cp_generize_r): Don't skip thunks.
5565 2017-01-20 David Malcolm <dmalcolm@redhat.com>
5569 * cp-tree.h (suggest_alternatives_for): Add bool param.
5570 (suggest_alternative_in_explicit_scope): New decl.
5571 * error.c (qualified_name_lookup_error): When SCOPE is a namespace
5572 that isn't the global one, call new function
5573 suggest_alternative_in_explicit_scope, only calling
5574 suggest_alternatives_for if it fails, and disabling near match
5575 searches fort that case. When SCOPE is the global namespace,
5576 pass true for new param to suggest_alternatives_for to allow for
5578 * lex.c (unqualified_name_lookup_error): Pass true for new param
5579 to suggest_alternatives_for.
5580 * name-lookup.c (consider_binding_level): Add forward decl.
5581 (suggest_alternatives_for): Add "suggest_misspellings" param,
5582 using it to conditionalize the fuzzy name-lookup code.
5583 (suggest_alternative_in_explicit_scope): New function.
5584 * parser.c (cp_parser_primary_expression): When calling
5585 finish_id_expression, pass location of id_expression rather
5586 than that of id_expr_token.
5587 (cp_parser_id_expression): Convert local "unqualified_id" from
5588 tree to cp_expr to avoid implicitly dropping location information.
5590 2017-01-20 Marek Polacek <polacek@redhat.com>
5593 * call.c (build_conditional_expr_1): Warn about duplicated branches.
5594 * semantics.c (finish_expr_stmt): Build statement using the proper
5597 2017-01-19 Jason Merrill <jason@redhat.com>
5599 US 20 - forwarding references and class template argument deduction
5600 * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
5601 * pt.c (push_template_decl_real): Set it.
5602 (maybe_adjust_types_for_deduction): Check it.
5603 (rewrite_template_parm): Copy it.
5605 US 19 - deduction guides and constructors
5606 * call.c (joust): Prefer deduction guides to constructors.
5607 * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
5608 (deduction_guide_p): Check DECL_P.
5610 * decl.c (check_initializer): Always use build_aggr_init for array
5613 PR c++/79130 - decomposition and direct-initialization
5614 * init.c (build_aggr_init): Communicate direct-initialization to
5616 (build_vec_init): Check for array copy sooner.
5617 * parser.c (cp_parser_decomposition_declaration): Remove call to
5618 build_x_compound_expr_from_list.
5620 2017-01-18 Jason Merrill <jason@redhat.com>
5622 PR c++/68666 - member variable template-id
5623 * typeck.c (finish_class_member_access_expr): Handle variable
5625 * pt.c (lookup_and_finish_template_variable): No longer static.
5626 * cp-tree.h: Declare it.
5628 2017-01-18 Nathan Sidwell <nathan@acm.org>
5631 * call.c (build_over_call): When checking ellipsis conversions for
5632 an inherited ctor, make sure there is at least one conversion.
5634 2017-01-18 Jason Merrill <jason@redhat.com>
5636 PR c++/78894 - ICE with class deduction and default arg
5637 * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
5639 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5642 * mangle.c (write_discriminator): Reorganize abi warning check.
5644 2017-01-18 Nathan Sidwell <nathan@acm.org>
5646 * cp-tree.h: Clarify exception spec node comment.
5647 * except.c (nothrow_spec_p): Simplify by checking node-equality.
5650 * mangle.c (write_exception_spec): Check nothrow explicitly.
5651 (write_encoding): Don't increment processing_template_decl around
5654 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5657 * mangle.c (write_template_args): Add "on" for operator names.
5659 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5662 * mangle.c (write_discriminator): Handle discriminator >= 10.
5664 2017-01-17 Nathan Sidwell <nathan@acm.org>
5667 * cp-tree.h (maybe_generic_this_capture): Declare.
5668 * lambda.c (resolvable_dummy_lambda): New, broken out of ...
5669 (maybe_resolve_dummy): ... here. Call it.
5670 (maybe_generic_this_capture): New.
5671 * parser.c (cp_parser_postfix_expression): Speculatively capture
5672 this in generic lambda in unresolved member function call.
5673 * pt.c (tsubst_copy_and_build): Force hard error from failed
5674 member function lookup in generic lambda.
5676 2017-01-17 Aldy Hernandez <aldyh@redhat.com>
5679 * cp-array-notation.c (expand_array_notation_exprs): Handle
5682 2017-01-11 Jason Merrill <jason@redhat.com>
5684 PR c++/78337 - ICE on invalid with generic lambda
5685 * semantics.c (process_outer_var_ref): Check if containing_function
5686 is null. Move inform call under complain test.
5688 2017-01-11 Nathan Sidwell <nathan@acm.org>
5691 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
5694 2017-01-11 Nathan Sidwell <nathan@acm.org>
5696 * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
5698 2017-01-11 Jakub Jelinek <jakub@redhat.com>
5701 * parser.c (cp_parser_std_attribute_spec): Remove over-eager
5702 assertion. Formatting fix.
5705 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
5708 2017-01-10 David Malcolm <dmalcolm@redhat.com>
5711 * parser.c (cp_parser_class_specifier_1): Only suggest inserting
5712 a missing semicolon if we have a valid insertion location for
5715 2017-01-10 Jason Merrill <jason@redhat.com>
5717 FI 20, decomposition declaration with parenthesized initializer.
5718 * parser.c (cp_parser_decomposition_declaration): Use
5719 cp_parser_initializer.
5721 2017-01-09 Jason Merrill <jason@redhat.com>
5723 Implement P0195R2, C++17 variadic using.
5724 * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
5725 * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
5726 * error.c (dump_decl): Likewise.
5728 2017-01-09 Jakub Jelinek <jakub@redhat.com>
5730 PR translation/79019
5731 PR translation/79020
5732 * semantics.c (finish_omp_clauses): Add missing whitespace to
5733 translatable strings.
5734 * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
5736 2017-01-07 Jason Merrill <jason@redhat.com>
5738 PR c++/78948 - instantiation from discarded statement
5739 * parser.h (struct cp_parser): Remove in_discarded_stmt field.
5740 * cp-tree.h (in_discarded_stmt): Declare it.
5741 (struct saved_scope): Add discarded_stmt bitfield.
5742 (in_discarded_stmt): New macro.
5743 * decl2.c (mark_used): Check it.
5744 * parser.c (cp_parser_selection_statement): Adjust.
5745 (cp_parser_jump_statement): Adjust.
5747 2017-01-05 Jakub Jelinek <jakub@redhat.com>
5750 * decl.c (cp_finish_decomp): Remove probe variable, if tt is
5751 REFERENCE_REF_P, set tt to its operand.
5754 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
5755 unions even for C++11 and later.
5757 2017-01-05 Nathan Sidwell <nathan@acm.org>
5760 * pt.c (convert_nontype_argument): Don't try and see if integral
5761 or enum expressions are constants prematurely.
5763 2017-01-04 Marek Polacek <polacek@redhat.com>
5766 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
5767 a zero character literal.
5769 2017-01-04 Jakub Jelinek <jakub@redhat.com>
5772 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
5776 * parser.c (cp_parser_simple_declaration): Only complain about
5777 inconsistent auto deduction if auto_result doesn't use auto.
5779 * parser.c (cp_parser_simple_declaration): Diagnose function
5780 declaration among more than one init-declarators with auto
5784 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
5785 assertion, as lexer->buffer may be NULL.
5787 2017-01-04 Marek Polacek <polacek@redhat.com>
5791 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
5793 2017-01-04 Nathan Sidwell <nathan@acm.org>
5796 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
5797 (lambda_capture_field_type): Update prototype.
5798 * lambda.c (lambda_capture_field_type): Add is_reference parm.
5799 Add referenceness here.
5800 (add_capture): Adjust lambda_capture_field_type call, refactor
5802 * pt.c (tsubst): Adjust lambda_capture_field_type call.
5804 2017-01-01 Jakub Jelinek <jakub@redhat.com>
5806 Update copyright years.
5808 Copyright (C) 2017 Free Software Foundation, Inc.
5810 Copying and distribution of this file, with or without modification,
5811 are permitted in any medium without royalty provided the copyright
5812 notice and this notice are preserved.