1 2017-04-07 Marek Polacek <polacek@redhat.com>
4 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE.
7 * call.c (build_over_call): Don't check cxx_dialect.
8 * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor
9 whether SUB is a CONSTRUCTOR.
10 * init.c (build_new_1): Don't check cxx_dialect.
11 * tree.c (replace_placeholders): Add a function comment. Return if
12 not in C++14, or if the object isn't a (member of a) class.
13 * typeck2.c (store_init_value): Don't check cxx_dialect nor whether
16 2017-04-05 Jakub Jelinek <jakub@redhat.com>
19 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
20 of a loop doing vec_safe_push of NULL. Formatting fixes.
21 (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
22 to newidx before calling canonical_type_parameter on newtype.
24 2017-04-04 Volker Reichelt <v.reichelt@netcologne.de>
27 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
30 2017-04-03 Jason Merrill <jason@redhat.com>
32 * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
34 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
36 * class.c (update_vtable_entry_for_fn): Fix typo in comment.
37 * decl2.c (one_static_initialization_or_destruction): Likewise.
38 * name-lookup.c (store_bindings): Likewise.
39 * parser.c (make_call_declarator): Likewise.
40 * pt.c (check_explicit_specialization): Likewise.
42 2017-04-03 Jason Merrill <jason@redhat.com>
44 PR sanitizer/79993 - ICE with VLA initialization from string
45 PR c++/69487 - wrong VLA initialization from string
46 * init.c (finish_length_check): Split out from build_vec_init.
47 (build_vec_init): Handle STRING_CST.
48 * typeck2.c (split_nonconstant_init): Handle STRING_CST.
49 (digest_init_r): Don't give a STRING_CST VLA type.
51 2017-03-31 Jakub Jelinek <jakub@redhat.com>
54 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
55 REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller
56 for NOP_EXPR to REFERENCE_TYPE.
59 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
60 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
62 * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
63 Remove extraneous parens.
64 (finish_trait_expr): Handle CPTK_IS_AGGREGATE.
65 * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
66 (cp_parser_trait_expr): Likewise.
68 2017-03-27 Jakub Jelinek <jakub@redhat.com>
71 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
72 * typeck.c (cxx_mark_addressable): Likewise. Look through
73 VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
75 (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
77 2017-03-24 Jason Merrill <jason@redhat.com>
79 PR c++/77339 - ICE with invalid use of alias template.
80 * pt.c (lookup_template_class_1): Don't try to enter the scope of an
83 2017-03-24 Marek Polacek <polacek@redhat.com>
86 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
87 doesn't have side effects.
89 2017-03-23 Jason Merrill <jason@redhat.com>
91 PR c++/80150 - ICE with overloaded variadic deduction.
92 * pt.c (try_one_overload): Remove asserts.
94 PR c++/77563 - missing ambiguous conversion error.
95 * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
97 2017-03-23 Marek Polacek <polacek@redhat.com>
99 * cp-tree.h: Remove a C_RID_YYCODE reference.
101 2017-03-22 Jakub Jelinek <jakub@redhat.com>
104 * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
105 case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
106 processing_template_decl.
108 2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
111 * name-lookup.c (pushtag_1): Add check for bogus, non template,
112 std::initializer_list.
114 2017-03-21 Jakub Jelinek <jakub@redhat.com>
117 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
119 2017-03-21 Ville Voutilainen <ville.voutilainen@gmail.com>
122 * init.c (std_placement_new_fn_p): New.
123 (build_new_1): Call it.
125 2017-03-20 Jason Merrill <jason@redhat.com>
127 PR c++/80096 - ICE with C++17 non-type auto.
128 * pt.c (tsubst): Delay tsubst of type of template non-type
131 PR c++/79519 - ICE with deleted template friend.
132 * decl.c (grokdeclarator): Complain about misplaced function
133 definition using =, as well.
135 PR c++/79640 - infinite recursion with generic lambda.
136 * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
137 before substituting its initializer.
139 2017-03-20 Marek Polacek <polacek@redhat.com>
140 Paolo Carlini <paolo.carlini@oracle.com>
142 PR c++/80059 - ICE with noexcept and __transaction_atomic
143 * except.c (build_must_not_throw_expr): Call
144 instantiate_non_dependent_expr.
146 2017-03-19 Jason Merrill <jason@redhat.com>
148 PR c++/80084 - wrong C++17 decomposition by reference of parameter.
149 * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
150 reference decomposition.
152 PR c++/80077 - error with constexpr and -fno-elide-constructors.
153 * constexpr.c (cxx_eval_call_expression): Set ctx->call while
154 expanding trivial constructor.
156 2017-03-17 Jason Merrill <jason@redhat.com>
158 PR c++/78345 - ICE initializing array from lambda.
159 * init.c (build_aggr_init): Check array initializer.
160 (build_vec_init): Check the type of a CONSTRUCTOR.
162 PR c++/80073 - C++17 ICE with virtual base.
163 * decl.c (xref_basetypes): Also check for indirect vbases.
165 2017-03-16 Jason Merrill <jason@redhat.com>
167 * decl.c (start_enum): std::byte aliases anything.
170 * constexpr.c (lookup_placeholder): Tweak.
172 2017-03-15 Jason Merrill <jason@redhat.com>
174 PR c++/80043 - ICE with -fpermissive
175 * typeck.c (convert_for_assignment): Handle instantiate_type
178 2017-03-14 Nathan Sidwell <nathan@acm.org>
180 PR c++/79393 DR 1658 workaround
181 * method.c (synthesized_method_base_walk): Inihibit abstract class
182 virtual base access check here.
183 (synthesized_method_walk): Not here.
185 2017-03-13 Nathan Sidwell <nathan@acm.org>
187 PR c++/79393 DR 1658 workaround
188 * method.c (synthesized_method_walk): Check vbases of abstract
189 classes for dtor walk.
191 2017-03-10 David Malcolm <dmalcolm@redhat.com>
194 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
196 2017-03-10 Jason Merrill <jason@redhat.com>
198 PR c++/79960 - alias templates and partial ordering
199 * pt.c (comp_template_args): Add partial_order parm.
200 (template_args_equal): Likewise.
201 (comp_template_args_porder): New.
202 (get_partial_spec_bindings): Use it.
204 2017-03-10 Marek Polacek <polacek@redhat.com>
207 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
209 2017-03-10 Jakub Jelinek <jakub@redhat.com>
212 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
213 Use XALLOCAVEC macro.
216 * decl.c (finish_enum_value_list): If value is error_mark_node,
217 don't copy it and change its type.
218 * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
219 of CONST_DECL is error_mark_node.
221 2017-03-09 Marek Polacek <polacek@redhat.com>
223 PR c++/79900 - ICE in strip_typedefs
224 * tree.c (strip_typedefs): Skip the attribute handling if T is
225 a variant type which hasn't been updated yet.
227 PR c++/79687 - wrong code with pointer-to-member
228 * init.c (constant_value_1): Break if the variable has a dynamic
231 2017-03-08 Jason Merrill <jason@redhat.com>
233 PR c++/79797 - ICE with self-reference in array DMI.
234 * constexpr.c (lookup_placeholder): Split out...
235 (cxx_eval_constant_expression): ...from here.
237 2017-03-07 Jakub Jelinek <jakub@redhat.com>
240 * parser.c (cp_parser_omp_cancellation_point,
241 cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
242 cp_parser_omp_target_update): Change "may only be used in compound
243 statements" diagnostics, such that the same translatable string is
244 used for all pragmas.
245 (cp_parser_pragma): Likewise. Use error_at instead of
246 cp_parser_error for that diagnostics.
248 2017-03-06 Marek Polacek <polacek@redhat.com>
250 PR c++/79796 - ICE with NSDMI and this pointer
251 * call.c (build_over_call): Handle NSDMI with a 'this' by calling
252 replace_placeholders.
254 2017-03-06 Jakub Jelinek <jakub@redhat.com>
257 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
260 2017-03-06 Jason Merrill <jason@redhat.com>
262 Revert "Allow deduction guides to look into primary template."
263 * cp-tree.h, parser.c, pt.c, search.c: Revert.
265 2017-03-05 Paolo Carlini <paolo.carlini@oracle.com>
268 * except.c (build_must_not_throw_expr): Perform the implicit
269 conversions on the condition.
271 2017-03-03 Jason Merrill <jason@redhat.com>
273 * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
276 Core issues 2273 and 2277
277 * call.c (joust): Adjust using-declaration tiebreaker to handle
278 the intermediate base case.
279 * method.c (strip_inheriting_ctors): Just return the argument if
280 !flag_new_inheriting_ctors.
282 2017-03-03 Richard Biener <rguenther@suse.de>
285 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
287 2017-03-03 Marek Polacek <polacek@redhat.com>
290 * typeck.c (string_conv_p): In C++11, always call pedwarn with
293 2017-03-02 Jason Merrill <jason@redhat.com>
295 Update overload resolution with deduction guides.
296 * pt.c (do_class_deduction): Always build the copy guide.
297 (copy_guide_p, template_guide_p): New.
298 (build_deduction_guide): Remember the original constructor.
299 * call.c (joust): Prefer the copy guide and non-template guides.
301 Allow deduction guides to look into primary template.
302 * cp-tree.h (struct saved_scope): Add deduction_guide_type.
303 (struct cp_decl_specifier_seq): Add constructor_p.
304 * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
305 (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p.
306 Clear deduction_guide_type. Don't handle deduction guide names.
307 (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
308 (cp_parser_direct_declarator): Likewise. Handle deduction guides.
309 (cp_parser_member_declaration, cp_parser_cache_defarg)
310 (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
311 * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
312 (build_deduction_guide): Set deduction_guide_type.
313 (dependent_scope_p): Check deduction_guide_type.
314 * search.c (lookup_member): Likewise.
316 2017-03-02 Jakub Jelinek <jakub@redhat.com>
319 * init.c (mark_exp_read_r): New function.
320 (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
321 whole arguments instead of plain mark_exp_read on TREE_LIST values.
323 2017-03-01 Jason Merrill <jason@redhat.com>
325 Class template argument deduction in new-expression
326 * init.c (build_new): Handle deduction from no initializer.
327 * parser.c (cp_parser_new_expression): Don't require a single
328 expression for class template deduction.
329 * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
330 class template placeholder.
331 * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
332 (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
333 (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
335 2017-03-01 Jakub Jelinek <jakub@redhat.com>
338 * init.c (emit_mem_initializers): When not constructing vbases of
339 abstract classes, mark arguments as read for
340 -Wunused-but-set-parameter.
342 2017-02-28 Jason Merrill <jason@redhat.com>
344 Class template argument deduction refinements
345 * call.c (joust): Move deduction guide tiebreaker down.
346 * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
347 deduction with no initializer.
348 * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
349 (do_class_deduction): Use that rather than special case.
350 (do_auto_deduction): Handle null initializer.
352 2017-02-28 Jakub Jelinek <jakub@redhat.com>
354 * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
355 instead of just cond ? "..." : "...".
356 (grokdeclarator): Likewise.
357 (build_enumerator): Likewise.
358 * init.c (build_new_1): Likewise.
359 * call.c (build_new_method_call_1): Likewise.
360 * parser.c: Include intl.h.
361 (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
362 "enter"/"exit" keyword.
363 (cp_finalize_oacc_routine): Don't use %s to supply portions of the
366 2017-02-27 Jason Merrill <jason@redhat.com>
368 PR c++/71568 - SFINAE forming pointer to member function
369 * init.c (build_offset_ref): Check the return value of
370 perform_or_defer_access_check.
372 2017-02-27 Marek Polacek <polacek@redhat.com>
374 * decl.c (expand_static_init): Add missing } in a comment.
376 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de>
378 * init.c: Include intl.h.
379 (build_new_1): Move message strings into pedwarn to make them
380 -Wformat-security friendly. Mark string for translation.
381 * pt.c (tsubst_copy_and_build): Mark string for translation.
382 Make the pointer const.
383 * semantics.c (finish_id_expression): Mark strings for translation.
385 2017-02-25 Jakub Jelinek <jakub@redhat.com>
387 * call.c (build_op_delete_call): Make msg1 and msg2 const.
389 2017-02-24 Jakub Jelinek <jakub@redhat.com>
392 * call.c (build_over_call): Call check_function_arguments even for
393 -Wrestrict, adjust check_function_arguments caller.
394 * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
396 * typeck.c (cp_build_function_call_vec): Adjust
397 check_function_arguments caller.
399 2017-02-24 Marek Polacek <polacek@redhat.com>
402 * decl.c (check_redeclaration_exception_specification): Mark a string
403 for translation. Make the pointer const.
405 2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
408 * pt.c (register_specialization): Check duplicate_decls return value
409 for error_mark_node and pass it back.
411 2017-02-22 Jason Merrill <jason@redhat.com>
413 PR c++/79679 - missing destructor for argument
414 * call.c (build_over_call): Don't pass tf_no_cleanup to argument
417 * pt.c (do_class_deduction): Handle 0 argument case.
419 2017-02-22 Jakub Jelinek <jakub@redhat.com>
422 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
423 SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
424 * constexpr.c (potential_constant_expression_1): Handle
425 OMP_*, OACC_* and CILK_* trees. Use error_at with
426 EXPR_LOC_OR_LOC (t, input_location) computed early
427 instead of error, or error_at with location_of (t).
429 2017-02-22 Marek Polacek <polacek@redhat.com>
432 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
433 if the alignas expression is erroneous.
434 * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
438 * semantics.c (finish_underlying_type): Bail out for incomplete enums.
440 2017-02-21 Jason Merrill <jason@redhat.com>
442 PR c++/50308 - wrong deprecated warning with ADL
443 PR c++/17729 - duplicate deprecated warning
444 * semantics.c (finish_id_expression): Only call mark_used on a
445 function if we aren't building a call.
447 PR c++/41727 - ICE with partial spec of partial instantiation
448 * pt.c (process_partial_specialization): For now, don't check more
449 specialized if there is more than one level of args.
451 2017-02-21 Marek Polacek <polacek@redhat.com>
454 * cp-tree.h (maybe_reject_flexarray_init): Declare.
455 * init.c (maybe_reject_flexarray_init): No longer static.
456 Add check for current_function_decl.
457 * parser.c (cp_parser_late_parse_one_default_arg): Reject
458 a default mem-initializer for a flexible array.
460 2017-02-21 Jakub Jelinek <jakub@redhat.com>
461 Paolo Carlini <paolo.carlini@oracle.com>
464 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
466 * pt.c (tsubst_decomp_names): Return error_mark_node if the first
467 decl after the decomposition artificial decl has error_mark_node.
468 * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
469 instead of just == error_mark_node comparison.
471 2017-02-21 Jakub Jelinek <jakub@redhat.com>
474 * decl.c: Include gimplify.h.
475 (cp_finish_decomp): Make sure there is no sharing of trees
476 in between DECL_VALUE_EXPR of decomposition decls.
479 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
482 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
483 call cplus_expand_constant on it first.
485 2017-02-19 Jason Merrill <jason@redhat.com>
487 PR c++/78139 - destructor needed by new-expression
488 * call.c (build_special_member_call): Use tf_no_cleanup.
490 PR c++/78282 - auto template and pack expansion
491 * pt.c (find_parameter_packs_r): Don't walk into the type of
492 templates other than template template-parameters.
494 PR c++/79606 - ICE with this->base_member in NSDMI
495 * class.c (build_base_path): Check processing_template_decl.
497 PR c++/79607 - ICE with T{} initializer
498 * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
500 PR c++/79566 - elaborated-type-specifier in range for
501 * parser.c (cp_parser_simple_declaration): Fix check for type
504 PR c++/79400 - confusing suggestion of 'noexcept'
505 * parser.c (cp_parser_exception_specification_opt): Remove
506 suggestion for deprecated dynamic exception-specification.
508 PR c++/79470 - partial ordering with reference parameters
509 * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
511 PR c++/79500 - ICE with non-template deduction guide
512 * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
513 DECL_TEMPLATE_RESULT.
515 PR c++/79580 - ICE with compound literal
516 * parser.c (cp_parser_class_head): If we're in the middle of an
517 expression, use ts_within_enclosing_non_class.
519 PR c++/79503 - inherited ctor taking base class
520 * call.c (add_function_candidate): Also check that
521 DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
523 2017-02-19 Paolo Carlini <paolo.carlini@oracle.com>
526 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
529 2017-02-19 Eric Fiselier <eric@efcs.ca>
530 Jonathan Wakely <jwakely@redhat.com>
533 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
534 control warning about literal suffix identifiers without a leading
537 2017-02-17 Jason Merrill <jason@redhat.com>
539 PR c++/79508 - lookup error with member template
540 * parser.c (cp_parser_template_name): Clear
541 parser->context->object_type if we aren't doing lookup.
543 PR c++/78690 - ICE with using and global type with same name
544 * pt.c (type_dependent_object_expression_p): True for
547 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
548 * pt.c (convert_template_argument): Just return an auto arg pack.
549 (tsubst_template_args): Don't tsubst an auto pack type.
551 PR c++/79556 - C++17 ICE with non-type auto
552 * pt.c (do_auto_deduction): Don't try to deduce from null type.
554 PR c++/79533 - C++17 ICE with temporary cast to reference
555 * call.c (build_over_call): Conversion to a reference prevents copy
558 2017-02-16 Jakub Jelinek <jakub@redhat.com>
559 Jason Merrill <jason@redhat.com>
561 PR c++/79502 - lost nodiscard attribute
562 * pt.c (apply_late_template_attributes): Do apply non-dependent
565 2017-02-16 Jason Merrill <jason@redhat.com>
567 PR c++/78572 - ICE with self-modifying array initializer
568 * constexpr.c (cxx_eval_store_expression): The object we're
569 initializing is outside the constant-expression.
570 (cxx_eval_call_expression): Set ctx->call.
572 PR c++/79050 - ICE with undeduced auto and LTO
573 * decl.c (poplevel): Remove undeduced auto decls.
575 2017-02-16 Jakub Jelinek <jakub@redhat.com>
578 * parser.c (cp_parser_omp_target): For -fopenmp-simd
579 ignore #pragma omp target even when not followed by identifier.
581 2017-02-15 Jason Merrill <jason@redhat.com>
582 Jakub Jelinek <jakub@redhat.com>
584 PR c++/79464 - ICE in IPA with omitted constructor parms
585 * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
586 (adjust_clone_args): Adjust.
587 (add_method): Remember omitted parms.
588 * call.c (add_function_candidate): Likewise.
589 * mangle.c (write_method_parms): Likewise.
590 * method.c (ctor_omit_inherited_parms): Return false if there are no
593 2017-02-15 Martin Sebor <msebor@redhat.com>
596 * init.c (maybe_reject_flexarray_init): New function.
597 (perform_member_init): Call it.
599 2017-02-15 Jakub Jelinek <jakub@redhat.com>
602 * parser.c (cp_parser_std_attribute): Don't pedwarn about
603 [[deprecated]] with -std=c++11 and [[fallthrough]] with
604 -std=c++11 and -std=c++14.
607 * decl.c (grokdeclarator): For static data members, handle thread_p
608 only after handling inline.
610 2017-02-14 Marek Polacek <polacek@redhat.com>
614 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
615 clobbering if the postfix expression isn't an EXPR_P.
617 2017-02-13 Jason Merrill <jason@redhat.com>
619 PR c++/79461 - ICE with lambda in constexpr constructor
620 * constexpr.c (build_data_member_initialization): Ignore
621 initialization of a local variable.
623 2017-02-13 Jakub Jelinek <jakub@redhat.com>
625 * init.c (warn_placement_new_too_small): Add missing space in
627 * parser.c (cp_parser_oacc_declare): Likewise.
628 * mangle.c (maybe_check_abi_tags): Likewise.
631 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
632 on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
633 in the rightmost operand.
635 2017-02-13 Nathan Sidwell <nathan@acm.org>
637 PR c++/79296 - ICE mangling localized template instantiation
638 * decl2.c (determine_visibility): Use template fn context for
639 local class instantiations.
641 2017-02-11 Jason Merrill <jason@redhat.com>
643 PR c++/77659 - ICE with new and C++14 aggregate NSDMI
644 * init.c (build_new): Make backups of any CONSTRUCTORs in init.
645 (build_new_1): Use replace_placeholders.
646 * tree.c (replace_placeholders_t): Also track whether we've seen a
648 (replace_placeholders, replace_placeholders_r): Adjust.
651 PR c++/77790 - ICE with auto function in C++11 mode
652 * decl.c (undeduced_auto_decl): Remove C++14 limitation.
653 (require_deduced_type): Add complain parm, return bool.
655 * decl2.c (mark_used): Use require_deduced_type.
657 2017-02-10 Jason Merrill <jason@redhat.com>
659 PR c++/78908 - template ops and bitfields
660 * tree.c (build_min_non_dep): Use unlowered_expr_type.
662 PR c++/78897 - constexpr union
663 * constexpr.c (cxx_eval_store_expression): A store to a union member
664 erases a previous store to another member.
666 PR c++/71285 - member of fold-expression
667 * semantics.c (finish_unary_fold_expr)
668 (finish_binary_fold_expr): Use null type for fold-expressions.
670 PR c++/79401 - protected inherited constructor
671 * call.c (enforce_access): For inheriting constructor, find a base
672 binfo in the path we already have.
674 2017-02-10 Marek Polacek <polacek@redhat.com>
677 * pt.c (type_dependent_expression_p): Check if the expression type
681 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
682 if warnings shouldn't be given.
684 2017-02-10 Paolo Carlini <paolo.carlini@oracle.com>
687 * pt.c (tsubst_decl): Don't try to preserve a typedef that names
688 an error_mark_node as type.
690 2017-02-09 Jakub Jelinek <jakub@redhat.com>
691 Jason Merrill <jason@redhat.com>
694 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
695 from pattern to type.
697 2017-02-09 Jason Merrill <jason@redhat.com>
699 PR c++/79316 - default argument in deduction guide
700 PR c++/79350 - explicit deduction guide
701 * parser.c (cp_parser_constructor_declarator_p)
702 (cp_parser_direct_declarator): Parse deduction guides more like
704 * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
705 * tree.c (special_function_p): Return it.
706 * decl.c (check_special_function_return_type): Handle it.
707 (grokdeclarator, grokfndecl): Adjust.
708 (cp_finish_decl): Pass flags to do_auto_deduction.
709 * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
710 * pt.c (dguide_name_p): Take a const_tree.
711 (do_class_deduction): Handle explicit.
712 (do_auto_deduction): Pass flags through.
713 (build_deduction_guide): Copy explicit flag.
715 2017-02-09 Jakub Jelinek <jakub@redhat.com>
718 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
719 non-pragma_compound context here.
720 (cp_parser_omp_target): Likewise.
721 (cp_parser_pragma): Don't call push_omp_privatization_clauses and
722 parsing for ordered and target omp pragmas in non-pragma_stmt
723 non-pragma_compound contexts.
726 * parser.c (cp_parser_oacc_declare): Formatting fix.
727 (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
730 2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
731 Chung-Lin Tang <cltang@codesourcery.com>
733 * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix
734 parsing. Parse constant expression. Remove semantic checking.
735 (cp_parser_omp_clause_collapse): Disallow tile.
736 (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse
737 error about missing for after already emitting one. Use more
738 conventional for idiom for unbounded loop.
739 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
740 * semantics.c (finish_omp_clauses): Correct TILE semantic check.
741 (finish_omp_for): Deal with tile clause.
743 2017-02-07 Nathan Sidwell <nathan@acm.org>
745 * method.c (synthesized_method_base_walk): New. Broken out of ...
746 (synthesized_method_walk): ... here. Call it. Cleanup
749 2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
752 * typeck2.c (process_init_constructor_union): Consider only
753 FIELD_DECLs when looking for an NSDMI.
755 2017-02-06 Jason Merrill <jason@redhat.com>
757 PR c++/71193 - incomplete types in templates
758 * parser.c (cp_parser_postfix_dot_deref_expression): In a template
759 handle incomplete type by pedwarning and then treating as dependent.
761 2017-02-06 Jakub Jelinek <jakub@redhat.com>
764 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
765 (potential_constant_expression_1): Likewise.
768 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
769 allow one fewer than expected arguments if flag_permissive.
772 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
773 * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
774 with error_mark_node type.
776 2017-02-03 Jason Merrill <jason@redhat.com>
778 PR c++/78689 - ICE on constructor with label
779 * optimize.c (maybe_clone_body): Replace omitted parameters with
781 * class.c (build_clone): Fix logic for omitting inherited parms.
783 PR c++/12245 - excessive memory use
784 * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
785 back in. Don't cache constants.
786 (maybe_constant_init): Don't cache constants.
788 PR c++/79294 - ICE with invalid template argument
789 * pt.c (convert_nontype_argument_function): Check value-dependence.
790 (convert_nontype_argument): Don't check it here for function ptrs.
792 2017-02-02 Richard Biener <rguenther@suse.de>
795 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
796 it lazily on the first changed element only and copy it
797 fully upfront, only storing changed elements.
799 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
802 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
805 2017-01-31 Jakub Jelinek <jakub@redhat.com>
808 * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
811 2017-01-31 David Malcolm <dmalcolm@redhat.com>
814 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
815 any namespace aliases.
817 2017-01-31 Nathan Sidwell <nathan@acm.org>
820 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
824 * pt.c: (instantiate_decl): Push to top level when current
825 function scope doesn't match. Only push lmabda scope stack when
828 * cp-tree.h (instantiate_decl): Make defer_ok bool.
829 * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
830 (instantiate_decl): Simplify and reorder state saving and restoration.
833 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
834 * semantics.c (finish_member_declaration): Assert class is being
837 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
839 Introduce C++ support in libcc1.
840 * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
841 (ansi_opname): Rename to...
842 (cp_operator_id): ... this. Adjust all callers.
843 (ansi_assopname): Rename to...
844 (cp_assignment_operator_id): ... this. Adjust all callers.
845 (cp_literal_operator_id): Declare.
846 (set_global_friend): Declare.
847 (is_global_friend): Declare.
848 (enum cp_oracle_request): New type.
849 (cp_binding_oracle_function): New type.
850 (cp_binding_oracle): Declare.
851 (cp_finish_injected_record_type): Declare.
852 * friend.c (global_friend): New var.
853 (set_global_friend): New fn.
854 (is_global_friend): New fn.
855 (is_friend): Call is_global_friend.
856 * name-lookup.c (cp_binding_oracle): New var.
857 (query_oracle): New fn.
858 (qualified_lookup_using_namespace): Call query_oracle.
859 (lookup_name_real_1): Likewise.
860 * parser.c (cp_literal_operator_id): Drop static.
861 * search.c (friend_accessible_p): Call is_global_friend.
862 * semantics.c (is_this_parameter): Accept a variable if the
863 binding oracle is enabled.
865 2017-01-27 Jason Merrill <jason@redhat.com>
867 PR c++/78771 - ICE with inherited constructor.
868 * call.c (build_over_call): Call deduce_inheriting_ctor here.
869 * pt.c (tsubst_decl): Not here.
870 * class.c (add_method): Or here.
871 * method.c (deduce_inheriting_ctor): Handle clones.
872 (implicitly_declare_fn): Don't deduce inheriting ctors yet.
874 2017-01-27 Adam Butcher <adam@jessamine.co.uk>
877 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
879 * cp/cp-tree.h: Declare it.
880 * cp/semantics.c (finish_id_expression): Resolve names within a default
881 capturing generic lambda defined within a template prior to
882 instantiation to allow for captures to be added to the closure type.
884 2017-01-26 Jakub Jelinek <jakub@redhat.com>
887 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
888 * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
889 * parser.c (cp_parser_builtin_offsetof): Pass result of
890 build_static_cast of null_pointer_node to finish_offsetof.
891 * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
892 it for -Winvalid-offsetof pedwarn instead of trying to guess
893 original offsetof type from EXPR. Save OBJECT_PTR as a new
894 second operand to OFFSETOF_EXPR.
895 * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
896 finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
899 2017-01-26 Jason Merrill <jason@redhat.com>
901 * name-lookup.c (parse_using_directive): Deprecate strong using.
903 PR c++/79176 - lambda ICE with -flto -Os
904 * decl2.c (vague_linkage_p): Handle decloned 'tors.
905 * tree.c (decl_linkage): Likewise.
907 2017-01-25 Martin Sebor <msebor@redhat.com>
909 * decl.c (grokdeclarator): Fix a typo in a comment.
911 2017-01-25 Jakub Jelinek <jakub@redhat.com>
914 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
918 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
919 OPT_Wpedantic on lambda templates for -std=c++14 and higher.
921 2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
924 * decl.c (cxx_init_decl_processing): Pass main_input_filename
925 to build_translation_unit_decl.
927 2017-01-24 Jakub Jelinek <jakub@redhat.com>
930 * cp-gimplify.c (cp_genericize_r): Add result of
931 convert_from_reference on invisiref parm to p_set.
933 2017-01-24 Nathan Sidwell <nathan@acm.org>
935 PR c++/78469 - defaulted ctor and inaccessible dtor
936 * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
937 * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
938 * tree.c (build_target_expr): Check tf_no_cleanup.
940 PR c++/79118 - anon-members and constexpr
941 * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
942 ctor decl. Recursively check anonymous members.
943 (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
945 (explain_invalid_constexpr_fn): Likewise.
947 2017-01-23 Nathan Sidwell <nathan@acm.org>
949 PR c++/71710 - template using directive of field
950 * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
953 PR c++/71406 - ICE with scope-ref'd template id exprs
955 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
956 before breaking up TEMPLATE_ID_EXPR.
958 2017-01-20 Nathan Sidwell <nathan@acm.org>
960 PR c++/78495 - wrong code inherited ctor and invisi-ref parm
961 * cp-gimplify.c (cp_generize_r): Don't skip thunks.
963 2017-01-20 David Malcolm <dmalcolm@redhat.com>
967 * cp-tree.h (suggest_alternatives_for): Add bool param.
968 (suggest_alternative_in_explicit_scope): New decl.
969 * error.c (qualified_name_lookup_error): When SCOPE is a namespace
970 that isn't the global one, call new function
971 suggest_alternative_in_explicit_scope, only calling
972 suggest_alternatives_for if it fails, and disabling near match
973 searches fort that case. When SCOPE is the global namespace,
974 pass true for new param to suggest_alternatives_for to allow for
976 * lex.c (unqualified_name_lookup_error): Pass true for new param
977 to suggest_alternatives_for.
978 * name-lookup.c (consider_binding_level): Add forward decl.
979 (suggest_alternatives_for): Add "suggest_misspellings" param,
980 using it to conditionalize the fuzzy name-lookup code.
981 (suggest_alternative_in_explicit_scope): New function.
982 * parser.c (cp_parser_primary_expression): When calling
983 finish_id_expression, pass location of id_expression rather
984 than that of id_expr_token.
985 (cp_parser_id_expression): Convert local "unqualified_id" from
986 tree to cp_expr to avoid implicitly dropping location information.
988 2017-01-20 Marek Polacek <polacek@redhat.com>
991 * call.c (build_conditional_expr_1): Warn about duplicated branches.
992 * semantics.c (finish_expr_stmt): Build statement using the proper
995 2017-01-19 Jason Merrill <jason@redhat.com>
997 US 20 - forwarding references and class template argument deduction
998 * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
999 * pt.c (push_template_decl_real): Set it.
1000 (maybe_adjust_types_for_deduction): Check it.
1001 (rewrite_template_parm): Copy it.
1003 US 19 - deduction guides and constructors
1004 * call.c (joust): Prefer deduction guides to constructors.
1005 * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
1006 (deduction_guide_p): Check DECL_P.
1008 * decl.c (check_initializer): Always use build_aggr_init for array
1011 PR c++/79130 - decomposition and direct-initialization
1012 * init.c (build_aggr_init): Communicate direct-initialization to
1014 (build_vec_init): Check for array copy sooner.
1015 * parser.c (cp_parser_decomposition_declaration): Remove call to
1016 build_x_compound_expr_from_list.
1018 2017-01-18 Jason Merrill <jason@redhat.com>
1020 PR c++/68666 - member variable template-id
1021 * typeck.c (finish_class_member_access_expr): Handle variable
1023 * pt.c (lookup_and_finish_template_variable): No longer static.
1024 * cp-tree.h: Declare it.
1026 2017-01-18 Nathan Sidwell <nathan@acm.org>
1029 * call.c (build_over_call): When checking ellipsis conversions for
1030 an inherited ctor, make sure there is at least one conversion.
1032 2017-01-18 Jason Merrill <jason@redhat.com>
1034 PR c++/78894 - ICE with class deduction and default arg
1035 * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
1037 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
1040 * mangle.c (write_discriminator): Reorganize abi warning check.
1042 2017-01-18 Nathan Sidwell <nathan@acm.org>
1044 * cp-tree.h: Clarify exception spec node comment.
1045 * except.c (nothrow_spec_p): Simplify by checking node-equality.
1048 * mangle.c (write_exception_spec): Check nothrow explicitly.
1049 (write_encoding): Don't increment processing_template_decl around
1052 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
1055 * mangle.c (write_template_args): Add "on" for operator names.
1057 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
1060 * mangle.c (write_discriminator): Handle discriminator >= 10.
1062 2017-01-17 Nathan Sidwell <nathan@acm.org>
1065 * cp-tree.h (maybe_generic_this_capture): Declare.
1066 * lambda.c (resolvable_dummy_lambda): New, broken out of ...
1067 (maybe_resolve_dummy): ... here. Call it.
1068 (maybe_generic_this_capture): New.
1069 * parser.c (cp_parser_postfix_expression): Speculatively capture
1070 this in generic lambda in unresolved member function call.
1071 * pt.c (tsubst_copy_and_build): Force hard error from failed
1072 member function lookup in generic lambda.
1074 2017-01-17 Aldy Hernandez <aldyh@redhat.com>
1077 * cp-array-notation.c (expand_array_notation_exprs): Handle
1080 2017-01-11 Jason Merrill <jason@redhat.com>
1082 PR c++/78337 - ICE on invalid with generic lambda
1083 * semantics.c (process_outer_var_ref): Check if containing_function
1084 is null. Move inform call under complain test.
1086 2017-01-11 Nathan Sidwell <nathan@acm.org>
1089 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
1092 2017-01-11 Nathan Sidwell <nathan@acm.org>
1094 * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
1096 2017-01-11 Jakub Jelinek <jakub@redhat.com>
1099 * parser.c (cp_parser_std_attribute_spec): Remove over-eager
1100 assertion. Formatting fix.
1103 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
1106 2017-01-10 David Malcolm <dmalcolm@redhat.com>
1109 * parser.c (cp_parser_class_specifier_1): Only suggest inserting
1110 a missing semicolon if we have a valid insertion location for
1113 2017-01-10 Jason Merrill <jason@redhat.com>
1115 FI 20, decomposition declaration with parenthesized initializer.
1116 * parser.c (cp_parser_decomposition_declaration): Use
1117 cp_parser_initializer.
1119 2017-01-09 Jason Merrill <jason@redhat.com>
1121 Implement P0195R2, C++17 variadic using.
1122 * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
1123 * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
1124 * error.c (dump_decl): Likewise.
1126 2017-01-09 Jakub Jelinek <jakub@redhat.com>
1128 PR translation/79019
1129 PR translation/79020
1130 * semantics.c (finish_omp_clauses): Add missing whitespace to
1131 translatable strings.
1132 * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
1134 2017-01-07 Jason Merrill <jason@redhat.com>
1136 PR c++/78948 - instantiation from discarded statement
1137 * parser.h (struct cp_parser): Remove in_discarded_stmt field.
1138 * cp-tree.h (in_discarded_stmt): Declare it.
1139 (struct saved_scope): Add discarded_stmt bitfield.
1140 (in_discarded_stmt): New macro.
1141 * decl2.c (mark_used): Check it.
1142 * parser.c (cp_parser_selection_statement): Adjust.
1143 (cp_parser_jump_statement): Adjust.
1145 2017-01-05 Jakub Jelinek <jakub@redhat.com>
1148 * decl.c (cp_finish_decomp): Remove probe variable, if tt is
1149 REFERENCE_REF_P, set tt to its operand.
1152 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
1153 unions even for C++11 and later.
1155 2017-01-05 Nathan Sidwell <nathan@acm.org>
1158 * pt.c (convert_nontype_argument): Don't try and see if integral
1159 or enum expressions are constants prematurely.
1161 2017-01-04 Marek Polacek <polacek@redhat.com>
1164 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
1165 a zero character literal.
1167 2017-01-04 Jakub Jelinek <jakub@redhat.com>
1170 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
1174 * parser.c (cp_parser_simple_declaration): Only complain about
1175 inconsistent auto deduction if auto_result doesn't use auto.
1177 * parser.c (cp_parser_simple_declaration): Diagnose function
1178 declaration among more than one init-declarators with auto
1182 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
1183 assertion, as lexer->buffer may be NULL.
1185 2017-01-04 Marek Polacek <polacek@redhat.com>
1189 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
1191 2017-01-04 Nathan Sidwell <nathan@acm.org>
1194 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
1195 (lambda_capture_field_type): Update prototype.
1196 * lambda.c (lambda_capture_field_type): Add is_reference parm.
1197 Add referenceness here.
1198 (add_capture): Adjust lambda_capture_field_type call, refactor
1200 * pt.c (tsubst): Adjust lambda_capture_field_type call.
1202 2017-01-01 Jakub Jelinek <jakub@redhat.com>
1204 Update copyright years.
1206 Copyright (C) 2017 Free Software Foundation, Inc.
1208 Copying and distribution of this file, with or without modification,
1209 are permitted in any medium without royalty provided the copyright
1210 notice and this notice are preserved.