Don't warn when alignment of global common data exceeds maximum alignment.
[official-gcc.git] / gcc / cp / ChangeLog-2018
bloba53ea05251017a3cbf440cfd1af560f7ebd1d385
1 2018-12-27  Martin Liska  <mliska@suse.cz>
3         PR c++/88263
4         * decl2.c (get_local_tls_init_fn): Add location_t argument and
5         use it.
6         (get_tls_init_fn): Call it with location of variable for which
7         we'll need to create tls_init function.
8         (handle_tls_init): Likewise.
10 2018-12-21  Jakub Jelinek  <jakub@redhat.com>
12         PR c++/86524
13         PR c++/88446
14         * cp-tree.h (cp_fold_maybe_rvalue, cp_fold_rvalue): Declare.
15         (fold_non_dependent_expr): Add manifestly_const_eval argument.
16         * constexpr.c (cxx_eval_builtin_function_call): Evaluate
17         __builtin_constant_p if ctx->manifestly_const_eval even in constexpr
18         functions.  Don't reuse dummy{1,2} vars between different arguments.
19         Use cp_fold_rvalue instead of cp_fully_fold.  Fix comment typo.
20         (fold_non_dependent_expr): Add manifestly_const_eval argument, pass
21         it through to cxx_eval_outermost_constant_expr and
22         maybe_constant_value.
23         * cp-gimplify.c (cp_fold_maybe_rvalue, cp_fold_rvalue): No longer
24         static.
25         * semantics.c (finish_static_assert): Call fold_non_dependent_expr
26         with true as manifestly_const_eval.
28 2018-12-20  Marek Polacek  <polacek@redhat.com>
30         PR c++/88196 - ICE with class non-type template parameter.
31         * pt.c (convert_nontype_argument): If the expr is a PTRMEM_CST, also
32         check if the type we're converting it to is TYPE_PTRMEM_P.
34 2018-12-20  H.J. Lu  <hongjiu.lu@intel.com>
36         PR c/51628
37         * call.c (convert_for_arg_passing): Call
38         warn_for_address_or_pointer_of_packed_member.
39         * typeck.c (convert_for_assignment): Likewise.
41 2018-12-20  Jakub Jelinek  <jakub@redhat.com>
43         PR c++/88180
44         * parser.c (cp_parser_class_specifier_1): If
45         cp_parser_check_type_definition fails, skip default arguments, NSDMIs,
46         etc. like for erroneous template args.
48         * cp-tree.h (cp_fully_fold_init): Declare.
49         * cp-gimplify.c (cp_fully_fold_init): New function.
50         * typeck2.c (split_nonconstant_init, store_init_value): Use it
51         instead of cp_fully_fold.
53 2018-12-19  Segher Boessenkool  <segher@kernel.crashing.org>
55         * parser.c (cp_parser_asm_definition): Do not allow any asm qualifiers
56         on top-level asm.
58 2018-12-19  Segher Boessenkool  <segher@kernel.crashing.org>
60         * parser.c (cp_parser_asm_definition) <RID_CONST, RID_RESTRICT>: Give
61         a more specific error message (instead of just falling through).
63 2018-12-19  Segher Boessenkool  <segher@kernel.crashing.org>
65         * parser.c (cp_parser_asm_definition): Rewrite the loop to work without
66         "done" boolean variable.
67         * parser.c (cp_parser_asm_definition): Keep track of the location each
68         asm qualifier is first seen; use that to give nicer "duplicate asm
69         qualifier" messages.
71 2018-12-19  Segher Boessenkool  <segher@kernel.crashing.org>
73         * parser.c (cp_parser_asm_definition): Rewrite the loop to work without
74         "done" boolean variable.
76 2018-12-19  David Malcolm  <dmalcolm@redhat.com>
78         PR c++/88375
79         * typeck.c (convert_for_assignment): Capture location of rhs
80         before stripping, and if available.  Use the location when
81         complaining about bad conversions, labelling it with the
82         rhstype if the location was present.
83         * typeck2.c (digest_init_r): Capture location of init before
84         stripping.
86 2018-12-19  David Malcolm  <dmalcolm@redhat.com>
88         PR c++/87504
89         * call.c (op_error): Convert 1st param from location_t to
90         const op_location_t &.  Use binary_op_rich_location for binary
91         ops.
92         (build_conditional_expr_1): Convert 1st param from location_t to
93         const op_location_t &.
94         (build_conditional_expr): Likewise.
95         (build_new_op_1): Likewise.
96         (build_new_op): Likewise.
97         * cp-tree.h (build_conditional_expr): Likewise.
98         (build_new_op): Likewise.
99         (build_x_binary_op): Likewise.
100         (cp_build_binary_op): Likewise.
101         * parser.c (cp_parser_primary_expression): Build a location
102         for id-expression nodes.
103         (cp_parser_binary_expression): Use an op_location_t when
104         calling build_x_binary_op.
105         (cp_parser_operator): Build a location for user-defined literals.
106         * typeck.c (build_x_binary_op): Convert 1st param from location_t
107         to const op_location_t &.
108         (cp_build_binary_op): Likewise.  Use binary_op_rich_location.
110 2018-12-19  David Malcolm  <dmalcolm@redhat.com>
112         PR c++/43064
113         PR c++/43486
114         * call.c (build_conditional_expr_1): Strip location wrappers when
115         checking for CONST_DECL.
116         (conversion_null_warnings): Use location of "expr" if available.
117         * class.c (fixed_type_or_null): Handle location wrappers.
118         * constexpr.c (potential_constant_expression_1): Likewise.
119         * cvt.c (ignore_overflows): Strip location wrappers when
120         checking for INTEGER_CST, and re-wrap the result if present.
121         (ocp_convert): Call fold_for_warn before checking for INTEGER_CST.
122         * decl.c (reshape_init_r): Strip any location wrapper.
123         (undeduced_auto_decl): Likewise.
124         * expr.c (mark_discarded_use): Likewise for expr.
125         * init.c (build_aggr_init): Likewise before checking init for
126         DECL_P.
127         (warn_placement_new_too_small): Call fold_for_warn on adj before
128         checking for CONSTANT_CLASS_P, and on nelts.  Strip any location
129         wrapper from op0 and on oper before checking for VAR_P.
130         * parser.c (cp_parser_primary_expression): Call
131         maybe_add_location_wrapper on numeric and string literals.
132         (cp_parser_postfix_expression): Strip any location wrapper when
133         checking for DECL_IS_BUILTIN_CONSTANT_P.
134         (cp_parser_unary_expression): Ensure that folding of NEGATE_EXPR
135         around a constant happens in the presence of location wrappers and
136         returns a wrapped result.
137         (cp_parser_has_attribute_expression): Strip any location wrapper
138         from "oper".
139         (cp_parser_binary_expression): Strip any location wrapper when
140         checking for DECL_P on the lhs.
141         (cp_parser_decltype): Strip any location wrapper from result of
142         cp_parser_decltype_expr.
143         (cp_parser_mem_initializer): Add location wrappers to the
144         parenthesized expression list.
145         (cp_parser_template_parameter_list): Don't create wrapper nodes
146         within a template-parameter-list.
147         (cp_parser_template_argument_list): Don't create wrapper nodes
148         within a template-argument-list.
149         (cp_parser_parameter_declaration): Strip location wrappers from
150         default arguments.
151         (cp_parser_gnu_attribute_list): Don't create wrapper nodes.
152         (cp_parser_std_attribute_spec_seq): Likewise.
153         (cp_parser_omp_all_clauses): Don't create wrapper nodes within
154         OpenMP clauses.
155         (cp_parser_omp_for_loop): Likewise.
156         (cp_parser_omp_declare_reduction_exprs): Likewise.
157         * pt.c (convert_nontype_argument_function): Strip location
158         wrappers from fn_no_ptr before checking for FUNCTION_DECL.
159         (tsubst_default_argument): Move note about which callsite led to
160         instantiation to after the check_default_argument call.
161         (do_auto_deduction): Likewise from init before checking for
162         DECL_P.
163         * semantics.c (force_paren_expr): Likewise from expr before
164         checking for DECL_P.
165         (finish_parenthesized_expr): Likewise from expr before
166         checking for STRING_CST.
167         (perform_koenig_lookup): Likewise from fn.
168         (finish_call_expr): Likewise.
169         (finish_id_expression): Rename to...
170         (finish_id_expression_1): ...this, calling
171         maybe_add_location_wrapper on the result.
172         (capture_decltype): Use lookup_name_real rather than value_member
173         when looking up decl within the capture-list.
174         * tree.c (cp_stabilize_reference): Strip any location wrapper.
175         (builtin_valid_in_constant_expr_p): Likewise.
176         (strip_typedefs_expr): Strip any location wrapper before checking
177         for decls or constants.
178         (is_overloaded_fn): Likewise.
179         (maybe_get_fns): Likewise.
180         (selftest::test_lvalue_kind): Verify lvalue_p.
181         * typeck.c (cxx_sizeof_expr): Strip any location wrapper.
182         (cxx_alignof_expr): Likewise.
183         (is_bitfield_expr_with_lowered_type): Handle location wrappers.
184         (cp_build_array_ref): Call maybe_constant_value on "idx".
185         (cp_build_binary_op): Strip location wrapper from first_arg before
186         checking for PARM_DECL.  Likewise for op1 before checking for
187         INTEGER_CST in two places.  Likewise for orig_op0 and orig_op1
188         when checking for STRING_CST.
189         (cp_build_addr_expr_1): Likewise for arg when checking for
190         FUNCTION_DECL.
191         (cp_build_modify_expr): Likewise for newrhs when checking for
192         STRING_CST.
193         (convert_for_assignment): Don't strip location wrappers when
194         stripping NON_LVALUE_EXPR.
195         (maybe_warn_about_returning_address_of_local): Strip location
196         wrapper from whats_returned before checking for DECL_P.
197         (can_do_nrvo_p): Strip location wrapper from retval.
198         (treat_lvalue_as_rvalue_p): Likewise.
199         (check_return_expr): Likewise.
200         * typeck2.c (cxx_incomplete_type_diagnostic): Strip location
201         wrapper from value before checking for VAR_P or PARM_DECL.
202         (digest_init_r): Strip location wrapper from init.  When
203         copying "init", also copy the wrapped node.
205 2018-12-19  Jakub Jelinek  <jakub@redhat.com>
207         PR c++/87934
208         * constexpr.c (cxx_eval_constant_expression) <case CONSTRUCTOR>: Do
209         re-process TREE_CONSTANT CONSTRUCTORs if they aren't reduced constant
210         expressions.
212 2018-12-19  Alexandre Oliva <aoliva@redhat.com>
214         PR c++/87012
215         * pt.c (convert_template_argument): Canonicalize type after
216         tsubst/deduce.
218         PR c++/88146
219         * method.c (do_build_copy_constructor): Guard cvquals init and
220         loop over fields to run for non-inherited ctors only.
221         (synthesize_method): Retain location of inherited ctor.
223 2018-12-17  Jakub Jelinek  <jakub@redhat.com>
225         PR c++/88410
226         * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: For offsetof-like folding,
227         call maybe_constant_value on val to see if it is INTEGER_CST.
229 2018-12-17  Jonathan Wakely  <jwakely@redhat.com>
231         PR c++/52321
232         * typeck.c (build_static_cast): Print a note when the destination
233         type or the operand is a pointer/reference to incomplete class type.
235 2018-12-16  Jakub Jelinek  <jakub@redhat.com>
237         PR c++/88482
238         * except.c (verify_library_fn): New function.
239         (declare_library_fn): Use it.  Initialize TM even if the non-TM
240         library function has been user declared.
241         (do_end_catch): Don't set TREE_NOTHROW on error_mark_node.
242         (expand_start_catch_block): Don't call initialize_handler_parm
243         for error_mark_node.
244         (build_throw): Use verify_library_fn.  Initialize TM even if the
245         non-TM library function has been user declared.  Don't crash if
246         any library fn is error_mark_node.
248 2018-12-14  Jason Merrill  <jason@redhat.com>
250         * pt.c (tsubst_expr) [DECL_EXPR]: Ignore class-scope bindings when
251         looking up a capture proxy.
253 2018-12-15  Paolo Carlini  <paolo.carlini@oracle.com>
255         PR c++/84644
256         * decl.c (check_tag_decl): A decltype with no declarator
257         doesn't declare anything.
259 2018-12-14  Alexandre Oliva <aoliva@redhat.com>
261         PR c++/87814
262         * pt.c (tsubst_exception_specification): Handle
263         DEFERRED_NOEXCEPT with !defer_ok.
265 2018-12-14  Jason Merrill <jason@redhat.com>
267         PR c++/86823
268         * parser.c (cp_parser_template_id): Rearrange deferred access
269         checks into the firewall.
271 2018-12-14  Jakub Jelinek  <jakub@redhat.com>
273         PR c++/82294
274         PR c++/87436
275         * init.c (build_vec_init): Change num_initialized_elts type from int
276         to HOST_WIDE_INT.  Build a RANGE_EXPR if e needs to be repeated more
277         than once.
279 2018-12-13  Marek Polacek  <polacek@redhat.com>
281         PR c++/88216 - ICE with class type in non-type template parameter.
282         * mangle.c (write_expression): Handle TARGET_EXPR and
283         VIEW_CONVERT_EXPR.
284         * pt.c (convert_nontype_argument): Don't call
285         get_template_parm_object for value-dependent expressions.
287 2018-12-13  Nathan Sidwell  <nathan@acm.org>
289         PR c++/87531
290         * class.c (finish_struct): Set DECL_CONTEXT of template assign op.
291         * name-lookup.c (get_class_binding_direct): Don't strip using-decl
292         of overload here.
293         * parser.c (cp_parser_postfix_expression): Cope with using decl in
294         overload set.
295         * semantics.c (finish_id_expr): Likewise.
297 2018-12-12  Paolo Carlini  <paolo.carlini@oracle.com>
299         * decl.c (grokdeclarator): Fix location of error message about
300         static data member definition.
302 2018-12-12  Jakub Jelinek  <jakub@redhat.com>
304         PR c++/88446
305         * cp-tree.h (maybe_constant_value): Add manifestly_const_eval
306         argument.
307         * constexpr.c (struct constexpr_call): Rename pretend_const_required
308         member to manifestly_const_eval.
309         (struct constexpr_ctx): Likewise.
310         (constexpr_call_hasher::equal): Adjust users.
311         (cxx_eval_builtin_function_call): Likewise.  Formatting fix.
312         (cxx_eval_call_expression): Adjust users.
313         (cxx_eval_outermost_constant_expr, maybe_constant_init_1,
314         maybe_constant_init): Rename pretend_const_required argument to
315         manifestly_const_eval, adjust function comments.
316         (maybe_constant_value): Add manifestly_const_eval argument.  If true,
317         don't cache and call cxx_eval_outermost_constant_expr with true as
318         manifestly_const_eval.
319         * decl.c (compute_array_index_type_loc): Call maybe_constant_value
320         with true as manifestly_const_eval.
322         PR c++/88449
323         * constexpr.c (struct constexpr_call): Add pretend_const_required
324         member.
325         (constexpr_call_hasher::equal): Return false if pretend_const_required
326         members differ.
327         (cxx_eval_call_expression): Adjust new_call initialization.  Hash in
328         ctx->pretend_const_required.
330 2018-12-11  Jakub Jelinek  <jakub@redhat.com>
332         PR c++/87861
333         * class.c (build_vtbl_initializer): For TARGET_VTABLE_USES_DESCRIPTORS
334         bump index for each added word.
335         * constexpr.c (find_array_ctor_elt): Add forward declaration.
336         (cxx_eval_call_expression): Handle TARGET_VTABLE_USES_DESCRIPTORS
337         vtable calls.
338         (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Divide token
339         by TARGET_VTABLE_USES_DESCRIPTORS if non-zero.
341 2018-12-11  Marek Polacek  <polacek@redhat.com>
343         PR c++/86608 - reading constexpr volatile variable.
344         * constexpr.c (potential_constant_expression_1): Check want_rval
345         instead of checking if we have a decl.
346         * decl2.c (decl_maybe_constant_var_p): Don't consider volatile
347         constexpr variables as maybe constant.
349 2018-12-11  Paolo Carlini  <paolo.carlini@oracle.com>
351         * decl.c (grokvardecl): Add location_t parameter and use it
352         in build_lang_decl_loc and build_decl calls.
353         (grokdeclarator): Move up loc declaration and use it in the
354         grokvardecl call too.
356 2018-12-09  Cesar Philippidis  <cesar@codesourcery.com>
358         * parser.c (cp_parser_oacc_kernels_parallel): Adjust EXPR_LOCATION
359         on the combined acc loop.
361 2018-12-07  Paolo Carlini  <paolo.carlini@oracle.com>
363         * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in error messages
364         about bit-fields with function type, warn_if_not_aligned type, and
365         static bit-fields; avoid DECL_NAME for unnamed declarations.
367 2018-12-07  Jakub Jelinek  <jakub@redhat.com>
369         PR c++/86669
370         * call.c (make_temporary_var_for_ref_to_temp): Call pushdecl even for
371         automatic vars.
373         PR c++/87506
374         * constexpr.c (adjust_temp_type): Handle EMPTY_CLASS_EXPR.
376 2018-12-06  Paolo Carlini  <paolo.carlini@oracle.com>
378         * class.c (check_bitfield_decl): In error message about non-integral
379         type print the type itself too.
380         * decl.c (grokdeclarator): Do not ICE on unnamed bit-fields declared
381         friends; when calling build_decl for a FIELD_DECL possibly pass the
382         declarator->id_loc.
384 2018-12-06  Alexandre Oliva  <aoliva@redhat.com>
386         PR c++/86747
387         * pt.c (tsubst_friend_class): Enter tsubsted class context.
389         PR c++/86397
390         * except.c (build_noexcept_spec): Resolve nondependent
391         expressions.
393 2018-12-06  Jason Merrill  <jason@redhat.com>
395         PR c++/88136 - -Wdeprecated-copy false positives
396         * class.c (classtype_has_depr_implicit_copy): Rename from
397         classtype_has_user_copy_or_dtor.
398         * method.c (lazily_declare_fn): Adjust.
399         * decl2.c (cp_warn_deprecated_use): Refer to -Wdeprecated-copy-dtor
400         if deprecation is due to a destructor.
402 2018-12-06  Marek Polacek  <polacek@redhat.com>
404         PR c++/88373 - wrong parse error with ~.
405         * parser.c (cp_parser_template_name): Check tag_type for
406         none_type.
408 2018-12-06  Segher Boessenkool  <segher@kernel.crashing.org>
410         * cp-tree.h (finish_asm_stmt): Update declaration.
411         * parser.c (cp_parser_asm_definition): Detect the inline keyword
412         after asm.  Pass a flag for it to finish_asm_stmt.
413         * pt.c (tsubst_expr): Pass the ASM_INLINE_P flag to finish_asm_stmt.
414         * semantics.c (finish_asm_stmt): Add inline_p parameter.  Use it to
415         set ASM_INLINE_P.
417 2018-12-06  Segher Boessenkool  <segher@kernel.crashing.org>
419         PR inline-asm/55681
420         * parser.c (cp_parser_asm_definition): Update grammar.  Allow any
421         combination of volatile and goto, in any order, without repetitions.
423 2018-12-06  David Malcolm  <dmalcolm@redhat.com>
425         PR c++/85110
426         * call.c (conversion_null_warnings): Try to use the location of
427         the expression for the warnings.  Add notes showing the parameter
428         of the function decl, where available.
429         (get_fndecl_argument_location): For implicitly-declared functions,
430         use the fndecl location rather than that of the param.
431         (maybe_inform_about_fndecl_for_bogus_argument_init): New function.
432         (convert_like_real): Use it in various places to avoid repetition.
433         (complain_about_bad_argument): Likewise.
434         * cp-tree.h (maybe_inform_about_fndecl_for_bogus_argument_init):
435         New declaration.
436         * decl2.c (check_default_args): Put all diagnostics for the fndecl
437         into a diagnostic group.  Use the location of the parameter when
438         complaining about parameters with missing default arguments in
439         preference to that of the fndecl.  Attempt to record the location
440         of the first parameter with a default argument and emit a note
441         for the first parameter that's missing one.
442         * typeck.c (convert_arguments): When complaining about parameters
443         with incomplete types, attempt to use the location of the
444         argument.  Where available, add a note showing the pertinent
445         parameter in the fndecl.
446         (convert_for_assignment): When complaining about bad conversions
447         at function calls, use the location of the unstripped argument.
448         (convert_for_initialization): When checking for bogus references,
449         add an auto_diagnostic_group, and update the note to use the
450         location of the pertinent parameter, rather than just the callee.
452 2018-12-06  Paolo Carlini  <paolo.carlini@oracle.com>
454         * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in error message;
455         print the type too; fix thinko in INDIRECT_TYPE_P use.
457 2018-12-05  Alexandre Oliva  <aoliva@redhat.com>
459         PR c++/85569
460         * constexpr.c (adjust_temp_type): Test for type equality with
461         same_type_p.
462         (constexpr_call_hasher::equal): Likewise.
464 2018-12-04  Paolo Carlini  <paolo.carlini@oracle.com>
466         PR c++/84636
467         * decl.c (grokdeclarator): Avoid crashing on an anonymous bit-field
468         with function type.
470 2018-12-04  Marek Polacek  <polacek@redhat.com>
472         PR c++/88184 - ICE when treating name as template-name.
473         * pt.c (lookup_template_function): Always build the TEMPLATE_ID_EXPR
474         with unknown_type_node.
476 2018-12-04  Julian Brown  <julian@codesourcery.com>
478         * parser.c (cp_parser_oacc_wait_list): Fix error message and avoid
479         duplicate diagnostic.
481 2018-12-04  Jakub Jelinek  <jakub@redhat.com>
483         PR c++/88103
484         * typeck.c (build_class_member_access_expr): If unary_complex_lvalue
485         turned xvalue_p into non-xvalue_p, call move on it.
487 2018-12-02  Jakub Jelinek  <jakub@redhat.com>
489         PR c++/88258
490         * parser.c (cp_parser_skip_to_closing_parenthesis_1,
491         cp_parser_skip_to_end_of_statement,
492         cp_parser_skip_to_end_of_block_or_statement,
493         cp_parser_skip_to_closing_brace,
494         cp_parser_skip_to_closing_square_bracket,
495         cp_parser_skip_balanced_tokens): Don't treat CPP_PRAGMA_EOL specially
496         if in_pragma is false.
498 2018-12-01  Marek Polacek  <polacek@redhat.com>
500         Implement P0634R3, Down with typename!
501         * parser.c (CP_PARSER_FLAGS_TYPENAME_OPTIONAL): New enumerator.
502         (cp_parser_type_name): Remove declaration.
503         (cp_parser_postfix_expression): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
504         to cp_parser_type_id.
505         (cp_parser_new_type_id): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL to
506         cp_parser_type_specifier_seq.
507         (cp_parser_lambda_declarator_opt): Pass
508         CP_PARSER_FLAGS_TYPENAME_OPTIONAL to
509         cp_parser_parameter_declaration_clause.
510         (cp_parser_condition): Pass CP_PARSER_FLAGS_NONE to
511         cp_parser_declarator.
512         (cp_parser_simple_declaration): Pass CP_PARSER_FLAGS_NONE to
513         cp_parser_init_declarator.
514         (cp_parser_conversion_type_id): Pass CP_PARSER_FLAGS_NONE to
515         cp_parser_type_specifier_seq.
516         (cp_parser_default_type_template_argument): Pass
517         CP_PARSER_FLAGS_TYPENAME_OPTIONAL to cp_parser_type_id.
518         (cp_parser_template_parameter): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
519         to cp_parser_parameter_declaration.
520         (cp_parser_explicit_instantiation): Pass CP_PARSER_FLAGS_NONE to
521         cp_parser_declarator.
522         (cp_parser_simple_type_specifier): Adjust call to cp_parser_type_name
523         to relay if we should treat the typename keyword as optional.  Maybe
524         call cp_parser_make_typename_type is parsing a template-id and it's
525         not a TYPE_DECL.
526         (cp_parser_type_name): Remove unused function.
527         (cp_parser_enum_specifier): Pass to CP_PARSER_FLAGS_NONE
528         cp_parser_type_specifier_seq.
529         (cp_parser_alias_declaration): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
530         to cp_parser_type_id.
531         (cp_parser_init_declarator): New parameter.  Pass it down to
532         cp_parser_declarator.
533         (cp_parser_declarator): New parameter.  Pass CP_PARSER_FLAGS_NONE to
534         cp_parser_declarator.  Pass the new parameter to
535         cp_parser_direct_declarator.
536         (cp_parser_direct_declarator): New parameter.  Pass it to
537         cp_parser_parameter_declaration_clause and cp_parser_declarator.
538         (cp_parser_declarator_id):
539         (cp_parser_type_id_1): New parameter.  Pass it to
540         cp_parser_type_specifier_seq.  Adjust call to cp_parser_declarator.
541         (cp_parser_type_id): New parameter.  Pass it to cp_parser_type_id_1.
542         (cp_parser_template_type_arg): Pass CP_PARSER_FLAGS_NONE to
543         cp_parser_type_id_1.
544         (cp_parser_trailing_type_id): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
545         to cp_parser_type_id_1.
546         (cp_parser_type_specifier_seq): New parameter.
547         (function_being_declared_is_template_p):
548         (cp_parser_parameter_declaration_clause): New parameter.  Pass it to
549         cp_parser_parameter_declaration_list.
550         (cp_parser_parameter_declaration_list): New parameter.  Pass it to
551         cp_parser_parameter_declaration.
552         (cp_parser_parameter_declaration): New parameter.  Pass it to
553         cp_parser_decl_specifier_seq.  Pass CP_PARSER_FLAGS_NONE to
554         cp_parser_declarator.
555         (cp_parser_member_declaration): Adjust call to
556         cp_parser_decl_specifier_seq to also include
557         CP_PARSER_FLAGS_TYPENAME_OPTIONAL.  Pass
558         CP_PARSER_FLAGS_TYPENAME_OPTIONAL to cp_parser_declarator.
559         (cp_parser_exception_declaration): Pass CP_PARSER_FLAGS_NONE to
560         cp_parser_type_specifier_seq and cp_parser_declarator.
561         (cp_parser_requirement_parameter_list): Pass CP_PARSER_FLAGS_NONE to
562         cp_parser_parameter_declaration_clause.
563         (cp_parser_constructor_declarator_p): Resolve the TYPENAME_TYPE.
564         (cp_parser_single_declaration): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
565         to cp_parser_decl_specifier_seq and cp_parser_init_declarator.
566         (cp_parser_cache_defarg): Pass CP_PARSER_FLAGS_NONE to
567         cp_parser_declarator and cp_parser_parameter_declaration_list.
568         (cp_parser_objc_method_tail_params_opt): Pass CP_PARSER_FLAGS_NONE to
569         cp_parser_parameter_declaration.
570         (cp_parser_objc_class_ivars): Pass CP_PARSER_FLAGS_NONE to
571         cp_parser_declarator.
572         (cp_parser_objc_try_catch_finally_statement): Pass CP_PARSER_FLAGS_NONE
573         to cp_parser_parameter_declaration
574         (cp_parser_objc_struct_declaration): Pass CP_PARSER_FLAGS_NONE to
575         cp_parser_declarator.
576         (cp_parser_omp_for_loop_init): Pass CP_PARSER_FLAGS_NONE to
577         cp_parser_declarator and cp_parser_type_specifier_seq.
579 2018-11-30  David Malcolm  <dmalcolm@redhat.com>
581         * typeck2.c: Include "gcc-rich-location.h".
582         (cxx_incomplete_type_diagnostic): When complaining about possibly
583         missing parens, add a fix-it hint if the member function takes no
584         additional params.
586 2018-11-30  James Norris  <jnorris@codesourcery.com>
588         * parser.c (cp_parser_oacc_enter_exit_data): Use existing local
589         variable.
591 2018-11-29  Paolo Carlini  <paolo.carlini@oracle.com>
593         * decl.c (compute_array_index_type_loc): New, like the current
594         compute_array_index_type but takes a location_t too.
595         (compute_array_index_type): Forward to the latter.
596         (create_array_type_for_decl): Use compute_array_index_type_loc.
598 2018-11-29  David Malcolm  <dmalcolm@redhat.com>
600         PR c++/88121
601         * cp-name-hint.h (suggest_alternative_in_scoped_enum): New decl.
602         * error.c (dump_scope): Ensure that we print any scope for values
603         of unscoped enums.  Print the scope of values of scoped enums.
604         (qualified_name_lookup_error): Offer suggestions for failures
605         within scoped enums by calling suggest_alternative_in_scoped_enum.
606         * name-lookup.c (class namespace_hints): Update comment to mention
607         scoped enums.
608         (namespace_hints::namespace_hints): Call
609         maybe_add_candidate_for_scoped_enum.
610         (namespace_hints::maybe_add_candidate_for_scoped_enum): New member
611         (suggest_alternatives_for): Update comment to mention scoped
612         enums.
613         (suggest_alternative_in_scoped_enum): New function.
615 2018-11-28  Marek Polacek  <polacek@redhat.com>
617         Implement P1094R2, Nested inline namespaces.
618         * parser.c (cp_parser_namespace_definition): Parse the optional inline
619         keyword in a nested-namespace-definition.  Adjust push_namespace call.
620         Formatting fix.
622 2018-11-28  Nathan Sidwell  <nathan@acm.org>
624         PR c++/87531
625         * class.c (finish_struct): In a template, add artificial using
626         decl for operator=.
628 2018-11-28  Jan Hubicka  <hubicka@ucw.cz>
630         * except.c (do_allocate_exception): Annotate __cxa_allocate_exception
631         as COLD.
633 2018-11-28  Marek Polacek  <polacek@redhat.com>
635         PR c++/88222 - ICE with bit-field with invalid type.
636         * decl.c (grokdeclarator): Check if declarator is null.
638 2018-11-28  Jakub Jelinek  <jakub@redhat.com>
640         PR c++/87476
641         * typeck2.c (digest_init_r): Re-add handing of signed/unsigned char
642         strings and add it to the initialization of wide array from non-wide
643         string diagnostics too.
645 2018-11-27  Jakub Jelinek  <jakub@redhat.com>
647         PR c++/88187
648         * decl.c (grokdeclarator): Don't diagnose deduction guide errors
649         if !funcdecl_p.
651         PR c++/88181
652         * class.c (fixup_attribute_variants): Also propagate TYPE_PACKED
653         to variants.
655 2018-11-26  Marek Polacek  <polacek@redhat.com>
657         PR c++/88120 - ICE when calling save_expr in a template.
658         * typeck.c (cp_build_binary_op): Call cp_save_expr instead of
659         save_expr.
661 2018-11-22  Jakub Jelinek  <jakub@redhat.com>
663         PR c++/87386
664         * parser.c (cp_parser_operator): Use str.get_value () instead of just
665         str in USERDEF_LITERAL_VALUE and USERDEF_LITERAL_SUFFIX_ID arguments.
667 2018-11-21  Jakub Jelinek  <jakub@redhat.com>
669         PR c++/88122
670         * method.c (maybe_explain_implicit_delete): If
671         FUNCTION_FIRST_USER_PARMTYPE (decl) is NULL, set const_p to false
672         instead of ICEing.
674         PR c++/87386
675         * parser.c (cp_parser_primary_expression): Use
676         id_expression.get_location () instead of id_expr_token->location.
677         Adjust the range from id_expr_token->location to
678         id_expressio.get_finish ().
679         (cp_parser_operator_function_id): Pass location of the operator
680         token down to cp_parser_operator.
681         (cp_parser_operator): Add start_loc argument, always construct a
682         location with caret at start_loc and range from start_loc to the
683         finish of the last token.
685         PR c++/87393
686         * parser.c (cp_parser_linkage_specification): Remove useless
687         dereference of the consume_open method result.
689 2018-11-20  Martin Sebor  <msebor@redhat.com>
691         * cp-tree.h (cp_check_const_attributes): Declare.
692         * decl2.c (cp_check_const_attributes): Declare extern.
693         * parser.c (cp_parser_has_attribute_expression): New function.
694         (cp_parser_unary_expression): Handle RID_HAS_ATTRIBUTE_EXPRESSION.
695         (cp_parser_gnu_attribute_list): Add argument.
697 2018-11-20  Jakub Jelinek  <jakub@redhat.com>
699         PR c++/88110
700         * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Punt
701         if get_base_address of ADDR_EXPR operand is not a DECL_P.
703 2018-11-19  Marek Polacek  <polacek@redhat.com>
705         PR c++/87781 - detect invalid elaborated-type-specifier.
706         * parser.c (cp_parser_elaborated_type_specifier): Ensure that
707         typename follows a nested-name-specifier.
709 2018-11-18  Paolo Carlini  <paolo.carlini@oracle.com>
711         * decl2.c (grokfield): Remove obsolete _vptr check; fix
712         explicit template argument list error location.
714 2018-11-16  Kamlesh Kumar  <kamleshbhalui@gmail.com>
716         DR 1207
717         PR c++/52869
718         * parser.c (cp_parser_noexcept_specification_opt): Call
719         inject_this_parameter.
721 2018-11-16  Jason Merrill  <jason@redhat.com>
723         Implement P0479R5, [[likely]] and [[unlikely]].
724         * tree.c (handle_likeliness_attribute): New.
725         (std_attribute_table): Add likely/unlikely.
726         * cp-gimplify.c (lookup_hotness_attribute, remove_hotness_attribute)
727         (process_stmt_hotness_attribute, first_stmt): New.
728         (genericize_if_stmt): Check for duplicate predictions.
729         * parser.c (cp_parser_statement): Call
730         process_stmt_hotness_attribute.
731         (cp_parser_label_for_labeled_statement): Apply attributes to case.
732         * decl.c (finish_case_label): Give label in template type void.
733         * pt.c (tsubst_expr) [CASE_LABEL_EXPR]: Copy attributes.
734         [PREDICT_EXPR]: Handle.
736 2018-11-16  Nathan Sidwell  <nathan@acm.org>
738         Remove ovl_used, it is no longer needed
739         * cp-tree.h (OVL_USED_P): Delete.
740         (lookup_keep): Delete.
741         * friend.c (add_friend): Don't call it.
742         * parser.c (lookup_literal_operator): Likewise.
743         (cp_parser_primary_expression): Likewise.
744         * semantics.c (perform_koenig_lookup): Likewise.
745         * pt.c (tsubst_copy <OVERLOAD>): Don't assert OVL_USED_P.
746         * tree.c (ovl_copy): Delete.
747         (ovl_insert): Remove OVL_USED_P checks.
748         (ovl_iterator::reveal_node): Likewise.
749         (ovl_iterator::remove__node): Likewise.
750         (ovl_used, lookup_keep): Delete.
752         PR c++/87269
753         * parser.c (lookup_literal_operator): Mark overload for keeping
754         when inside template.  Refactor.
756 2018-11-15  Nathan Sidwell  <nathan@acm.org>
758         PR c++/86246
759         PR c++/87989
760         * typeck.c (finish_class_member_access_expr): Conversion operator
761         to dependent type is dependent.
763 2018-11-15  Paolo Carlini  <paolo.carlini@oracle.com>
765         * constexpr.c (ensure_literal_type_for_constexpr_object): Use
766         DECL_SOURCE_LOCATION in error_at calls.
768 2018-11-15  Nathan Sidwell  <nathan@acm.org>
770         DR 2336
771         * cp-tree.h (enum special_function_kind): Add sfk_virtual_destructor.
772         * method.c (type_has_trivial_fn): Add it.
773         (SFK_DTOR_P): Likewise.
774         (synthesized_method_base_walk): Don't check access of vbases of
775         abstract classes when sfk_virtual_destructor.
776         (synthesized_method_walk): Skip vbases of abstract classes except
777         when sfk_virtual_destructor.
778         (get_defaulted_eh_spec): Set sfk_virtual_destructor as needed.
780         * cp-tree.h (enum special_function_kind): Reorder and comment.
781         * method.c (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P)
782         (SFK_MOVE_P): New predicates.
783         (walk_field_subobs, synthesized_method_base_walk): Drop
784         copy_arg_p, move_p, assign_p args.  Use new SFK predicates.  Order
785         parameters consistently.
786         (synthesized_method_walk): Drop ctor_p, copy_arg_p, move_p,
787         assign_p calculations.  Use new SFK predicates.  Adjust calls to
788         worker functions.
790 2018-11-14  Paolo Carlini  <paolo.carlini@oracle.com>
792         * parser.c (make_id_declarator): Add location_t parameter.
793         (cp_parser_lambda_declarator_opt): Adjust call.
794         (cp_parser_decomposition_declaration): Likewise.
795         (cp_parser_alias_declaration): Likewise.
796         (cp_parser_direct_declarator): Likewise.
797         (cp_parser_member_declaration): Likewise.
798         (cp_parser_objc_class_ivars): Likewise.
799         * decl.c (grokdeclarator): Use declarator->id_loc in two error
800         messages.
802 2018-11-14  Jakub Jelinek  <jakub@redhat.com>
804         P1236R1 - Signed integers are two's complement
805         * constexpr.c (cxx_eval_check_shift_p): Disable the signed LSHIFT_EXPR
806         checks for c++2a.
808 2018-11-13  David Malcolm  <dmalcolm@redhat.com>
810         * call.c: Replace "source_location" with "location_t".
811         * cp-tree.h: Likewise.
812         * cvt.c: Likewise.
813         * name-lookup.c: Likewise.
814         * parser.c: Likewise.
815         * typeck.c: Likewise.
817 2018-11-12  Jason Merrill  <jason@redhat.com>
819         Implement P0315R4, Lambdas in unevaluated contexts.
820         * decl2.c (min_vis_expr_r): Handle LAMBDA_EXPR.
821         * mangle.c (write_expression): Handle LAMBDA_EXPR.
822         * parser.c (cp_parser_lambda_expression): Allow lambdas in
823         unevaluated context.  Start the tentative firewall sooner.
824         (cp_parser_lambda_body): Use cp_evaluated.
825         * pt.c (iterative_hash_template_arg): Handle LAMBDA_EXPR.
826         (tsubst_function_decl): Substitute a lambda even if it isn't
827         dependent.
828         (tsubst_lambda_expr): Use cp_evaluated.  Always complain.
829         (tsubst_copy_and_build) [LAMBDA_EXPR]: Do nothing if tf_partial.
830         * semantics.c (begin_class_definition): Allow in template parm list.
831         * tree.c (strip_typedefs_expr): Pass through LAMBDA_EXPR.
832         (cp_tree_equal): Handle LAMBDA_EXPR.
834         * pt.c (fn_type_unification): If we have a full set of explicit
835         arguments, go straight to substitution.
837         * decl2.c (min_vis_expr_r, expr_visibility): New.
838         (min_vis_r): Call expr_visibility.
839         (constrain_visibility_for_template): Likewise.
841         Implement P0722R3, destroying operator delete.
842         * call.c (std_destroying_delete_t_p, destroying_delete_p): New.
843         (aligned_deallocation_fn_p, usual_deallocation_fn_p): Use
844         destroying_delete_p.
845         (build_op_delete_call): Handle destroying delete.
846         * decl2.c (coerce_delete_type): Handle destroying delete.
847         * init.c (build_delete): Don't call dtor with destroying delete.
848         * optimize.c (build_delete_destructor_body): Likewise.
850         Implement P0780R2, pack expansion in lambda init-capture.
851         * parser.c (cp_parser_lambda_introducer): Parse pack init-capture.
852         * pt.c (tsubst_pack_expansion): Handle init-capture packs.
853         (lookup_init_capture_pack): New.
854         (tsubst_expr) [DECL_EXPR]: Use it.
855         (tsubst_lambda_expr): Remember field pack expansions for
856         init-captures.
858         * cp-tree.h (struct cp_evaluated): New.
859         * init.c (get_nsdmi): Use it.
860         * parser.c (cp_parser_enclosed_template_argument_list): Use it.
861         * pt.c (coerce_template_parms, tsubst_aggr_type): Use it.
863 2018-11-09  Jakub Jelinek  <jakub@redhat.com>
865         * parser.c (cp_parser_omp_clause_final, cp_parser_omp_clause_if): Use
866         cp_parser_assignment_expression instead of cp_parser_condition.
867         (cp_parser_omp_clause_num_threads, cp_parser_omp_clause_num_tasks,
868         cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority,
869         cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit,
870         cp_parser_omp_clause_linear, cp_parser_omp_clause_device): Use
871         cp_parser_assignment_expression instead of cp_parser_expression.
872         (cp_parser_omp_clause_hint): Likewise.  Formatting fix.
874         * parser.c (cp_parser_omp_clause_reduction): Call sorry_at on
875         reduction clause with inscan modifier.
877         * parser.c (cp_parser_omp_requires): Call sorry_at on requires
878         clauses other than atomic_default_mem_order.
880 2018-11-09  Martin Sebor  <msebor@redhat.com>
882         PR middle-end/81824
883         * pt.c (warn_spec_missing_attributes): Move code to attribs.c.
884         Call decls_mismatched_attributes.
886 2018-11-08  Jakub Jelinek  <jakub@redhat.com>
888         * constexpr.c (potential_constant_expression_1): Handle OMP_DEPOBJ.
889         * cp-gimplify.c (cp_genericize_r): Handle
890         OMP_CLAUSE_{IN,TASK}_REDUCTION.
891         (cxx_omp_predetermined_sharing_1): Don't return
892         OMP_CLAUSE_DEFAULT_SHARED for const qualified decls with no mutable
893         member.  Return OMP_CLAUSE_DEFAULT_FIRSTPRIVATE for this pointer.
894         * cp-objcp-common.c (cp_common_init_ts): Handle OMP_DEPOBJ.
895         * cp-tree.def (OMP_DEPOBJ): New tree code.
896         * cp-tree.h (OMP_ATOMIC_DEPENDENT_P): Return true also for first
897         argument being OMP_CLAUSE.
898         (OMP_DEPOBJ_DEPOBJ, OMP_DEPOBJ_CLAUSES): Define.
899         (cp_convert_omp_range_for, cp_finish_omp_range_for): Declare.
900         (finish_omp_atomic): Add LOC, CLAUSES and MO arguments.  Remove
901         SEQ_CST argument.
902         (finish_omp_for_block): Declare.
903         (finish_omp_flush): Add MO argument.
904         (finish_omp_depobj): Declare.
905         * cxx-pretty-print.c (cxx_pretty_printer::statement): Handle
906         OMP_DEPOBJ.
907         * dump.c (cp_dump_tree): Likewise.
908         * lex.c (cxx_init): Likewise.
909         * parser.c: Include memmodel.h.
910         (cp_parser_for): Pass false as new is_omp argument to
911         cp_parser_range_for.
912         (cp_parser_range_for): Add IS_OMP argument, return before finalizing
913         if it is true.
914         (cp_parser_omp_clause_name): Handle nontemporal, in_reduction and
915         task_reduction clauses.
916         (cp_parser_omp_var_list_no_open): Handle
917         OMP_CLAUSE_{IN,TASK}_REDUCTION.  For OMP_CLAUSE_DEPEND, parse clause
918         operands as either an array section, or lvalue assignment expression.
919         (cp_parser_omp_clause_if): Handle cancel and simd modifiers.
920         (cp_parser_omp_clause_defaultmap): Parse new kinds of defaultmap
921         clause.
922         (cp_parser_omp_clause_reduction): Add IS_OMP and KIND arguments.
923         Parse reduction modifiers.  Pass KIND to c_parser_omp_variable_list.
924         (cp_parser_omp_clause_lastprivate, cp_parser_omp_iterators): New
925         functions.
926         (cp_parser_omp_clause_depend): Parse iterator modifier and handle
927         iterators.  Parse mutexinoutset and depobj kinds.
928         (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_reduction
929         callers.
930         (cp_parser_omp_all_clauses): Likewise.  Handle
931         PRAGMA_OMP_CLAUSE_NONTEMPORAL and
932         PRAGMA_OMP_CLAUSE_{IN,TASK}_REDUCTION.  Call
933         cp_parser_omp_clause_lastprivate for OpenMP lastprivate clause.
934         (cp_parser_omp_atomic): Pass pragma_tok->location as
935         LOC to finish_omp_atomic.  Parse hint and memory order clauses.
936         Handle default memory order from requires directive if any.  Adjust
937         finish_omp_atomic caller.
938         (cp_parser_omp_critical): Allow comma in between (name) and hint
939         clause.
940         (cp_parser_omp_depobj): New function.
941         (cp_parser_omp_flush): Parse flush with memory-order-clause.
942         (cp_parser_omp_for_cond): Allow NE_EXPR even in OpenMP loops.
943         (cp_convert_omp_range_for, cp_finish_omp_range_for): New functions.
944         (cp_parser_omp_for_loop): Parse C++11 range for loops among omp
945         loops.  Handle OMP_CLAUSE_IN_REDUCTION like OMP_CLAUSE_REDUCTION.
946         (OMP_SIMD_CLAUSE_MASK): Add if and nontemporal clauses.
947         (cp_parser_omp_simd, cp_parser_omp_for): Call keep_next_level before
948         begin_omp_structured_block and call finish_omp_for_block on
949         finish_omp_structured_block result.
950         (cp_parser_omp_master): Add p_name, mask and cclauses arguments.
951         Allow to be called while parsing combined parallel master.
952         Parse combined master taskloop{, simd}.
953         (cp_parser_omp_parallel): Parse combined
954         parallel master{, taskloop{, simd}} constructs.
955         (cp_parser_omp_single): Use SET_EXPR_LOCATION.
956         (OMP_TASK_CLAUSE_MASK): Add in_reduction clause.
957         (OMP_TASKWAIT_CLAUSE_MASK): Define.
958         (cp_parser_omp_taskwait): Handle taskwait with depend clauses.
959         (OMP_TASKGROUP_CLAUSE_MASK): Define.
960         (cp_parser_omp_taskgroup): Parse taskgroup clauses, adjust
961         c_finish_omp_taskgroup caller.
962         (cp_parser_omp_distribute): Call keep_next_level before
963         begin_omp_structured_block and call finish_omp_for_block on
964         finish_omp_structured_block result.
965         (cp_parser_omp_teams): Force a BIND_EXPR with BLOCK around teams
966         body.
967         (cp_parser_omp_target_data): Allow target data with only
968         use_device_ptr clauses.
969         (cp_parser_omp_target): Set OMP_REQUIRES_TARGET_USED bit in
970         omp_requires_mask.
971         (cp_parser_omp_requires): New function.
972         (OMP_TASKLOOP_CLAUSE_MASK): Add reduction and in_reduction clauses.
973         (cp_parser_omp_taskloop): Add forward declaration.  Disallow
974         in_reduction clause when combined with parallel master.  Call
975         keep_next_level before begin_omp_structured_block and call
976         finish_omp_for_block on finish_omp_structured_block result.
977         (cp_parser_omp_construct): Adjust cp_parser_omp_master caller.
978         (cp_parser_pragma): Handle PRAGMA_OMP_DEPOBJ and PRAGMA_OMP_REQUIRES.
979         * pt.c (tsubst_omp_clause_decl): Add iterators_cache argument.
980         Adjust recursive calls.  Handle iterators.
981         (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION and
982         OMP_CLAUSE_NONTEMPORAL.  Adjust tsubst_omp_clause_decl callers.
983         (tsubst_decomp_names):
984         (tsubst_omp_for_iterator): Change orig_declv into a reference.
985         Handle range for loops.  Move orig_declv handling after declv/initv
986         handling.
987         (tsubst_expr): Force a BIND_EXPR with BLOCK around teams body.
988         Adjust finish_omp_atomic caller.  Call keep_next_level before
989         begin_omp_structured_block.  Call cp_finish_omp_range_for for range
990         for loops and use {begin,finish}_omp_structured_block instead of
991         {push,pop}_stmt_list if there are any range for loops.  Call
992         finish_omp_for_block on finish_omp_structured_block result.
993         Handle OMP_DEPOBJ.  Handle taskwait with depend clauses.  For
994         OMP_ATOMIC call tsubst_omp_clauses on clauses if any, adjust
995         finish_omp_atomic caller.  Use OMP_ATOMIC_MEMORY_ORDER rather
996         than OMP_ATOMIC_SEQ_CST.  Handle clauses on OMP_TASKGROUP.
997         (dependent_omp_for_p): Always return true for range for loops if
998         processing_template_decl.  Return true if class type iterator
999         does not have INTEGER_CST increment.
1000         * semantics.c: Include memmodel.h.
1001         (handle_omp_array_sections_1): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION
1002         like OMP_CLAUSE_REDUCTION.
1003         (handle_omp_array_sections): Likewise.  Call save_expr on array
1004         reductions before calling build_index_type.  Handle depend clauses
1005         with iterators.
1006         (finish_omp_reduction_clause): Call save_expr for whole array
1007         reduction sizes.  Don't mark OMP_CLAUSE_DECL addressable if it has
1008         reference type.  Do mark decl_placeholder addressable if needed.
1009         Use error_at with OMP_CLAUSE_LOCATION (c) as first argument instead
1010         of error.
1011         (cp_omp_finish_iterators): New function.
1012         (finish_omp_clauses): Don't diagnose nonmonotonic clause with static,
1013         runtime or auto schedule kinds.  Diagnose nogroup clause used with
1014         reduction clause(s).  Handle depend clause with
1015         OMP_CLAUSE_DEPEND_DEPOBJ.  Diagnose bit-fields.  Require
1016         omp_depend_t type for OMP_CLAUSE_DEPEND_DEPOBJ kinds and
1017         some different type for other kinds.  Use cp_build_addr_expr
1018         and cp_build_indirect_ref instead of cxx_mark_addressable.
1019         Handle depend clauses with iterators.  Only handle static data members
1020         in the special case that const qualified vars may be specified in
1021         firstprivate clause.  Complain if const qualified vars without mutable
1022         members are mentioned in data-sharing clauses other than firstprivate
1023         or shared.  Use error_at with OMP_CLAUSE_LOCATION (c) as first
1024         argument instead of error.  Diagnose more than one nontemporal clause
1025         refering to the same variable.  Use error_at rather than error for
1026         priority and hint clause diagnostics.  Fix pasto for hint clause.
1027         Diagnose hint expression that doesn't fold into INTEGER_CST.
1028         Diagnose if clause with modifier other than cancel.  Handle
1029         OMP_CLAUSE_{IN,TASK}_REDUCTION like OMP_CLAUSE_REDUCTION.  Allow any
1030         lvalue as OMP_CLAUSE_DEPEND operand (besides array section), adjust
1031         diagnostics.
1032         (handle_omp_for_class_iterator): Don't create a new TREE_LIST if one
1033         has been created already for range for, just fill TREE_PURPOSE and
1034         TREE_VALUE.  Call cp_fully_fold on incr.
1035         (finish_omp_for): Don't check cond/incr if cond is global_namespace.
1036         Pass to c_omp_check_loop_iv_exprs orig_declv if non-NULL.  Don't
1037         use IS_EMPTY_STMT on NULL pre_body.  Adjust c_finish_omp_for caller.
1038         (finish_omp_for_block): New function.
1039         (finish_omp_atomic): Add LOC argument, pass it through
1040         to c_finish_omp_atomic and set it as location of OMP_ATOMIC* trees.
1041         Remove SEQ_CST argument.  Add CLAUSES and MO arguments.  Adjust
1042         c_finish_omp_atomic caller.  Stick clauses if any into first argument
1043         of wrapping OMP_ATOMIC.
1044         (finish_omp_depobj): New function.
1045         (finish_omp_flush): Add MO argument, if not
1046         MEMMODEL_LAST, emit __atomic_thread_fence call with the given value.
1047         (finish_omp_cancel): Diagnose if clause with modifier other than
1048         cancel.
1050 2018-11-07  Nathan Sidwell  <nathan@acm.org>
1052         PR c++/87904
1053         * cp-tree.h (struct tree_overload): Fix comment.
1054         * tree.c (ovl_iterator::reveal_node): Propagate OVL_DEDUP_P.
1056 2018-11-04  Jason Merrill  <jason@redhat.com>
1058         Implement UDL changes from P0732R2.
1059         * cp-tree.h (struct releasing_vec): Move from mangle.c.
1060         Add get_ref method.
1061         * parser.c (cp_parser_userdef_string_literal): Use it.  Handle
1062         passing the string to a single template parameter of class type.
1063         (cp_parser_template_declaration_after_parameters): Allow it.
1064         Pedwarn about the character pack template that was proposed but not
1065         accepted for C++14, and don't suggest it.
1067         Implement P0732R2, class types in non-type template parameters.
1068         * error.c (dump_simple_decl): Look through a template parm object.
1069         * mangle.c (write_template_arg): Likewise.
1070         (mangle_template_parm_object): New.
1071         * pt.c (template_parm_object_p, get_template_parm_object): New.
1072         (invalid_tparm_referent_p): Factor from convert_nontype_argument.
1073         (convert_nontype_argument, invalid_nontype_parm_type_p): Handle
1074         class-type template arguments.
1075         * tree.c (lvalue_kind): Likewise.
1077         * cvt.c (ocp_convert): Don't wrap a CONSTRUCTOR in a NOP_EXPR.
1078         * constexpr.c (initialized_type): Fix AGGR_INIT_EXPR handling.
1079         (cxx_eval_vec_init_1): Correct type of AGGR_INIT_EXPR.
1080         (cxx_eval_outermost_constant_expr): Make sure a CONSTRUCTOR has the
1081         right type.  Don't wrap a CONSTRUCTOR if one was passed in.
1082         * tree.c (build_aggr_init_expr): Check for void.
1084         PR c++/60503 - wrong lambda attribute syntax.
1085         * parser.c (cp_parser_lambda_declarator_opt): Fix attribute
1086         handling.
1088 2018-11-02  Nathan Sidwell  <nathan@acm.org>
1090         * decl.c (duplicate_decls): Refactor checks.
1092 2018-11-01  Marek Polacek  <polacek@redhat.com>
1094         Implement P0846R0, ADL and function templates.
1095         * decl.c (grokfndecl): Allow FUNCTION_DECL in assert.
1096         * lex.c (unqualified_fn_lookup_error): Handle TEMPLATE_ID_EXPR.
1097         * parser.c (cp_parser_postfix_expression): Do ADL for a template-name.
1098         (cp_parser_template_id): Give errors if parsing the template argument
1099         list didn't go well.  Allow FUNCTION_DECL in assert.
1100         (cp_parser_template_name): Consider a name to refer to a template if
1101         it is an unqualified-id followed by a <.  Don't return the identifier
1102         if the decl is a function and dependent.
1103         * pt.c (tsubst_copy) <case OVERLOAD>: Remove assert.
1105 2018-11-01  Nathan Sidwell  <nathan@acm.org>
1107         * cp-tree.h (struct lang_function): Delete x_local_names field.
1108         (struct lang_decl_base): Rename u2sel to spare.
1109         (struct lang_decl_min): Remove lang_decl_u2 union.  Keep access
1110         field.
1111         (LANG_DECL_U2_CHECK): Delete.
1112         (DECL_DISCRIMINATOR_P): Require function scope.
1113         (DECL_DISCRIMINATOR): Adjust.
1114         (DECL_DISCRIMINATOR_SET_P): Delete.
1115         (DECL_CAPTURED_VARIABLE, DECL_ACCESS, THUnK_VIRTUAL_OFFSET): Adjust.
1116         (local_classes): Don't declare.
1117         (determine_local_discriminator): Declare.
1118         * decl.c (push_local_name): Delete.
1119         (local_entities, determina_local_discrminator): New.
1120         (duplicate_decls): Copy DECL_ACCESS. Fix formatting.
1121         (cp_finish_decl): Use determine_local_discriminator.
1122         (save_function_data): Drop x_local_names.
1123         (finish_function): Drop local_names.
1124         * decl2.c (finish_anon_union): Use determine_local_disciminator.
1125         * mangle.c (write_unnamed_type_name): Use
1126         discriminator_for_local_entity.
1127         (local_class_index): Delete.
1128         (discriminator_for_local_entity): Reimplement.
1129         (write_local_name): Adjust discriminator code.
1130         * name-lookup.c (do_pushtag): Call determine_local_discrimiator.
1131         * semantics.c (finish_omp_threadprivate): Drop DECL_DISCRIMINATOR
1132         handling.
1133         * class.c (local_classes): Delete.
1134         (init_class_processing): Don't init it.
1136 2018-11-01  Martin Liska  <mliska@suse.cz>
1137             Jason Merrill  <jason@redhat.com>
1139         PR c++/64266
1140         PR bootstrap/70422
1141         PR ipa/81277
1142         * cp-tree.h (DECL_FNAME_P): New macro.
1143         * decl.c (cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P,
1144         DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
1145         (cp_finish_decl):
1146         * lambda.c (is_capture_proxy): Use DECL_FNAME_P.
1147         * pt.c (tsubst_expr): Handle DECL_PRETTY_FUNCTION_P.
1149 2018-10-31  Nathan Sidwell  <nathan@acm.org>
1151         * cp-tree.h (OVL_DEDUP_P): New.
1152         * name-lookup.c (name_lookup::add_overload): Check OVL_DEDUP_P.
1153         (get_class_binding_direct): Likwise.
1154         * tree.c (ovl_make): Propagate OVL_DEDUP_P.
1155         (ovl_copy): Copy it.
1156         (ovl_insert): Do not keep using-decls ordered.
1157         (lookup_maybe_add): Adjust comment.
1159 2018-10-30  Marek Polacek  <polacek@redhat.com>
1161         Implement P0892R2, explicit(bool).
1162         * call.c (add_template_candidate_real): Return if the declaration is
1163         explicit and we're only looking for non-converting constructor.
1164         * cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit.
1165         (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro.
1166         (cp_decl_specifier_seq): Add explicit_specifier field.
1167         (build_explicit_specifier, store_explicit_specifier): Declare.
1168         * decl.c (grokdeclarator): Call store_explicit_specifier.
1169         (build_explicit_specifier): New function.
1170         * parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>:
1171         Parse C++20 explicit(bool).
1172         * pt.c (store_explicit_specifier, lookup_explicit_specifier): New.
1173         (tsubst_function_decl): Handle explicit(dependent-expr).
1175 2018-10-30  Paolo Carlini  <paolo.carlini@oracle.com>
1177         * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
1178         about flexible array members.
1180 2018-10-29  David Malcolm  <dmalcolm@redhat.com>
1182         * cp-name-hint.h: New file.
1183         * cp-tree.h (expr_to_string): New decl.
1184         (suggest_alternatives_for): Move to cp-name-hint.h, changing
1185         return type from bool to name_hint.
1186         (suggest_alternative_in_explicit_scope): Likewise.
1187         * error.c: Define INCLUDE_UNIQUE_PTR.  Include "cp-name-hint.h".
1188         (expr_to_string): Make non-static.
1189         (qualified_name_lookup_error): For the non-"::" case, take
1190         responsibity for issuing any suggestion from
1191         suggest_alternative_in_explicit_scope, as it changes from
1192         returning a bool to returning a name_hint.  Replace fallback call
1193         to suggest_alternatives_for to a call to
1194         suggest_alternatives_in_other_namespaces, capturing the fact that
1195         we don't have enough location information to issue a fix-it hint
1196         for this case.  Update the error to support emitting a fix-it hint
1197         where appropriate.  For the "::" case, take responsibility for
1198         issuing any suggestion from suggest_alternatives_for, supporting
1199         emitting a fix-it hint.
1200         * lex.c: Define INCLUDE_UNIQUE_PTR.  Include "gcc-rich-location.h"
1201         and "cp-name-hint.h".
1202         (unqualified_name_lookup_error): Take responsibility for issuing
1203         any suggestion from suggest_alternatives_for, supporting emitting
1204         a fix-it hint.
1205         * name-lookup.c (class namespace_limit_reached): New subclass of
1206         deferred_diagnostic.
1207         (class show_candidate_location): Likewise.
1208         (class suggest_alternatives): Likewise.
1209         (class namespace_hints): New class.
1210         (suggest_alternatives_for): Convert return type from bool to
1211         name_hint, replacing all direct diagnostic emission by setting
1212         suggestions on the return value, or creating deferred diagnostics.
1213         Specifically, split out initial traversal of namespaces into
1214         namespace_hints' ctor, and maybe_decorate_with_limit, and move the
1215         rest of the implementation to
1216         namespace_hints::convert_candidates_to_name_hint and
1217         suggest_alternatives_for_1.
1218         (namespace_hints::namespace_hints): New ctor, adapted from
1219         suggest_alternatives_for's initial namespace traversal, storing
1220         location and name, and converting locals "candidates", "limited"
1221         and "limit" into members.
1222         (namespace_hints::convert_candidates_to_name_hint): New member
1223         function.
1224         (namespace_hints::maybe_decorate_with_limit): New member function.
1225         (suggest_alternatives_for_1): New function, based on second half
1226         of old implementation of suggest_alternatives_for, converting from
1227         immediate emission of suggestions to using name_hint.
1228         (suggest_alternatives_in_other_namespaces): New function.
1229         (maybe_suggest_missing_std_header): Convert from immediate
1230         emission of suggestions to using name_hint, moving emission
1231         implementation to...
1232         (class missing_std_header): New subclass of deferred_diagnostic.
1233         (maybe_suggest_missing_header): Convert return type from bool to
1234         name_hint.
1235         (suggest_alternative_in_explicit_scope): Convert from immediate
1236         emission of suggestions to using name_hint.
1237         * parser.c: Replace include of "c-family/name-hint.h" with
1238         "cp-name-hint.h".
1239         (cp_parser_diagnose_invalid_type_name): Update
1240         "is there a suggestion" logic for change to
1241         name_hint::operator bool.  Take responsibility for emitting
1242         fix-it hints from suggest_alternative_in_explicit_scope.
1243         (cp_parser_namespace_name): Take responsibility for emitting
1244         fix-it hints from suggest_alternative_in_explicit_scope.  Don't
1245         emit the "expected namespace-name" error if we've already emitted
1246         an "is not a namespace-name" error.
1248 2018-10-29  David Malcolm  <dmalcolm@redhat.com>
1250         PR c++/56856
1251         * call.c (build_over_call): Eliminate the "arglocs" array, and the
1252         call to maybe_constant_value when building "fargs".
1254 2018-10-29  Paolo Carlini  <paolo.carlini@oracle.com>
1256         * decl.c (create_array_type_for_decl): Add location_t parameter
1257         and use it.
1258         (grokdeclarator): Adjust call.
1260 2018-10-29  Marek Polacek  <polacek@redhat.com>
1262         PR c++/87594 - constexpr rejects-valid with range-based for.
1263         * constexpr.c (potential_constant_expression_1): If the condition
1264         can't be evaluated, return true.
1266 2018-10-29  Joseph Myers  <joseph@codesourcery.com>
1267             Julian Brown  <julian@codesourcery.com>
1269         PR c++/66053
1270         * semantics.c (handle_omp_array_sections_1): Allow array
1271         sections with "this" pointer for OpenACC.
1273 2018-10-25  Jason Merrill  <jason@redhat.com>
1275         * parser.c (cp_parser_sizeof_operand): Remove redundant use of
1276         grokdeclarator.
1278 2018-10-24  Jakub Jelinek  <jakub@redhat.com>
1280         PR c++/86288
1281         * parser.c (cp_parser_std_attribute): Canonicalize attr_ns, and when
1282         :: is not present and attr_ns non-NULL, canonicalize also attr_id.
1283         (cp_parser_attribute_spec): Fix comment typo.
1285 2018-10-24  Martin Sebor  <msebor@redhat.com>
1287         PR c++/84851
1288         * call.c (maybe_warn_class_memaccess): Tighten up.
1290 2018-10-17  David Malcolm  <dmalcolm@redhat.com>
1292         * Make-lang.in (selftest-c++): New.
1293         (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
1294         (selftest-c++-gdb, selftest-c++-valgrind): Move here from
1295         gcc/Makefile.in.
1297 2018-10-17  Paolo Carlini  <paolo.carlini@oracle.com>
1299         PR c++/84705
1300         * tree.c (build_cplus_new): Avoid duplicate diagnostic about
1301         incomplete type, early return error_mark_node if the second
1302         argument is error_mark_node.
1304 2018-10-12  Nathan Sidwell  <nathan@acm.org>
1306         * parser.h (struct cp_parser): Drop implicit_extern_c.
1307         * parser.c (cp_debug_parser): Drop implicit_extern_c.
1308         (cp_parser_new): Likewise.
1309         (cp_parser_translation_unit): Handle implicit extern c here.  Call
1310         cp_parser_toplevel_declaration.
1311         (cp_parser_toplevel_declaration): New, broken out of ...
1312         (cp_parser_declaration_seq_opt): ... here.  Call it.  Drop
1313         implicit extern C handling.
1315 2018-10-11  Will Wray  <wjwray@gmail.com>
1317         PR c++/87364
1318         * cxx-pretty-print.c (pp_cxx_enumeration_constant): New function.
1319         (cxx_pretty_printer::constant): Use it.
1321 2018-10-11  David Malcolm  <dmalcolm@redhat.com>
1323         PR c++/84993
1324         * call.c (enforce_access): Move diagnostics to...
1325         (complain_about_access): ...this new function.
1326         * cp-tree.h (class access_failure_info): Rename split out field
1327         "m_field_decl" into "m_decl" and "m_diag_decl".
1328         (access_failure_info::record_access_failure): Add tree param.
1329         (access_failure_info::was_inaccessible_p): New accessor.
1330         (access_failure_info::get_decl): New accessor.
1331         (access_failure_info::get_diag_decl): New accessor.
1332         (access_failure_info::get_any_accessor): New member function.
1333         (access_failure_info::add_fixit_hint): New static member function.
1334         (complain_about_access): New decl.
1335         * typeck.c (access_failure_info::record_access_failure): Update
1336         for change to fields.
1337         (access_failure_info::maybe_suggest_accessor): Split out into...
1338         (access_failure_info::get_any_accessor): ...this new function...
1339         (access_failure_info::add_fixit_hint): ...and this new function.
1340         (finish_class_member_access_expr): Split out "has no member named"
1341         error-handling into...
1342         (complain_about_unrecognized_member): ...this new function, and
1343         check that the guessed name is accessible along the access path.
1344         Only provide a spell-correction fix-it hint if it is; otherwise,
1345         attempt to issue an accessor fix-it hint.
1347 2018-10-11  Nathan Sidwell  <nathan@acm.org>
1349         * parser.c (cp_parser_translation_unit): Return void.  Don't fail
1350         at first extra }, simplify logic.
1351         (c_parse_file): Call finish_translation_unit here.
1353 2018-10-11  Jakub Jelinek  <jakub@redhat.com>
1355         PR c++/87582
1356         * typeck.c (maybe_warn_about_returning_address_of_local): If
1357         whats_returned is a structured binding identifier and the structured
1358         binding is a reference, recurse on its initializer.
1360         PR c++/87547
1361         * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead
1362         of TREE_TYPE.
1364 2018-10-10  Marek Polacek  <polacek@redhat.com>
1366         PR c++/87567 - constexpr rejects call to non-constexpr function.
1367         * constexpr.c (potential_constant_expression_1) <case FOR_STMT>: Return
1368         true if the condition is always false.
1369         <case WHILE_STMT>: Likewise.
1371 2018-10-09  Paolo Carlini  <paolo.carlini@oracle.com>
1373         PR c++/84423
1374         * pt.c (convert_template_argument): Immediately return error_mark_node
1375         if the second argument is erroneous.
1376         * parser.c (cp_parser_type_id): Add location_t * parameter.
1377         (cp_parser_type_id_1): Likewise.
1378         (cp_parser_alias_declaration): Adjust cp_parser_type_id call,
1379         obtain the location of the type and save it.
1380         (cp_parser_template_type_arg): Adjust.
1381         (cp_parser_trailing_type_id): Likewise.
1382         * decl.c (grokdeclarator): Improve error message for 'auto' in
1383         alias declaration.
1385 2018-10-08  Paolo Carlini  <paolo.carlini@oracle.com>
1387         PR c++/71128
1388         * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
1389         explicitly instantiated.
1391 2018-10-05  David Malcolm  <dmalcolm@redhat.com>
1393         PR c++/56856
1394         * call.c (build_over_call): Build a vec of locations of the
1395         arguments before the call to maybe_constant_value, and pass to
1396         check_function_arguments.
1397         * cp-lang.c (LANG_HOOKS_GET_SUBSTRING_LOCATION): Define as
1398         c_get_substring_location.
1399         * parser.c (cp_parser_string_literal): Capture string
1400         concatenation locations.
1402 2018-10-04  Nathan Sidwell  <nathan@acm.org>
1404         * lang-specs.h: Use string contatenation, not line splicing.
1406 2018-10-03  Jason Merrill  <jason@redhat.com>
1408         Implement P0840, language support for empty objects.
1409         * tree.c (handle_no_unique_addr_attribute): New.
1410         (cxx_attribute_table): Add [[no_unique_address]].
1411         * class.c (field_poverlapping_p): New.
1412         (layout_class_type): Check it.  Adjust DECL_SIZE of potentially
1413         overlapping fields.
1414         (layout_empty_base_or_field): Rename from layout_empty_base, handle
1415         FIELD_DECL as well.
1416         (build_base_field, record_subobject_offsets): Adjust.
1418 2018-10-03  Martin Liska  <mliska@suse.cz>
1420         PR gcov-profile/86109
1421         * parser.c (cp_parser_lambda_declarator_opt):
1422         Set DECL_LAMBDA_FUNCTION for lambdas.
1424 2018-10-02  Richard Biener  <rguenther@suse.de>
1426         * name-lookup.c (check_local_shadow): Do not test DECL_FROM_INLINE.
1428 2018-09-28  Eric Botcazou  <ebotcazou@adacore.com>
1429             Pierre-Marie de Rodat  <derodat@adacore.com>
1431         * method.c (use_thunk): Adjust call to cgraph_node::create_thunk.
1433 2018-09-28  Richard Biener  <rguenther@suse.de>
1435         * error.c (cp_print_error_function): Simplify by eliding
1436         the BLOCK_ABSTRACT_ORIGIN chasing.
1438 2018-09-27  Paolo Carlini  <paolo.carlini@oracle.com>
1440         PR c++/84940
1441         * semantics.c (finish_unary_op_expr): Check return value of
1442         build_x_unary_op for error_mark_node.
1444 2018-09-25  Jakub Jelinek  <jakub@redhat.com>
1446         PR c++/87398
1447         * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Only
1448         look through COMPONENT_REFs with DECL_FIELD_IS_BASE FIELD_DECLs.
1450 2018-09-25  Martin Liska  <mliska@suse.cz>
1452         * name-lookup.c (namespace_scope_ht_size): Remove
1453         unused function.
1454         * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
1456 2018-09-24  Paolo Carlini  <paolo.carlini@oracle.com>
1458         PR c++/85070
1459         * method.c (lazily_declare_fn): During error-recovery add_method
1460         may return false.
1462 2018-09-21  Marek Polacek  <polacek@redhat.com>
1464         PR c++/87372 - __func__ constexpr evaluation.
1465         * constexpr.c (maybe_constant_init_1): Pass false for strict down to
1466         cxx_eval_outermost_constant_expr.
1468 2018-09-20  Marek Polacek  <polacek@redhat.com>
1470         PR c++/87109 - wrong ctor with maybe-rvalue semantics.
1471         * call.c (build_user_type_conversion_1): Refine the maybe-rvalue
1472         check to only return if we're converting the return value to a base
1473         class.
1475 2018-09-20  Allan Sandfeld Jensen  <allan.jensen@qt.io>
1477         * g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
1479 2018-09-20  Jason Merrill  <jason@redhat.com>
1481         PR c++/87075 - ICE with constexpr array initialization.
1482         * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization.
1484 2018-09-19  Marek Polacek  <polacek@redhat.com>
1486         Add -Wclass-conversion.
1487         * decl.c (grok_op_properties): Change a warning from -Wconversion to
1488         -Wclass-conversion.  Make it print the types.
1490 2018-09-19  Paolo Carlini  <paolo.carlini@oracle.com>
1492         PR c++/87324
1493         * parser.c (cp_parser_initializer_list): Assign error_mark_node
1494         to the index upon error.
1496 2018-09-19  Marek Polacek  <polacek@redhat.com>
1498         PR c++/87357 - missing -Wconversion warning
1499         * decl.c (grok_op_properties): Remove diagnostic parts mentioning
1500         a conversion to a reference to void.  Use
1501         same_type_ignoring_top_level_qualifiers_p rather than comparing types
1502         directly.
1504 2018-09-18  Marek Polacek  <polacek@redhat.com>
1506         P1064R0 - Allowing Virtual Function Calls in Constant Expressions
1507         * call.c (build_over_call): No longer check if we're outside a template
1508         function.
1509         * class.c (build_vtbl_initializer): Build vtable's constructor with
1510         indexes.
1511         * constexpr.c (cxx_eval_constant_expression): Don't ignore _vptr's
1512         initializer.  Handle OBJ_TYPE_REF.
1513         (potential_constant_expression_1): Handle OBJ_TYPE_REF.
1514         * decl.c (maybe_commonize_var): Bail out for any DECL_ARTIFICIAL.
1515         (initialize_artificial_var): Mark the variable as constexpr.
1516         (grokdeclarator): Change error to pedwarn.  Only warn when
1517         pedantic and not C++2a.
1519 2018-09-18  Paolo Carlini  <paolo.carlini@oracle.com>
1521         PR c++/85065
1522         * cp-tree.h (NON_ERROR): New.
1523         * pt.c (auto_hash::hash): Use it.
1524         (do_auto_deduction): Likewise.
1526 2018-09-18  Nathan Sidwell  <nathan@acm.org>
1528         PR c++/86881
1529         * name-lookup.c (check_local_shadow): Ignore auto types.
1531 2018-09-17  David Malcolm  <dmalcolm@redhat.com>
1533         * error.c (range_label_for_type_mismatch::get_text): Update for
1534         new param.
1536 2018-09-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>
1538         * typeck2.c (digest_init_r): Fix overlength strings.
1540 2018-09-13  Ville Voutilainen  <ville.voutilainen@gmail.com>
1542         PR c++/87093
1543         * method.c (constructible_expr): We're in an unevaluated context
1544         in all cases, not just for class targets.
1546 2018-09-12  David Malcolm  <dmalcolm@redhat.com>
1548         PR c++/85110
1549         * call.c (struct conversion_info): Add "loc" field.
1550         (arg_conversion_rejection): Add "loc" param, using it to
1551         initialize the new field.
1552         (bad_arg_conversion_rejection): Likewise.
1553         (explicit_conversion_rejection): Initialize the new field to
1554         UNKNOWN_LOCATION.
1555         (template_conversion_rejection): Likewise.
1556         (add_function_candidate): Pass on the argument location to the new
1557         param of arg_conversion_rejection.
1558         (add_conv_candidate): Likewise.
1559         (build_builtin_candidate): Likewise.
1560         (build_user_type_conversion_1): Likewise.
1561         (single_z_candidate): New function.
1562         (maybe_get_bad_conversion_for_unmatched_call): New function.
1563         (complain_about_bad_argument): New function, based on part of
1564         convert_for_assignment.
1565         (build_new_method_call_1): Split out handling of the "no viable
1566         candidates" case into...
1567         (complain_about_no_candidates_for_method_call): ...this new
1568         function, and use the new functions above to special-case the
1569         handling of a single non-viable candidate due to a bad argument.
1570         * cp-tree.h (complain_about_bad_argument): New decl.
1571         * typeck.c (convert_for_assignment): Split out one error-handling
1572         case into complain_about_bad_argument.
1574 2018-09-09  Cesar Philippidis  <cesar@codesourcery.com>
1575             Julian Brown  <julian@codesourcery.com>
1577         PR middle-end/86336
1578         * semantics.c (finish_omp_clauses): Treat C++ references the same in
1579         OpenACC as OpenMP.
1581 2018-08-28  Martin Liska  <mliska@suse.cz>
1583         * constexpr.c (cxx_eval_call_expression): Add quotes
1584         to -fconstexpr-depth=.
1586 2018-09-10  Marek Polacek  <polacek@redhat.com>
1588         * class.c (build_vtbl_ref): Remove.
1589         (build_vtbl_ref_1): Rename to build_vtbl_ref.
1590         (build_vfn_ref): Call build_vtbl_ref instead of build_vtbl_ref_1.
1592 2018-09-08  Marek Polacek  <polacek@redhat.com>
1594         PR c++/87150 - wrong ctor with maybe-rvalue semantics.
1595         * call.c (struct conversion): Update commentary.
1596         (standard_conversion): Set rvaluedness_matches_p if LOOKUP_PREFER_RVALUE
1597         for ck_base.
1599 2018-09-08  Jason Merrill  <jason@redhat.com>
1601         PR c++/86678 - constexpr function with non-constant after return.
1602         * constexpr.c (potential_constant_expression_1): Add jump_target.
1603         (breaks): Check for BREAK_STMT.
1604         (continues): Check for CONTINUE_STMT.
1606 2018-09-08  Marek Polacek  <polacek@redhat.com>
1608         * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
1609         RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
1611 2018-09-07  Marek Polacek  <polacek@redhat.com>
1613         PR c++/87152 - range-based for loops with initializer broken in templates.
1614         * constexpr.c (potential_constant_expression_1) <case RANGE_FOR_STMT>:
1615         Recur into RANGE_FOR_INIT_STMT.
1616         * cp-tree.def: Add RANGE_FOR_INIT_STMT to RANGE_FOR_STMT.
1617         * cp-tree.h (RANGE_FOR_INIT_STMT): Define.
1618         * dump.c (cp_dump_tree) <case RANGE_FOR_STMT>: Also dump
1619         RANGE_FOR_INIT_STMT.
1620         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Recur into
1621         RANGE_FOR_INIT_STMT.
1622         * semantics.c (begin_range_for_stmt): Adjust call to build_stmt.
1623         Do put the init statement in RANGE_FOR_INIT_STMT.
1624         (finish_range_for_decl): Pop it for templates.
1626 2018-09-06  Bernd Edlinger  <bernd.edlinger@hotmail.de>
1628         * decl.c (check_initializer): Call cp_complete_array_type.
1630 2018-09-05  Marek Polacek  <polacek@redhat.com>
1632         PR c++/87109, wrong overload with ref-qualifiers.
1633         * call.c (build_user_type_conversion_1): Use NULL instead of 0.  Bail
1634         out if performing the maybe-rvalue overload resolution and a conversion
1635         function is getting called.
1637         PR c++/86982, -Wreturn-local-addr and std::move and std::forward.
1638         * typeck.c (maybe_warn_about_returning_address_of_local): Handle calls
1639         to std::move or std::forward.
1640         (is_std_forward_p): New function.
1642 2018-09-05  Pádraig Brady  <p@draigbrady.com>
1644         PR c++/87185
1645         * lambda.c (prune_lambda_captures): Protect against const_vars.get
1646         returning NULL.
1648 2018-09-04  Marek Polacek  <polacek@redhat.com>
1650         * cp-tree.h (treat_lvalue_as_rvalue_p): Declare.
1651         * except.c (build_throw): Use it.  Use CP_TYPE_VOLATILE_P.
1652         * typeck.c (treat_lvalue_as_rvalue_p): No longer static.  Add PARM_OK
1653         parameter.
1654         (maybe_warn_pessimizing_move): Adjust treat_lvalue_as_rvalue_p call.
1655         (check_return_expr): Likewise.
1657 2018-09-03  Paolo Carlini  <paolo.carlini@oracle.com>
1659         PR c++/84980
1660         * constraint.cc (finish_shorthand_constraint): Early return if the
1661         constraint is erroneous.
1663 2018-09-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>
1665         * decl.c (eval_check_narrowing): Remove.
1666         (check_initializer): Move call to braced_list_to_string from here ...
1667         * typeck2.c (store_init_value): ... to here.
1668         (digest_init_r): Remove handing of signed/unsigned char strings.
1670 2018-08-31  Nathan Sidwell  <nathan@acm.org>
1672         PR c++/87155
1673         PR c++/84707
1674         * name-lookup.c (name_lookup::search_namespace): Don't look at
1675         inlines when searching for NULL names.
1677         * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
1678         of return types and parms.
1679         * parser.c (cp_parser_parameter_declaration_clause): Likewise,
1680         '()' always means '(void)'.
1682 2018-08-29  Jakub Jelinek  <jakub@redhat.com>
1684         PR c++/87095
1685         * decl.c (begin_destructor_body): If current_class_type has
1686         virtual bases and the primary base is nearly empty virtual base,
1687         voidify clearing of vptr and make it conditional on in-charge
1688         argument.
1690 2018-08-29  Paolo Carlini  <paolo.carlini@oracle.com>
1692         PR c++/85265
1693         * parser.c (cp_parser_introduction_list): If cp_parser_identifier
1694         returns error_mark_node early exit the loop.
1695         (cp_parser_template_introduction): Improve error-recovery, remove
1696         error call about empty introduction-list.
1698 2018-08-29  David Malcolm  <dmalcolm@redhat.com>
1700         PR c++/85110
1701         * call.c (print_conversion_rejection): Add "fn" param and use it
1702         for "no known conversion" messages to underline the pertinent
1703         param.
1704         (print_z_candidate): Supply "fn" to the new param above.
1706 2018-08-29  Jakub Jelinek  <jakub@redhat.com>
1708         PR c++/87122
1709         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
1710         processing_template_decl and decl is structured binding decl, call
1711         cp_finish_decomp.
1713 2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>
1715         PR c++/86546
1716         * decl.c (finish_case_label): If the type is erroneous early
1717         return error_mark_node.
1719 2018-08-27  David Malcolm  <dmalcolm@redhat.com>
1721         PR c++/63392
1722         * parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
1723         hint.
1725 2018-08-27  Jakub Jelinek  <jakub@redhat.com>
1727         PR c++/86993
1728         * cp-tree.h (cxx_readonly_error): Add location_t argument.
1729         * typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
1730         ERROR_FOR_ASSIGNMENT macro and readonly_error.  Add LOC argument
1731         to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
1732         pass LOC to it.  Formatting fixes.
1733         * typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
1734         (cp_build_modify_expr): Pass loc to cxx_readonly_error.
1735         * semantics.c (finish_asm_stmt): Pass input_location to
1736         cxx_readonly_error.
1738 2018-08-27  David Malcolm  <dmalcolm@redhat.com>
1740         PR c++/87091
1741         * decl.c (grokdeclarator): Update for conversion of show_caret_p
1742         to a tri-state.
1743         * error.c (cp_printer): Likewise.
1744         * name-lookup.c (maybe_suggest_missing_std_header): Update call to
1745         maybe_add_include_fixit to suggest overriding the location, as it
1746         is for a note.
1747         * parser.c (cp_parser_string_literal): Update for conversion of
1748         show_caret_p to a tri-state.
1749         (cp_parser_elaborated_type_specifier): Likewise.
1750         (set_and_check_decl_spec_loc): Likewise.
1751         * pt.c (listify): Update call to maybe_add_include_fixit to not
1752         override the location, as it is for an error.
1753         * rtti.c (typeid_ok_p): Likewise.
1755 2018-08-27  Martin Liska  <mliska@suse.cz>
1757         * call.c (build_call_a): Use new function
1758         fndecl_built_in_p and remove check for FUNCTION_DECL if
1759         possible.
1760         (build_cxx_call): Likewise.
1761         * constexpr.c (constexpr_fn_retval): Likewise.
1762         (cxx_eval_builtin_function_call): Likewise.
1763         (cxx_eval_call_expression): Likewise.
1764         (potential_constant_expression_1): Likewise.
1765         * cp-gimplify.c (cp_gimplify_expr): Likewise.
1766         (cp_fold): Likewise.
1767         * decl.c (decls_match): Likewise.
1768         (validate_constexpr_redeclaration): Likewise.
1769         (duplicate_decls): Likewise.
1770         (make_rtl_for_nonlocal_decl): Likewise.
1771         * name-lookup.c (consider_binding_level): Likewise.
1772         (cp_emit_debug_info_for_using): Likewise.
1773         * semantics.c (finish_call_expr): Likewise.
1774         * tree.c (builtin_valid_in_constant_expr_p): Likewise.
1776 2018-08-26  Marek Polacek  <polacek@redhat.com>
1778         PR c++/87080
1779         * typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.
1781         PR c++/87029, Implement -Wredundant-move.
1782         * typeck.c (treat_lvalue_as_rvalue_p): New function.
1783         (maybe_warn_pessimizing_move): Call convert_from_reference.
1784         Warn about redundant moves.
1786 2018-08-24  Marek Polacek  <polacek@redhat.com>
1788         PR c++/67012
1789         PR c++/86942
1790         * decl.c (grokdeclarator): Disallow functions with trailing return
1791         type with decltype(auto) as its type.  Also check the function if
1792         it's inner declarator doesn't exist
1794 2018-08-21  Marek Polacek  <polacek@redhat.com>
1796         PR c++/86499
1797         * parser.c (cp_parser_lambda_introducer): Give error if a non-local
1798         lambda has a capture-default.
1800 2018-08-21  Paolo Carlini  <paolo.carlini@oracle.com>
1802         * decl.c (check_static_variable_definition): Change to return void.
1804 2018-08-21  Marek Polacek  <polacek@redhat.com>
1806         PR c++/86981, Implement -Wpessimizing-move.
1807         * typeck.c (decl_in_std_namespace_p): New.
1808         (is_std_move_p): New.
1809         (maybe_warn_pessimizing_move): New.
1810         (can_do_nrvo_p): New, factored out of ...
1811         (check_return_expr): ... here.  Warn about potentially harmful
1812         std::move in a return statement.
1814         PR c++/65043
1815         * call.c (standard_conversion): Set check_narrowing.
1816         * typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
1817         than comparing with INTEGER_TYPE.
1819         * cp-tree.h: Fix typo.
1821 2018-08-20  David Malcolm  <dmalcolm@redhat.com>
1823         PR other/84889
1824         * call.c (build_user_type_conversion_1): Add auto_diagnostic_group
1825         instance(s).
1826         (print_error_for_call_failure): Likewise.
1827         (build_op_call_1): Likewise.
1828         (build_conditional_expr_1): Likewise.
1829         (build_new_op_1): Likewise.
1830         (build_op_delete_call): Likewise.
1831         (convert_like_real): Likewise.
1832         (build_over_call): Likewise.
1833         (build_new_method_call_1): Likewise.
1834         (joust): Likewise.
1835         * class.c (check_tag): Likewise.
1836         (finish_struct_anon_r): Likewise.
1837         (one_inherited_ctor): Likewise.
1838         (finalize_literal_type_property): Likewise.
1839         (explain_non_literal_class): Likewise.
1840         (find_flexarrays): Likewise.
1841         (resolve_address_of_overloaded_function): Likewise.
1842         * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1843         (is_valid_constexpr_fn): Likewise.
1844         (cx_check_missing_mem_inits): Likewise.
1845         * cp-gimplify.c (cp_genericize_r): Likewise.
1846         * cvt.c (maybe_warn_nodiscard): Likewise.
1847         * decl.c (warn_extern_redeclared_static): Likewise.
1848         (check_redeclaration_exception_specification): Likewise.
1849         (check_no_redeclaration_friend_default_args): Likewise.
1850         (duplicate_decls): Likewise.
1851         (redeclaration_error_message): Likewise.
1852         (warn_misplaced_attr_for_class_type): Likewise.
1853         * decl2.c (finish_static_data_member_decl): Likewise.
1854         (no_linkage_error): Likewise.
1855         (cp_warn_deprecated_use): Likewise.
1856         * error.c (qualified_name_lookup_error): Likewise.
1857         * friend.c (make_friend_class): Likewise.
1858         (do_friend): Likewise.
1859         * init.c (perform_member_init): Likewise.
1860         (build_new_1): Likewise.
1861         (build_vec_delete_1): Likewise.
1862         (build_delete): Likewise.
1863         * lex.c (unqualified_name_lookup_error): Likewise.
1864         * name-lookup.c (check_extern_c_conflict): Likewise.
1865         (inform_shadowed): New function.
1866         (check_local_shadow): Add auto_diagnostic_group instances,
1867         replacing goto "inform_shadowed" label with call to subroutine.
1868         (set_local_extern_decl_linkage): Add auto_diagnostic_group
1869         instance(s).
1870         * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
1871         (cp_parser_namespace_name): Likewise.
1872         * pt.c (check_specialization_namespace): Likewise.
1873         (check_template_variable): Likewise.
1874         (warn_spec_missing_attributes): Likewise.
1875         (check_explicit_specialization): Likewise.
1876         (process_partial_specialization): Likewise.
1877         (lookup_template_class_1): Likewise.
1878         (finish_template_variable): Likewise.
1879         (do_auto_deduction): Likewise.
1880         * search.c (check_final_overrider): Likewise.
1881         (look_for_overrides_r): Likewise.
1882         * tree.c (maybe_warn_parm_abi): Likewise.
1883         * typeck.c (cxx_sizeof_expr): Likewise.
1884         (cp_build_function_call_vec): Likewise.
1885         (cp_build_binary_op): Likewise.
1886         (convert_for_assignment): Likewise.
1887         (maybe_warn_about_returning_address_of_local): Likewise.
1888         * typeck2.c (abstract_virtuals_error_sfinae): Likewise.
1889         (check_narrowing): Likewise.
1891 2018-08-17  David Malcolm  <dmalcolm@redhat.com>
1893         * typeck.c (string_conv_p): Extract location from EXP and use it
1894         in preference to input_location when issuing warnings.
1896 2018-08-15  David Malcolm  <dmalcolm@redhat.com>
1898         * call.c: Include "gcc-rich-location.h".
1899         (convert_like_real): Add range label for "invalid conversion"
1900         diagnostic.
1901         (perform_implicit_conversion_flags): Add type label to the
1902         "could not convert" error.
1903         * error.c: Include "gcc-rich-location.h".
1904         (range_label_for_type_mismatch::get_text): New function.
1905         * typeck.c (convert_for_assignment): Add type label to
1906         the "cannot convert" error if a location is available.
1908 2018-08-15  Paolo Carlini  <paolo.carlini@oracle.com>
1910         * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
1911         emit an error instead of a permerror.
1913 2018-08-13  Marek Polacek  <polacek@redhat.com>
1915         PR c++/57891
1916         * call.c (struct conversion): Add check_narrowing_const_only.
1917         (build_converted_constant_expr): Set check_narrowing and
1918         check_narrowing_const_only.  Give error if expr is error node.
1919         (convert_like_real): Pass it to check_narrowing.
1920         * cp-tree.h (check_narrowing): Add a default parameter.
1921         * decl.c (compute_array_index_type): Use input_location instead of
1922         location_of.
1923         * pt.c (convert_nontype_argument): Return NULL_TREE if tf_error.
1924         * typeck2.c (check_narrowing): Don't warn for instantiation-dependent
1925         expressions.  Call maybe_constant_value instead of
1926         fold_non_dependent_expr.  Don't mention { } in diagnostic.  Only check
1927         narrowing for constants if CONST_ONLY.
1929 2018-08-13  Martin Sebor  <msebor@redhat.com>
1931         PR tree-optimization/71625
1932         * decl.c (check_initializer):  Call braced_list_to_string.
1933         (eval_check_narrowing): New function.
1934         * gcc/cp/typeck2.c (digest_init_r): Accept strings literals
1935         as initilizers for all narrow character types.
1937 2018-08-13  Marek Polacek  <polacek@redhat.com>
1939         P0806R2 - Deprecate implicit capture of this via [=]
1940         * lambda.c (add_default_capture): Formatting fixes.  Warn about
1941         deprecated implicit capture of this via [=].
1943         PR c++/86915
1944         * decl.c (create_array_type_for_decl): Handle null name.
1946 2018-08-10  Jason Merrill  <jason@redhat.com>
1948         PR c++/86728 - C variadic generic lambda.
1949         * parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into
1950         a pack if it's followed by a declarator-id.
1952 2018-08-08  Jakub Jelinek  <jakub@redhat.com>
1954         P0595R1 - is_constant_evaluated
1955         * cp-tree.h (enum cp_built_in_function): New.
1956         (maybe_constant_init): Add pretend_const_required argument.
1957         * typeck2.c (store_init_value): Pass true as new argument to
1958         maybe_constant_init.
1959         * constexpr.c (constexpr_fn_retval): Check also DECL_BUILT_IN_CLASS
1960         for BUILT_IN_UNREACHABLE.
1961         (struct constexpr_ctx): Add pretend_const_required field.
1962         (cxx_eval_builtin_function_call): Use DECL_IS_BUILTIN_CONSTANT_P
1963         macro.  Handle CP_BUILT_IN_IS_CONSTANT_EVALUATED.  Check also
1964         DECL_BUILT_IN_CLASS for BUILT_IN_UNREACHABLE.
1965         (cxx_eval_outermost_constant_expr): Add pretend_const_required
1966         argument, initialize pretend_const_required field in ctx.  If the
1967         result is TREE_CONSTANT and non_constant_p, retry with
1968         pretend_const_required false if it was true.
1969         (is_sub_constant_expr): Initialize pretend_const_required_field in
1970         ctx.
1971         (cxx_constant_value): Pass true as pretend_const_required to
1972         cxx_eval_outermost_constant_expr.
1973         (maybe_constant_value): Pass false as pretend_const_required to
1974         cxx_eval_outermost_constant_expr.
1975         (fold_non_dependent_expr): Likewise.
1976         (maybe_constant_init_1): Add pretend_const_required argument, pass it
1977         down to cxx_eval_outermost_constant_expr.  Pass !allow_non_constant
1978         instead of false as strict to cxx_eval_outermost_constant_expr.
1979         (maybe_constant_init): Add pretend_const_required argument, pass it
1980         down to maybe_constant_init_1.
1981         (cxx_constant_init): Pass true as pretend_const_required to
1982         maybe_constant_init_1.
1983         * cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPRs to
1984         CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1985         (cp_fold): Don't fold CP_BUILT_IN_IS_CONSTANT_EVALUATED calls.
1986         * decl.c: Include langhooks.h.
1987         (cxx_init_decl_processing): Register __builtin_is_constant_evaluated
1988         built-in.
1989         * tree.c (builtin_valid_in_constant_expr_p): Return true for
1990         CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1991         * pt.c (declare_integer_pack): Initialize DECL_FUNCTION_CODE.
1993         PR c++/86836
1994         * pt.c (tsubst_expr): For structured bindings, call tsubst_decomp_names
1995         before tsubst_init, not after it.
1997         PR c++/86738
1998         * constexpr.c (cxx_eval_binary_expression): For arithmetics involving
1999         NULL pointer set *non_constant_p to true.
2000         (cxx_eval_component_reference): For dereferencing of a NULL pointer,
2001         set *non_constant_p to true and return t.
2003 2018-08-07  Paolo Carlini  <paolo.carlini@oracle.com>
2005         PR c++/59480, DR 136
2006         * decl.c (check_no_redeclaration_friend_default_args): New.
2007         (duplicate_decls): Use the latter; also check that a friend
2008         declaration specifying default arguments is a definition.
2010 2018-08-07  Ville Voutilainen  <ville.voutilainen@gmail.com>
2012         PR c++/79133
2013         * name-lookup.c (check_local_shadow): Reject captures and parameters
2014         with the same name.
2016 2018-08-06  Marek Polacek  <polacek@redhat.com>
2018         PR c++/86767
2019         * constexpr.c (cxx_eval_statement_list): Handle continue.
2021 2018-08-03  David Malcolm  <dmalcolm@redhat.com>
2022             Jonathan Wakely  <jwakely@redhat.com>
2024         * decl.c: Include "gcc-rich-location.h".
2025         (add_return_star_this_fixit): New function.
2026         (finish_function): When warning about missing return statements in
2027         functions returning non-void, add a "return *this;" fix-it hint for
2028         assignment operators.
2030 2018-08-03  Jason Merrill  <jason@redhat.com>
2032         PR c++/86706
2033         * class.c (build_base_path): Use currently_open_class.
2035 2018-08-02  David Malcolm  <dmalcolm@redhat.com>
2037         * error.c (cxx_print_error_function): Duplicate "file" before
2038         passing it to pp_set_prefix.
2039         (cp_print_error_function): Use pp_take_prefix when saving the
2040         existing prefix.
2042 2018-08-02  Richard Biener  <rguenther@suse.de>
2044         PR c++/86763
2045         * class.c (layout_class_type): Copy TYPE_TYPELESS_STORAGE
2046         to the CLASSTYPE_AS_BASE.
2048 2018-08-01  Martin Sebor  <msebor@redhat.com>
2050         PR tree-optimization/86650
2051         * error.c (cp_printer): Move usage of EXPR_LOCATION (t) and
2052         TREE_BLOCK (t) from within percent_K_format to this callsite.
2054 2018-08-01  Paolo Carlini  <paolo.carlini@oracle.com>
2056         PR c++/86661
2057         * class.c (note_name_declared_in_class): Use location_of in permerror
2058         instead of DECL_SOURCE_LOCATION (for OVERLOADs).
2060 2018-07-31  Tom de Vries  <tdevries@suse.de>
2062         PR debug/86687
2063         * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
2065 2018-07-31  Jakub Jelinek  <jakub@redhat.com>
2067         P1008R1 - prohibit aggregates with user-declared constructors
2068         * class.c (check_bases_and_members): For C++2a set
2069         CLASSTYPE_NON_AGGREGATE based on TYPE_HAS_USER_CONSTRUCTOR rather than
2070         type_has_user_provided_or_explicit_constructor.
2072 2018-07-31  Martin Liska  <mliska@suse.cz>
2074         PR c++/86653
2075         * parser.c (cp_parser_condition): Initialize non_constant_p
2076         to false.
2078 2018-07-28  David Malcolm  <dmalcolm@redhat.com>
2080         * error.c (cp_printer): In the leading comment, move "%H" and "%I"
2081         into alphabetical order, and add missing "%G" and "%K".  Within
2082         the switch statement, move cases 'G', 'H', 'I' and 'K' so that the
2083         cases are in alphabetical order.
2085 2018-07-25  Jakub Jelinek  <jakub@redhat.com>
2087         * cp-tree.h (enum cp_tree_index): Add
2088         CPTI_{ABI_TAG,ALIGNED,BEGIN,END,GET,TUPLE_{ELEMENT,SIZE}}_IDENTIFIER
2089         and CPTI_{GNU,TYPE,VALUE,FUN,CLOSURE}_IDENTIFIER.
2090         (abi_tag_identifier, aligned_identifier, begin_identifier,
2091         end_identifier, get__identifier, gnu_identifier,
2092         tuple_element_identifier, tuple_size_identifier, type_identifier,
2093         value_identifier, fun_identifier, closure_identifier): Define.
2094         * decl.c (initialize_predefined_identifiers): Initialize the above
2095         identifiers.
2096         (get_tuple_size): Use tuple_size_identifier instead of
2097         get_identifier ("tuple_size") and value_identifier instead of
2098         get_identifier ("value").
2099         (get_tuple_element_type): Use tuple_element_identifier instead of
2100         get_identifier ("tuple_element") and type_identifier instead of
2101         get_identifier ("type").
2102         (get_tuple_decomp_init): Use get__identifier instead of
2103         get_identifier ("get").
2104         * lambda.c (maybe_add_lambda_conv_op): Use fun_identifier instead of
2105         get_identifier ("_FUN").
2106         * parser.c (cp_parser_lambda_declarator_opt): Use closure_identifier
2107         instead of get_identifier ("__closure").
2108         (cp_parser_std_attribute): Use gnu_identifier instead of
2109         get_identifier ("gnu").
2110         (cp_parser_std_attribute_spec): Likewise.  Use aligned_identifier
2111         instead of get_identifier ("aligned").
2112         * class.c (check_abi_tags, inherit_targ_abi_tags): Use
2113         abi_tag_identifier instead of get_identifier ("abi_tag").
2115         PR c++/85515
2116         * cp-tree.h (enum cp_tree_index): Add
2117         CPTI_FOR_{RANGE,BEGIN,END}{,_}_IDENTIFIER.
2118         (for_range__identifier, for_begin__identifier, for_end__identifier,
2119         for_range_identifier, for_begin_identifier, for_end_identifier):
2120         Define.
2121         * decl.c (initialize_predefined_identifiers): Initialize
2122         for_{range,begin,end}{,_}_identifier.
2123         * parser.c (build_range_temp): Use for_range__identifier instead of
2124         get_identifier ("__for_range").
2125         (cp_convert_range_for): Use for_begin__identifier and
2126         for_end__identifier instead of get_identifier ("__for_begin") and
2127         get_identifier ("__for_end").
2128         * semantics.c (finish_for_stmt): Rename "__for_{range,begin,end} "
2129         local symbols to "__for_{range,begin,end}".
2131 2018-07-23  Jakub Jelinek  <jakub@redhat.com>
2133         PR c++/86569
2134         * cp-gimplify.c (cp_fold): Don't fold comparisons into other kind
2135         of expressions other than INTEGER_CST regardless of TREE_NO_WARNING
2136         or warn_nonnull_compare.
2138 2018-07-19  Paolo Carlini  <paolo.carlini@oracle.com>
2140         Revert fix for c++/59480 (and testsuite followup)
2142         2019-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
2144         PR c++/59480, DR 136
2145         * decl.c (check_no_redeclaration_friend_default_args): New.
2146         (duplicate_decls): Use the latter; also check that a friend
2147         declaration specifying default arguments is a definition.
2149 2018-07-18  Jakub Jelinek  <jakub@redhat.com>
2151         PR c++/86550
2152         * parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
2153         specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
2155 2018-07-18  Marek Polacek  <polacek@redhat.com>
2157         PR c++/86190 - bogus -Wsign-conversion warning
2158         * typeck.c (cp_build_binary_op): Fix formatting.  Add a warning
2159         sentinel.
2161 2018-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
2163         PR c++/59480, DR 136
2164         * decl.c (check_no_redeclaration_friend_default_args): New.
2165         (duplicate_decls): Use the latter; also check that a friend
2166         declaration specifying default arguments is a definition.
2168 2018-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
2170         * class.c (note_name_declared_in_class): Prefer permerror + inform
2171         to a pair of permerrors; use DECL_SOURCE_LOCATION.
2173 2018-07-18  Richard Biener  <rguenther@suse.de>
2175         PR debug/86523
2176         * decl2.c (c_parse_final_cleanups): Call write_out_vars before
2177         start_static_storage_duration_function sets current_function_decl.
2179 2018-07-17  Jason Merrill  <jason@redhat.com>
2181         PR c++/86480 - nested variadic lambda and constexpr if.
2182         * pt.c (find_parameter_packs_r) [IF_STMT]: Don't walk into
2183         IF_STMT_EXTRA_ARGS.
2184         * tree.c (cp_walk_subtrees) [DECLTYPE_TYPE]: Set
2185         cp_unevaluated_operand.
2186         [ALIGNOF_EXPR] [SIZEOF_EXPR] [NOEXCEPT_EXPR]: Likewise.
2188 2018-07-16  Paolo Carlini  <paolo.carlini@oracle.com>
2190         * class.c (resolve_address_of_overloaded_function): Don't emit an
2191         inform if the matching permerror returns false.
2192         * pt.c (check_specialization_namespace): Likewise.
2194 2018-07-16  Jakub Jelinek  <jakub@redhat.com>
2196         PR c++/3698
2197         PR c++/86208
2198         * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or
2199         in TREE_USED flag from stmt to h->to.
2201 2018-07-13  Nathan Sidwell  <nathan@acm.org>
2203         PR c++/86374
2204         * pt.c (lookup_template_class_1): Use tsubst_aggr_type for
2205         contexts that are classes.
2206         * parser.c (cp_parser_template_id): Combine entering_scope decl &
2207         initializer.
2209 2018-07-12  Jakub Jelinek  <jakub@redhat.com>
2211         * decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable
2212         type here, instead add "omp declare target implicit" attribute.  Add
2213         that attribute instead of "omp declare target" also when
2214         processing_template_decl.
2215         * decl.c (cp_finish_decl): Diagnose vars without mappable type here,
2216         and before calling cp_omp_mappable_type call complete_type.
2218 2018-07-10  Jakub Jelinek  <jakub@redhat.com>
2220         PR sanitizer/86406
2221         * cp-gimplify.c (cp_maybe_instrument_return): Skip trailing
2222         DEBUG_BEGIN_STMTs.
2224         PR c++/86443
2225         * semantics.c (handle_omp_for_class_iterator): Remove lastp argument,
2226         instead of setting *lastp turn orig_declv elt into a TREE_LIST.
2227         (finish_omp_for): Adjust handle_omp_for_class_iterator caller.
2228         * pt.c (tsubst_omp_for_iterator): Allow OMP_FOR_ORIG_DECLS to contain
2229         TREE_LIST for both the original class iterator and the "last" helper
2230         var.
2232 2018-07-09  Paolo Carlini  <paolo.carlini@oracle.com>
2234         * decl.c (grokdeclarator): Use rich_location::add_range in three
2235         more places; include gcc-rich-location.h.
2237 2018-07-07  Aldy Hernandez  <aldyh@redhat.com>
2239         * decl.c (build_enumerator): Change overflow type to overflow_type.
2240         * init.c (build_new_1): Same.
2242 2018-07-05  Nathan Sidwell  <nathan@acm.org>
2244         * cp/decl.c (decls_match): Check SYSTEM_IMPLICIT_EXTERN_C not
2245         NO_IMPLICIT_EXTERN_C.
2246         * cp/parser.c (cp_parser_parameter_declaration_clause): Likewise.
2248 2018-07-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
2250         PR c++/86398
2251         * method.c (is_trivially_xible): Return false
2252         if is_xible_helper returns a NULL_TREE.
2254 2018-07-03  Paolo Carlini  <paolo.carlini@oracle.com>
2256         * decl.c (min_location): New.
2257         (smallest_type_quals_location): Use the latter.
2258         (check_concept_fn): Use DECL_SOURCE_LOCATION.
2259         (grokdeclarator): Use accurate locations in a number of error
2260         messages involving ds_thread, ds_storage_class, ds_virtual,
2261         ds_constexpr, ds_typedef and ds_friend; exploit min_location.
2263 2018-07-03  Marek Polacek  <polacek@redhat.com>
2265         PR c++/86201
2266         * typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.
2268 2018-07-03  Jason Merrill  <jason@redhat.com>
2270         PR c++/86378 - functional cast in noexcept-specifier.
2271         * tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
2273 2018-07-02  Paolo Carlini  <paolo.carlini@oracle.com>
2275         * parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range
2276         in error message about __thread and thread_local at the same time.
2278 2018-06-29  Marek Polacek  <polacek@redhat.com>
2280         PR c++/86184
2281         * tree.c (cp_save_expr): Don't call save_expr for TARGET_EXPRs.
2283 2018-06-28  David Malcolm  <dmalcolm@redhat.com>
2285         * parser.c (cp_parser_error_1): After issuing a conflict marker
2286         error, consume tokens until the end of the source line.
2288 2018-06-28  Jason Merrill  <jason@redhat.com>
2290         PR c++/86342 - -Wdeprecated-copy and system headers.
2291         * decl2.c (cp_warn_deprecated_use): Don't warn about declarations
2292         in system headers.
2294 2018-06-27  David Malcolm  <dmalcolm@redhat.com>
2296         PR c++/86329
2297         * name-lookup.c (consider_binding_level): Filter out names that
2298         match anon_aggrname_p.
2300 2018-06-27  Jason Merrill  <jason@redhat.com>
2302         * name-lookup.c (do_pushtag): If we skip a class level, also skip
2303         its template level.
2305 2018-06-26  Jason Merrill  <jason@redhat.com>
2307         PR c++/86320 - memory-hog with std::array of pair
2308         * typeck2.c (process_init_constructor_array): Only compute a
2309         constant initializer once.
2311         PR c++/80290 - memory-hog with std::pair.
2312         * pt.c (fn_type_unification): Add convs parameter.
2313         (check_non_deducible_conversion): Remember conversion.
2314         (check_non_deducible_conversions): New.  Do checks here.
2315         (type_unification_real): Not here.  Remove flags parm.
2316         * call.c (add_function_candidate): Make convs a parameter.
2317         Don't recalculate the conversion if it's already set.
2318         (add_template_candidate_real): Allocate convs here.
2319         (good_conversion, conv_flags): New.
2321 2018-06-26  Jakub Jelinek  <jakub@redhat.com>
2323         PR c++/86291
2324         * parser.c (cp_parser_omp_for_loop_init): Change for_block argument
2325         type from vec<tree, va_gc> * to vec<tree, va_gc> *&.
2327 2018-06-23  Paolo Carlini  <paolo.carlini@oracle.com>
2329         * decl.c (bad_specifiers): Add const location_t* parameter and
2330         use locations in error messages about 'inline' and 'virtual'.
2331         (mark_inline_variable): Add location_t parameter and use it in
2332         error_at and pedwarn messages.
2333         (grokdeclarator): Use declspecs->locations[ds_constexpr],
2334         declspecs->locations[ds_concept], declspecs->locations[ds_virtual],
2335         declspecs->locations[ds_inline] in many error messages; adjust
2336         bad_specifiers and mark_inline_variable calls.
2337         (grokvardecl): Use declspecs->locations[ds_concept] in error message.
2339 2018-06-22  Jason Merrill  <jason@redhat.com>
2341         PR c++/86219 - ICE with erroneous initializer in template.
2342         * constexpr.c (fold_non_dependent_expr): Add complain parm.
2343         * call.c, expr.c, init.c, pt.c, semantics.c, typeck.c, typeck2.c:
2344         Pass it.
2345         * call.c (build_cxx_call): Don't mess with builtins in a template.
2346         * typeck2.c (store_init_value): If fold_non_dependent_expr didn't
2347         produce a constant value, go back to the uninstantiated form.
2349         Avoid taking the address of something just because it's in parens.
2350         * constexpr.c (same_type_ignoring_tlq_and_bounds_p): New.
2351         (cxx_fold_indirect_ref): Use it.
2352         (cxx_eval_constant_expression) [VIEW_CONVERT_EXPR]: Use it.
2353         * cp-tree.h (REF_PARENTHESIZED_P): Allow VIEW_CONVERT_EXPR.
2354         * semantics.c (force_paren_expr): Use VIEW_CONVERT_EXPR instead of
2355         static_cast to reference type.
2356         (maybe_undo_parenthesized_ref): Handle VIEW_CONVERT_EXPR.
2358 2018-06-21  Jason Merrill  <jason@redhat.com>
2360         * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS.
2362         * name-lookup.c (do_push_to_top_level): Don't allocate
2363         current_lang_base.
2364         (do_pop_from_top_level): Release current_lang_base.
2366         Let -fmem-report see callers of cxx_make_type.
2367         * lex.c (cxx_make_type): Add MEM_STAT_DECL.
2368         (make_class_type): Likewise.
2369         (cxx_make_type_hook): New.
2370         * cp-objcp-common.h (LANG_HOOKS_MAKE_TYPE): Use cxx_make_type_hook.
2372 2018-06-20  Nathan Sidwell  <nathan@acm.org>
2374         PR c++/85634
2375         * friend.c (add_friend): Keep lookup sets of tempate sets.
2377 2018-06-20  Paolo Carlini  <paolo.carlini@oracle.com>
2379         * decl.c (grokfndecl): Add const cp_decl_specifier_seq* parameter;
2380         tidy handling of a null location_t argument; use proper location
2381         information in a few additional error messages.
2382         (grokdeclarator): Update calls.
2384 2018-06-20  Chung-Lin Tang  <cltang@codesourcery.com>
2385             Thomas Schwinge  <thomas@codesourcery.com>
2386             Cesar Philippidis  <cesar@codesourcery.com>
2388         * parser.c (cp_parser_omp_clause_name): Add support for finalize
2389         and if_present. Make present_or_{copy,copyin,copyout,create} aliases
2390         to their non-present_or_* counterparts. Make 'self' an alias to
2391         PRAGMA_OACC_CLAUSE_HOST.
2392         (cp_parser_oacc_data_clause): Update GOMP mappings for
2393         PRAGMA_OACC_CLAUSE_{COPY,COPYIN,COPYOUT,CREATE,DELETE}. Remove
2394         PRAGMA_OACC_CLAUSE_{SELF,PRESENT_OR_*}.
2395         (cp_parser_oacc_all_clauses): Handle finalize and if_present clauses.
2396         Remove support for present_or_* clauses.
2397         (OACC_KERNELS_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
2398         (OACC_PARALLEL_CLAUSE_MASK): Likewise.
2399         (OACC_DECLARE_CLAUSE_MASK): Likewise.
2400         (OACC_DATA_CLAUSE_MASK): Likewise.
2401         (OACC_ENTER_DATA_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
2402         (OACC_EXIT_DATA_CLAUSE_MASK): Add FINALIZE clause.
2403         (OACC_UPDATE_CLAUSE_MASK): Remove SELF, add IF_PRESENT.
2404         (cp_parser_oacc_declare): Remove PRESENT_OR_* clauses.
2405         * pt.c (tsubst_omp_clauses): Handle IF_PRESENT and FINALIZE.
2406         * semantics.c (finish_omp_clauses): Handle IF_PRESENT and FINALIZE.
2408 2018-06-20  Marek Polacek  <polacek@redhat.com>
2410         PR c++/86240
2411         * constexpr.c (cxx_eval_constant_expression): Handle ABSU_EXPR.
2412         (fold_simple_1): Likewise.
2413         * error.c (dump_expr): Likewise.
2415 2018-06-20  Nathan Sidwell  <nathan@acm.org>
2417         PR c++/85634
2418         * cp-tree.h (lookup_keep): Drop KEEP parm.
2419         (lookup_list_keep): Delete.
2420         (maybe_get_fns): Declare.
2421         * parser.c (cp_parser_primary_expression): Call lookup_keep here.
2422         (cp_parser_template_id): Not here ...
2423         * decl.c (cp_finish_decl): ... nor here ...
2424         * init.c (build_raw_new_expr): ... nor here ...
2425         * pt.c (process_template_parm): ... nor here ...
2426         * semantics.c (perform_koenig_lookup): Call lookup_keep.
2427         (finish_call_expr): Not here.
2428         * tree.c (ovl_cache): Delete.
2429         (ovl_make, ovl_copy): No cache.
2430         (lookup_keep): Always keep.
2431         (lookup_list_keep): Delete.
2432         (maybe_get_fns): New, broken out of ...
2433         (get_fns): ... here.  Call it.
2434         (built_min_nt_loc, build_min, build_min_non_dep): Drop lookup_keep.
2435         (build_min_nt_call_vec): Likewise.
2437 2018-06-19  Jason Merrill  <jason@redhat.com>
2439         * cp-tree.h (CONSTRUCTOR_NO_IMPLICIT_ZERO): Remove.
2440         * constexpr.c: Use CONSTRUCTOR_NO_CLEARING instead.
2442         PR c++/86182 - ICE with anonymous union passed to template.
2443         * pt.c (tsubst_expr) [DECL_EXPR]: Handle an anonymous union type
2444         used to declare a named variable.
2446 2018-06-18  Jason Merrill  <jason@redhat.com>
2448         * tree.c (cp_expr_location): New.
2449         * cp-tree.h (cp_expr_loc_or_loc): New.
2450         * call.c, cvt.c, constexpr.c, constraint.cc, cp-gimplify.c, decl.c,
2451         error.c, init.c, lex.c, parser.c, pt.c, semantics.c, typeck.c,
2452         typeck2.c: Use it instead of EXPR_LOC_OR_LOC.
2454         * parser.c (cp_parser_lambda_expression): Use a range for
2455         LAMBDA_EXPR_LOCATION.
2457         PR c++/86200 - ICE with unexpanded pack in lambda parameter.
2458         * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
2459         function type.
2461         PR c++/81060 - ICE with unexpanded parameter pack.
2462         * pt.c (check_for_bare_parameter_packs): Add loc parameter.
2463         * decl.c (grokdeclarator): Call it for qualifying_scope.
2465         PR c++/86171 - ICE with recursive alias instantiation.
2466         * pt.c (tsubst_decl): Handle recursive alias instantiation.
2468 2018-06-18  Paolo Carlini  <paolo.carlini@oracle.com>
2470         * decl.c (duplicate_decls): Consistently use DECL_SOURCE_LOCATION
2471         in errors about redefined default arguments; tidy.
2473 2018-06-16  Kugan Vivekanandarajah  <kuganv@linaro.org>
2475         * constexpr.c (potential_constant_expression_1): Handle ABSU_EXPR.
2476         * cp-gimplify.c (cp_fold): Likewise.
2478 2018-06-15  Jason Merrill  <jason@redhat.com>
2480         PR c++/86147 - wrong capture for template argument.
2481         * expr.c (mark_use): Look through NOP_EXPR.
2483         * name-lookup.c (do_pushtag): Don't look through complete types, but
2484         don't add to them either.  Get context from current_binding_level.
2485         * pt.c (tsubst_default_argument): Use push_to/pop_from_top_level.
2487         * decl.c (start_enum): Do compare dependent underlying type.
2489         PR c++/82882 - ICE with lambda in template default argument.
2490         * lambda.c (record_null_lambda_scope): New.
2491         * pt.c (tsubst_lambda_expr): Use it.
2492         * name-lookup.c (do_pushtag): Don't give a lambda DECL_CONTEXT of a
2493         function that isn't open.
2495         * tree.c (maybe_warn_parm_abi): Inform the location of the class.
2497 2018-06-14  Marek Polacek  <polacek@redhat.com>
2499         PR c++/86063
2500         * decl2.c (cp_check_const_attributes): Skip trees that are not
2501         TREE_LISTs.
2503 2018-06-14  Jakub Jelinek  <jakub@redhat.com>
2505         P0624R2 - Default constructible and assignable stateless lambdas
2506         * method.c (synthesized_method_walk): For C++2a don't mark
2507         sfk_constructor or sfk_copy_assignment as deleted if lambda has
2508         no lambda-captures.
2510 2018-06-14  Paolo Carlini  <paolo.carlini@oracle.com>
2512         * decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in
2513         OPT_Wshadow warning_at.
2514         (grokfndecl): Consistently use the location_t argument in
2515         literal operator diagnostic messages.
2516         (grokdeclarator): Use declspecs->locations[ds_storage_class]
2517         in error_at call.
2518         * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION
2519         in permerror call.
2521 2018-06-13  Jason Merrill  <jason@redhat.com>
2523         PR c++/86099 - ICE with trivial copy and non-trivial default ctor.
2524         * constexpr.c (instantiate_cx_fn_r): Don't synthesize trivial
2525         constructors.
2527         PR c++/86094 - wrong code with defaulted move ctor.
2528         * class.c (classtype_has_non_deleted_move_ctor): New.
2529         * tree.c (maybe_warn_parm_abi, type_has_nontrivial_copy_init):
2530         Handle v12 breakage.
2532 2018-06-12  Jason Merrill  <jason@redhat.com>
2534         PR c++/86098 - ICE with template placeholder for TTP.
2535         * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
2536         CLASS_PLACEHOLDER_TEMPLATE.
2538 2018-06-12  Paolo Carlini  <paolo.carlini@oracle.com>
2540         * decl2.c (coerce_new_type, coerce_delete_type): Add location_t
2541         parameter and adjust error_at calls.
2542         * decl.c (grok_op_properties): Adjust calls.
2543         * cp-tree.h (oerce_new_type, coerce_delete_type): Adjust decls.
2545 2018-06-12  Marek Polacek  <polacek@redhat.com>
2547         Core issue 1331 - const mismatch with defaulted copy constructor
2548         * class.c (check_bases_and_members): When checking a defaulted
2549         function, mark it as deleted rather than giving an error.
2551 2018-06-11  Jason Merrill  <jason@redhat.com>
2553         PR c++/85792 -Wctor-dtor-privacy and inherited constructor.
2554         * class.c (maybe_warn_about_overly_private_class): Handle inherited
2555         constructors.
2557         PR c++/85963 - -Wunused-but-set with ?: in template.
2558         * pt.c (tsubst_copy_and_build) [COND_EXPR]: Call mark_rvalue_use.
2560 2018-06-11  Paolo Carlini  <paolo.carlini@oracle.com>
2562         * decl.c (grok_op_properties): Consistently use the location
2563         of the decl; remove special casing of POSTINCREMENT_EXPR and
2564         POSTDECREMENT_EXPR wrt default arguments.
2566 2018-06-05  Jason Merrill  <jason@redhat.com>
2568         * constexpr.c (cxx_eval_binary_expression): Special case comparison
2569         of pointers to members of the same union.
2571 2018-06-11  Jason Merrill  <jason@redhat.com>
2573         PR c++/86094 - wrong code with defaulted move ctor.
2574         * tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.
2576 2018-06-10  Paolo Carlini  <paolo.carlini@oracle.com>
2578         * decl.c (grokfndecl): Use the location_t argument in two more places.
2580 2018-06-06  Marek Polacek  <polacek@redhat.com>
2582         PR c++/85977
2583         * pt.c (unify): If ELTTYPE has no deducible template parms, skip
2584         deduction from the list elements.
2585         (type_unification_real): Check convertibility of list elements.
2587 2018-06-06  Jason Merrill  <jason@redhat.com>
2589         PR c++/86060 - ICE on range for with -std=c++98.
2590         * parser.c (cp_parser_init_statement): Don't clobber *decl after
2591         pedwarn.
2593         PR c++/85710 - ICE with -Wmemset-elt-size.
2594         * semantics.c (finish_call_expr): Call warn_for_memset here.
2595         * parser.c (cp_parser_postfix_expression): Not here.
2596         (literal_integer_zerop): No longer static.
2597         * pt.c (build_non_dependent_expr): Don't wrap CONST_DECL.
2599 2018-06-05  Marek Polacek  <polacek@redhat.com>
2601         PR c++/85976
2602         * tree.c (cp_tree_equal): Handle USING_DECL.
2604 2018-06-05  Jason Merrill  <jason@redhat.com>
2606         PR c++/85731 - wrong error with qualified-id in template.
2607         * semantics.c (finish_qualified_id_expr): build_qualified_name
2608         for unbound names in the current class.
2610 2018-06-04  Jason Merrill  <jason@redhat.com>
2612         PR c++/61806 - missed SFINAE with partial specialization.
2613         * cp-tree.h (deferring_access_check_sentinel): Add deferring_kind
2614         parameter to constructor.
2615         * pt.c (instantiate_class_template_1): Enable access checking
2616         before call to most_specialized_partial_spec.
2618         PR c++/85765 - SFINAE and non-type default template arg.
2619         * pt.c (type_unification_real): Do full semantic processing if
2620         substituting a partial args list replaces all template parms.
2622 2018-06-03  Jason Merrill  <jason@redhat.com>
2624         PR c++/85739 - ICE with pointer to member template parm.
2625         * cvt.c (perform_qualification_conversions): Use cp_fold_convert.
2627 2018-06-02  Jason Merrill  <jason@redhat.com>
2629         PR c++/85761 - ICE with ill-formed use of const outer variable.
2630         * expr.c (mark_use): Handle location wrappers.
2632 2018-06-01  Jason Merrill  <jason@redhat.com>
2634         PR c++/85764 - bogus 'this' not captured error.
2635         * lambda.c (resolvable_dummy_lambda): Use nonlambda_method_basetype.
2636         (nonlambda_method_basetype): Handle NSDMI.
2638         CWG 1581: When are constexpr member functions defined?
2639         * constexpr.c (instantiate_cx_fn_r, instantiate_constexpr_fns): New.
2640         (cxx_eval_outermost_constant_expr): Call instantiate_constexpr_fns.
2642         PR c++/58281 - explicit instantiation of constexpr
2643         * pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.
2645         * pt.c (instantiate_decl): Any defaulted function is defined.
2647 2018-05-30  Jonathan Wakely  <jwakely@redhat.com>
2649         PR c++/77777
2650         * call.c (resolve_args): Use location of expression, not current input
2651         location.
2653 2018-05-30  Ville Voutilainen  <ville.voutilainen@gmail.com>
2655         Do not warn about zero-as-null when NULL is used.
2656         * call.c (conversion_null_warnings): Check for pointer
2657         types converted from zero constants.
2658         (convert_like_real): Add a warning sentinel at the end.
2659         * tree.c (maybe_warn_zero_as_null_pointer_constant): Also
2660         check null_node_p.
2662 2018-05-30  Jason Merrill  <jason@redhat.com>
2664         PR c++/85807 - ICE with call in template NSDMI.
2665         * init.c (get_nsdmi): Use push_to/pop_from_top_level.
2666         * tree.c (bot_manip): Don't set_flags_from_callee in a template.
2668         PR c++/85873 - constant initializer_list array not in .rodata.
2669         * tree.c (build_target_expr): Set TREE_READONLY.
2670         * call.c (set_up_extended_ref_temp): Set TREE_READONLY.
2672         * parser.c (cp_parser_check_condition_declarator): Handle
2673         cp_error_declarator.
2675 2018-05-30  Jonathan Wakely  <jwakely@redhat.com>
2677         * typeck.c (cxx_sizeof_or_alignof_type): Return size_one_node instead
2678         of using it in dead store.
2680 2018-05-29  Jason Merrill  <jason@redhat.com>
2682         PR c++/67445 - returning temporary initializer_list.
2683         PR c++/67711 - assigning from temporary initializer_list.
2684         PR c++/48562 - new initializer_list.
2685         * typeck.c (maybe_warn_about_returning_address_of_local): Also warn
2686         about returning local initializer_list.
2687         * cp-tree.h (AUTO_TEMP_NAME, TEMP_NAME_P): Remove.
2688         * call.c (build_over_call): Warn about assignment from temporary
2689         init_list.
2690         * init.c (build_new_1): Warn about 'new std::initializer_list'.
2691         (find_list_begin, maybe_warn_list_ctor): New.
2692         (perform_member_init): Use maybe_warn_list_ctor.
2694 2018-05-29  Marek Polacek  <polacek@redhat.com>
2696         PR c++/85883
2697         * init.c (build_new): Handle deducing a class with new
2698         with more than one argument.
2700 2018-05-29  Jakub Jelinek  <jakub@redhat.com>
2702         PR c++/85952
2703         * init.c (build_aggr_init): For structured binding initialized from
2704         array call mark_rvalue_use on the initializer.
2706 2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
2708         * decl2.c (start_static_storage_duration_function): Use
2709         splay_tree_delete_pointers.
2711 2018-05-25  Jason Merrill  <jason@redhat.com>
2713         PR c++/85815 - reference to member of enclosing template.
2714         * search.c (lookup_base): Use currently_open_class.
2715         (lookup_member): Use it regardless of -fconcepts.
2716         * parser.c (cp_parser_postfix_dot_deref_expression): Check it.
2718         CWG 616, 1213 - value category of subobject references.
2719         * tree.c (lvalue_kind): Fix handling of ARRAY_REF of pointer.
2721 2018-05-24  Jason Merrill  <jason@redhat.com>
2723         PR c++/85842 - -Wreturn-type, constexpr if and generic lambda.
2724         * pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
2725         generic lambda.
2727 2018-05-24  Ville Voutilainen  <ville.voutilainen@gmail.com>
2729         Pedwarn on a non-standard position of a C++ attribute.
2730         * parser.c (cp_parser_namespace_definition): Pedwarn about attributes
2731         after the namespace name.
2733 2018-05-24  Paolo Carlini  <paolo.carlini@oracle.com>
2735         * cp-tree.h (INDIRECT_TYPE_P): New.
2736         * call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
2737         joust): Use it instead of POINTER_TYPE_P.
2738         * class.c (update_vtable_entry_for_fn, find_flexarrays,
2739         * fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
2740         * constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
2741         * cxx_eval_increment_expression, potential_constant_expression_1):
2742         Likewise.
2743         * cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
2744         * cp-objcp-common.c (cxx_get_alias_set): Likewise.
2745         * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
2746         cp_ubsan_maybe_instrument_downcast): Likewise.
2747         * cvt.c (cp_convert_to_pointer, ocp_convert,
2748         cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
2749         * cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
2750         pp_cxx_offsetof_expression_1): Likewise.
2751         * decl.c (grokparms, static_fn_type): Likewise.
2752         * decl2.c (grokbitfield): Likewise.
2753         * error.c (dump_expr): Likewise.
2754         * except.c (initialize_handler_parm, check_noexcept_r): Likewise.
2755         * init.c (warn_placement_new_too_small): Likewise.
2756         * lambda.c (build_capture_proxy, add_capture): Likewise.
2757         * parser.c (cp_parser_omp_for_loop): Likewise.
2758         * pt.c (convert_nontype_argument, fn_type_unification,
2759         uses_deducible_template_parms, check_cv_quals_for_unify,
2760         dependent_type_p_r): Likewise.
2761         * search.c (check_final_overrider): Likewise.
2762         * semantics.c (handle_omp_array_sections, finish_omp_clauses,
2763         finish_omp_for): Likewise.
2764         * tree.c (cp_build_qualified_type_real): Likewise.
2765         * typeck.c (build_class_member_access_expr,
2766         finish_class_member_access_expr, build_x_indirect_ref,
2767         cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
2768         Likewise.
2770 2018-05-24  Jason Merrill  <jason@redhat.com>
2772         PR c++/85864 - literal template and default template arg.
2773         * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
2775 2018-05-24  Marek Polacek  <polacek@redhat.com>
2777         PR c++/85847
2778         * init.c (build_new_1): Use fold_non_dependent_expr.  Use a dedicated
2779         variable for its result.  Fix a condition.
2780         (build_new): Use fold_non_dependent_expr.  Tweak a condition.
2782 2018-05-23  Jason Merrill  <jason@redhat.com>
2784         Fix cast to rvalue reference from prvalue.
2785         * cvt.c (diagnose_ref_binding): Handle rvalue reference.
2786         * rtti.c (build_dynamic_cast_1): Don't try to build a reference to
2787         non-class type.  Handle xvalue argument.
2788         * typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
2789         rvalue reference.
2790         * semantics.c (finish_compound_literal): Do direct-initialization,
2791         not cast, to initialize a reference.
2793         CWG 616, 1213 - value category of subobject references.
2794         * tree.c (lvalue_kind): A reference to a subobject of a prvalue is
2795         an xvalue.
2796         * typeck2.c (build_m_component_ref): Likewise.
2797         * typeck.c (cp_build_addr_expr_1, lvalue_or_else): Remove diagnostic
2798         distinction between temporary and xvalue.
2800 2018-05-23  Marek Polacek  <polacek@redhat.com>
2802         Implement P0614R1, Range-based for statements with initializer.
2803         * parser.c (cp_parser_range_based_for_with_init_p): New.
2804         (cp_parser_init_statement): Use it.  Parse the optional init-statement
2805         for a range-based for loop.
2806         (cp_parser_skip_to_closing_parenthesis_1): Handle balancing ?:.
2808 2018-05-22  Jason Merrill  <jason@redhat.com>
2810         PR c++/81420 - not extending temporary lifetime.
2811         * call.c (extend_ref_init_temps_1): Handle ARRAY_REF.
2812         * class.c (build_base_path): Avoid redundant move of an rvalue.
2814         PR c++/85866 - error with .* in default template arg.
2815         * pt.c (tsubst_copy_and_build): Handle partial instantiation.
2817 2018-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
2819         * parser.c (cp_parser_parameter_declaration_list): Remove
2820         bool* parameter.
2821         (cp_parser_parameter_declaration_clause): Adjust.
2822         (cp_parser_cache_defarg): Likewise.
2824 2018-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
2826         PR c++/84588
2827         * parser.c (cp_parser_maybe_commit_to_declaration,
2828         cp_parser_check_condition_declarator): New.
2829         (cp_parser_simple_declaration): Use the first above.
2830         (cp_parser_condition): Use both the above; enforce
2831         [stmt.stmt]/2 about the declarator not specifying
2832         a function or an array; improve error-recovery.
2834 2018-05-20  Jason Merrill  <jason@redhat.com>
2836         PR libstdc++/85843 - warning in logic_error copy constructor.
2837         * class.c (type_has_user_nondefault_constructor): Check for a
2838         user-provided ctor, not user-declared.
2840 2018-05-19  Jason Merrill  <jason@redhat.com>
2842         * pt.c (tsubst_pack_expansion): Sorry rather than abort
2843         on __integer_pack as subexpression of pattern.
2845 2018-05-18  Jason Merrill  <jason@redhat.com>
2847         PR c++/58407 - deprecated implicit copy ops.
2848         * call.c (build_over_call): Warn about deprecated trivial fns.
2849         * class.c (classtype_has_user_copy_or_dtor): New.
2850         (type_build_ctor_call): Check TREE_DEPRECATED.
2851         (type_build_dtor_call): Likewise.
2852         * decl2.c (cp_warn_deprecated_use): Move from tree.c.
2853         Add checks.  Return bool.  Handle -Wdeprecated-copy.
2854         (mark_used): Use it.
2855         * decl.c (grokdeclarator): Remove redundant checks.
2856         * typeck2.c (build_functional_cast): Likewise.
2857         * method.c (lazily_declare_fn): Mark deprecated copy ops.
2858         * init.c (build_aggr_init): Only set TREE_USED if there are
2859         side-effects.
2861 2018-05-18  Cesar Philippidis  <cesar@codesourcery.com>
2863         PR c++/85782
2864         * cp-gimplify.c (cp_genericize_r): Call genericize_omp_for_stmt for
2865         OACC_LOOPs.
2867 2018-05-18  Richard Sandiford  <richard.sandiford@linaro.org>
2869         * constexpr.c (cxx_eval_constant_expression): Remove FMA_EXPR handling.
2870         (potential_constant_expression_1): Likewise.
2872 2018-05-16  Marek Polacek  <polacek@redhat.com>
2874         PR c++/85363
2875         * call.c (set_flags_from_callee): Handle AGGR_INIT_EXPRs too.
2876         * tree.c (bot_manip): Call set_flags_from_callee for
2877         AGGR_INIT_EXPRs too.
2879 2018-05-15  Jason Merrill  <jason@redhat.com>
2881         * cp-tree.h (cp_expr): Remove copy constructor.
2882         * mangle.c (struct releasing_vec): Declare copy constructor.
2884         * constexpr.c (cxx_eval_vec_init_1): Pass tf_none if ctx->quiet.
2886         PR c++/64372 - CWG 1560, gratuitous lvalue-rvalue conversion in ?:
2887         * call.c (build_conditional_expr_1): Don't force_rvalue when one arm
2888         is a throw-expression.
2890 2018-05-15  Paolo Carlini  <paolo.carlini@oracle.com>
2892         * cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.
2893         (FOR_EACH_CLONE): Update.
2894         * decl.c (grokdeclarator): Use it.
2895         * decl2.c (vague_linkage_p): Likewise.
2896         * mangle.c (mangle_decl): Likewise.
2897         * method.c (lazily_declare_fn): Likewise.
2898         * optimize.c (can_alias_cdtor, maybe_clone_body): Likewise.
2899         * repo.c (repo_emit_p): Likewise.
2900         * tree.c (decl_linkage): Likewise.
2902 2018-05-14  Jason Merrill  <jason@redhat.com>
2904         Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec.
2905         * tree.c (build_cp_fntype_variant): New.
2906         (build_ref_qualified_type, build_exception_variant)
2907         (strip_typedefs, cxx_copy_lang_qualifiers): Use it.
2908         (cxx_type_hash_eq, cp_check_qualified_type): Check
2909         TYPE_HAS_LATE_RETURN_TYPE.
2910         (cp_build_type_attribute_variant): Check cxx_type_hash_eq.
2911         (cp_build_qualified_type_real): No need to preserve C++ qualifiers.
2912         * class.c (build_clone): Use cxx_copy_lang_qualifiers.
2913         (adjust_clone_args): Likewise.
2914         * decl.c (grokfndecl): Add late_return_type_p parameter.  Use
2915         build_cp_fntype_variant.
2916         (grokdeclarator): Pass late_return_type_p to grokfndecl.
2917         (check_function_type): Use cxx_copy_lang_qualifiers.
2918         (static_fn_type): Use cxx_copy_lang_qualifiers.
2919         * decl2.c (build_memfn_type, maybe_retrofit_in_chrg)
2920         (cp_reconstruct_complex_type, coerce_new_type, coerce_delete_type)
2921         (change_return_type): Use cxx_copy_lang_qualifiers.
2922         * mangle.c (write_type): Use cxx_copy_lang_qualifiers.
2923         * parser.c (cp_parser_lambda_declarator_opt): Represent an explicit
2924         return type on the declarator like a normal trailing return type.
2925         * pt.c (tsubst_function_type): Use build_cp_fntype_variant.
2926         (copy_default_args_to_explicit_spec): Use cxx_copy_lang_qualifiers.
2927         * typeck.c (merge_types): Use build_cp_fntype_variant.
2929 2018-05-14  Paolo Carlini  <paolo.carlini@oracle.com>
2931         * cp-tree.h (TYPE_REF_P): New.
2932         (TYPE_OBJ_P, TYPE_REF_OBJ_P, TYPE_REFFN_P): Update.
2933         * call.c (build_list_conv, build_aggr_conv, standard_conversion,
2934         direct_reference_binding, reference_binding, implicit_conversion,
2935         add_builtin_candidate, build_user_type_conversion_1, build_op_call_1,
2936         build_new_op_1, build_x_va_arg, conv_binds_ref_to_prvalue,
2937         build_over_call, perform_implicit_conversion_flags,
2938         extend_ref_init_temps, type_has_extended_temps): Use it.
2939         * class.c (one_inheriting_sig, check_field_decls,
2940         check_bases_and_members, find_flexarrays, finish_struct,
2941         fixed_type_or_null): Likewise.
2942         * constexpr.c (literal_type_p, cxx_bind_parameters_in_call,
2943         non_const_var_error, cxx_eval_constant_expression,
2944         potential_constant_expression_1): Likewise.
2945         * cp-gimplify.c (omp_var_to_track, omp_cxx_notice_variable,
2946         cp_genericize_r, cxx_omp_privatize_by_reference,
2947         cxx_omp_const_qual_no_mutable, cxx_omp_finish_clause,
2948         cp_fold_maybe_rvalue): Likewise.
2949         * cp-ubsan.c (cp_ubsan_maybe_instrument_downcast): Likewise.
2950         * cvt.c (build_up_reference, convert_to_reference,
2951         convert_from_reference, convert_to_void, noexcept_conv_p,
2952         fnptr_conv_p): Likewise.
2953         * decl.c (poplevel, check_for_uninitialized_const_var,
2954         check_initializer, initialize_local_var, cp_finish_decl,
2955         get_tuple_decomp_init, cp_finish_decomp, grokdeclarator, copy_fn_p,
2956         move_signature_fn_p, grok_op_properties, finish_function): Likewise.
2957         * decl2.c (grok_array_decl, cp_reconstruct_complex_type,
2958         decl_maybe_constant_var_p): Likewise.
2959         * error.c (dump_type_prefix, dump_expr): Likewise.
2960         * except.c (initialize_handler_parm, complete_ptr_ref_or_void_ptr_p,
2961         is_admissible_throw_operand_or_catch_parameter): Likewise.
2962         * expr.c (mark_use): Likewise.
2963         * init.c (build_zero_init_1, build_value_init_noctor,
2964         perform_member_init, diagnose_uninitialized_cst_or_ref_member_1,
2965         build_new, build_delete): Likewise.
2966         * lambda.c (build_lambda_object): Likewise.
2967         * mangle.c (write_expression, write_template_arg): Likewise.
2968         * method.c (forward_parm, do_build_copy_constructor,
2969         do_build_copy_assign, build_stub_object, constructible_expr,
2970         walk_field_subobs): Likewise.
2971         * parser.c (cp_parser_omp_for_loop_init,
2972         cp_parser_omp_declare_reduction_exprs,
2973         cp_parser_omp_declare_reduction): Likewise.
2974         * pt.c (convert_nontype_argument_function, convert_nontype_argument,
2975         convert_template_argument, tsubst_pack_expansion,
2976         tsubst_function_decl, tsubst_decl, tsubst, tsubst_copy_and_build,
2977         maybe_adjust_types_for_deduction, check_cv_quals_for_unify, unify,
2978         more_specialized_fn, invalid_nontype_parm_type_p, dependent_type_p_r,
2979         value_dependent_expression_p, build_deduction_guide): Likewise.
2980         * semantics.c (finish_handler_parms, finish_non_static_data_member,
2981         finish_compound_literal, omp_privatize_field,
2982         handle_omp_array_sections_1, handle_omp_array_sections,
2983         cp_check_omp_declare_reduction, finish_omp_reduction_clause,
2984         finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink,
2985         finish_omp_clauses, finish_decltype_type, capture_decltype,
2986         finish_builtin_launder): Likewise.
2987         * tree.c (lvalue_kind, cp_build_reference_type, move,
2988         cp_build_qualified_type_real, stabilize_expr, stabilize_init): Likewise.
2989         * typeck.c (cxx_safe_arg_type_equiv_p, build_class_member_access_expr,
2990         cp_build_indirect_ref_1, convert_arguments, warn_for_null_address,
2991         cp_build_addr_expr_1, maybe_warn_about_useless_cast,
2992         build_static_cast_1, build_static_cast, build_reinterpret_cast_1,
2993         build_const_cast_1, cp_build_c_cast, cp_build_modify_expr,
2994         convert_for_initialization,
2995         maybe_warn_about_returning_address_of_local, check_return_expr,
2996         cp_type_quals, casts_away_constness, non_reference): Likewise.
2997         * typeck2.c (cxx_readonly_error, store_init_value,
2998         process_init_constructor_record, build_x_arrow, build_functional_cast,
2999         add_exception_specifier): Likewise.
3001 2018-05-14  Jason Merrill  <jason@redhat.com>
3003         * pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p.
3004         (tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl.
3006 2018-05-11  Jakub Jelinek  <jakub@redhat.com>
3008         PR c/85696
3009         * cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
3010         * cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
3011         cxx_omp_predetermined_sharing_1.  Rename old function to ...
3012         (cxx_omp_predetermined_sharing_1): ... this.
3013         * semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
3014         instead of cxx_omp_predetermined_sharing.
3016 2018-05-10  Jason Merrill  <jason@redhat.com>
3018         * decl.c (cp_finish_decl): Don't instantiate auto variable.
3019         (check_static_variable_definition): Allow auto.
3020         * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
3022         * cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
3023         (DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.
3025         Core issue 2310 - conversion to base of incomplete type.
3026         * class.c (build_base_path): Check COMPLETE_TYPE_P for source type.
3028         CWG 2267 - list-initialization of reference temporary
3029         * call.c (reference_binding): List-initializing a reference
3030         temporary is copy-list-initialization.
3032         * parser.c (cp_parser_class_head): Use num_template_headers_for_class.
3034         * pt.c (instantiate_decl): Make sure we aren't trying to do a nested
3035         instantiation in template context.
3037         * class.c (vbase_has_user_provided_move_assign): Use
3038         user_provided_p.
3040         * lambda.c (lambda_expr_this_capture): Improve logic.
3042         * decl.c (make_typename_type): s/parameters/arguments/.
3043         * parser.c (cp_parser_nested_name_specifier_opt): Likewise.
3044         * pt.c (make_pack_expansion): Correct error message.
3046 2018-05-10  Jakub Jelinek  <jakub@redhat.com>
3048         PR c++/85662
3049         * cp-gimplify.c (cp_fold): Use fold_offsetof rather than
3050         fold_offsetof_1, pass TREE_TYPE (x) as TYPE to it and drop the
3051         fold_convert.
3053 2018-05-10  Eric Botcazou  <ebotcazou@adacore.com>
3055         PR c++/85400
3056         * decl2.c (adjust_var_decl_tls_model): New static function.
3057         (comdat_linkage): Call it on a variable.
3058         (maybe_make_one_only): Likewise.
3060 2018-05-09  Paolo Carlini  <paolo.carlini@oracle.com>
3062         PR c++/85713
3063         Revert:
3064         2018-05-08  Paolo Carlini  <paolo.carlini@oracle.com>
3066         PR c++/84588
3067         * parser.c (cp_parser_parameter_declaration_list): When the
3068         entire parameter-declaration-list is erroneous maybe call
3069         abort_fully_implicit_template.
3071 2018-05-08  Jason Merrill  <jason@redhat.com>
3073         PR c++/85706 - class deduction under decltype
3074         * pt.c (for_each_template_parm_r): Handle DECLTYPE_TYPE.  Clear
3075         *walk_subtrees whether or not we walked into the operand.
3076         (type_uses_auto): Only look at deduced contexts.
3078 2018-05-08  Paolo Carlini  <paolo.carlini@oracle.com>
3080         PR c++/84588
3081         * parser.c (cp_parser_parameter_declaration_list): When the
3082         entire parameter-declaration-list is erroneous maybe call
3083         abort_fully_implicit_template.
3085 2018-05-08  Marek Polacek  <polacek@redhat.com>
3087         PR c++/85695
3088         * semantics.c (finish_if_stmt_cond): See through typedefs.
3090 2018-05-07  Jason Merrill  <jason@redhat.com>
3092         PR c++/85646 - lambda visibility.
3093         * decl2.c (determine_visibility): Don't mess with template arguments
3094         from the containing scope.
3095         (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor
3096         thunk.
3098 2018-05-07  Nathan Sidwell  <nathan@acm.org>
3100         Remove fno-for-scope
3101         * cp-tree.h (DECL_ERROR_REPORTED, DECL_DEAD_FOR_LOCAL)
3102         (DECL_HAS_SHADOWED_FOR_VAR_P, DECL_SHADOWED_FOR_VAR)
3103         (SET_DECL_SHADOWED_FOR_VAR): Delete.
3104         (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
3105         (check_for_out_of_scope_variable, init_shadowed_var_for_decl):
3106         Don't declare.
3107         * name-lookup.h (struct cp_binding_level): Remove
3108         dead_vars_from_for field.
3109         * cp-lang.c (cp_init_ts): Delete.
3110         (LANG_HOOKS_INIT_TS): Override to cp_common_init_ts.
3111         * cp-objcp-common.c (shadowed_var_for_decl): Delete.
3112         (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
3113         (init_shadowed_var_for_decl): Delete.
3114         * decl.c (poplevel): Remove shadowed for var handling.
3115         (cxx_init_decl_processing): Remove -ffor-scope deprecation.
3116         * name-lookup.c (find_local_binding): Remove shadowed for var
3117         handling.
3118         (check_local_shadow): Likewise.
3119         (check_for_out_of_scope_variable): Delete.
3120         * parser.c (cp_parser_primary_expression): Remove shadowed for var
3121         handling.
3122         * pt.c (tsubst_decl): Remove DECL_DEAD_FOR_LOCAL setting.
3123         * semantics.c (begin_for_scope): Always have a scope.
3124         (begin_for_stmt, finish_for_stmt): Remove ARM-for scope handling.
3125         (begin_range_for_stmt, finish_id_expression): Likewise.
3127 2018-05-07  Jason Merrill  <jason@redhat.com>
3129         PR c++/85618 - ICE with initialized VLA.
3130         * tree.c (vla_type_p): New.
3131         * typeck2.c (store_init_value, split_nonconstant_init_1): Check it
3132         rather than array_of_runtime_bound_p.
3134 2018-05-05  Paolo Carlini  <paolo.carlini@oracle.com>
3136         * cvt.c (ocp_convert): Early handle the special case of a
3137         null_ptr_cst_p expr converted to a NULLPTR_TYPE_P type.
3139 2018-05-03  Jason Merrill  <jason@redhat.com>
3141         PR c++/85600 - virtual delete failure.
3142         * init.c (build_delete): Always save_expr when deleting.
3144 2018-05-03  Nathan Sidwell  <nathan@acm.org>
3146         * decl.c (cxx_init_decl_processing): Remove flag_friend_injection.
3147         * name-lookup.c (do_pushdecl): Likewise.
3149 2018-05-02  Paolo Carlini  <paolo.carlini@oracle.com>
3150             Jason Merrill  <jason@redhat.com>
3152         PR c++/68374
3153         * name-lookup.c (check_local_shadow): Don't handle static old
3154         declarations in the block handling locals shadowing locals.
3156 2018-05-01  Jason Merrill  <jason@redhat.com>
3158         PR c++/85587 - error with scoped enum in template.
3159         * semantics.c (finish_qualified_id_expr): Don't return an
3160         unqualified IDENTIFIER_NODE.
3162 2018-04-30  Jason Merrill  <jason@redhat.com>
3164         PR c++/85580 - extern "C" and local variables
3165         * name-lookup.c (check_extern_c_conflict): Ignore local decls.
3167         PR c++/84701 - unsigned typeof.
3168         * decl.c (grokdeclarator): Overhaul diagnostics for invalid use
3169         of long/short/signed/unsigned.
3171         PR c++/85305 - pack in lambda init-capture.
3172         * parser.c (cp_parser_initializer): Add subexpression_p parm; don't
3173         check_for_bare_parameter_packs in a subexpression.
3174         (cp_parser_lambda_introducer): Use it.
3176         PR c++/61982 - dead stores to destroyed objects.
3177         * call.c (build_trivial_dtor_call): New, assigns a clobber.
3178         (build_over_call, build_special_member_call): Use it.
3179         * cp-tree.h: Declare it.
3180         * init.c (build_delete): Remove trivial path.
3182         * init.c (build_dtor_call): Use build_special_member_call.
3183         (build_delete): Remove redundant uses of save_addr.
3185         * decl.c (build_clobber_this): Use build_clobber.
3187 2018-04-27  Jakub Jelinek  <jakub@redhat.com>
3189         PR c++/85553
3190         * init.c (build_zero_init_1): For zero initialization of
3191         NULLPTR_TYPE_P type use build_int_cst directly.
3193 2018-04-27  David Malcolm  <dmalcolm@redhat.com>
3195         PR c++/85515
3196         * name-lookup.c (consider_binding_level): Skip compiler-generated
3197         variables.
3198         * search.c (lookup_field_fuzzy_info::fuzzy_lookup_field): Flatten
3199         nested if statements into a series of rejection tests.  Reject
3200         lambda-ignored entities as suggestions.
3202 2018-04-27  Jason Merrill  <jason@redhat.com>
3204         * cvt.c (cp_fold_convert): Use convert_ptrmem.
3205         * typeck.c (convert_ptrmem): Add a NOP even if no adjustment.
3207 2018-04-27  Paolo Carlini  <paolo.carlini@oracle.com>
3209         PR c++/84691
3210         * decl.c (grokdeclarator): Clear friendp upon definition in local
3211         class definition error.
3213 2018-04-27  Jason Merrill  <jason@redhat.com>
3215         PR c++/85545 - ICE with noexcept PMF conversion.
3216         * cvt.c (cp_fold_convert): Pass PMF CONSTRUCTORs to
3217         build_ptrmemfunc.
3218         * typeck.c (build_ptrmemfunc): Don't build a NOP_EXPR for zero
3219         adjustment.
3220         (build_ptrmemfunc_access_expr): Special-case CONSTRUCTORs.
3222 2018-04-27  Nathan Sidwell  <nathan@acm.org>
3224         * typeck.c (convert_ptrmem): Move local var decls to initialization.
3226         * cp-tree.h (TEMPLATE_INFO): Fix comments.
3227         (TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO.
3228         (NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line.
3229         (dump, print_other_binding_stacks): Remove declarations.
3230         * name-lookup.c (print_other_binding_stack): Make static.
3231         * pt.c (build_template_decl): Make static.
3233 2018-04-26  Jason Merrill  <jason@redhat.com>
3235         PR c++/85545 - ICE with noexcept PMF conversion.
3236         * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly.
3238 2018-04-25  Nathan Sidwell  <nathan@acm.org>
3240         PR c++/85437
3241         PR c++/49171
3242         * cp-tree.h (REINTERPRET_CAST_P): New.
3243         * constexpr.c (cxx_eval_constant_expression) <case NOP_EXPR>:
3244         Reject REINTERPET_CAST_P conversions.  Use cplus_expand_constant
3245         for non-trivial PTRMEM_CST cases.
3246         * typeck.c (build_nop_reinterpret): New.
3247         (build_reinterpret_cast_1): Use it.  Set REINTERPRET_CAST_P on
3248         NOP_EXPRs returned by cp_convert.
3250 2018-04-23  Jason Merrill  <jason@redhat.com>
3252         PR c++/69560 - wrong alignof(double) on x86.
3253         CWG 1879 - Inadequate definition of alignment requirement.
3254         * cp-tree.h (ALIGNOF_EXPR_STD_P): New.
3255         * typeck.c (cxx_sizeof_or_alignof_type): Add std_alignof parm.
3256         (cxx_sizeof_expr, cxx_sizeof_nowarn, cxx_alignas_expr)
3257         (cxx_alignof_expr): Pass it.
3258         * parser.c (cp_parser_unary_expression): Pass it.
3259         * pt.c (tsubst_copy): Copy it.
3260         (tsubst_copy_and_build): Pass it.
3261         * decl.c (fold_sizeof_expr): Pass it.
3263 2018-04-23  Jakub Jelinek  <jakub@redhat.com>
3264             Jason Merrill  <jason@redhat.com>
3266         PR c++/85470 - wrong error with static data member.
3267         * decl.c (check_initializer): Check DECL_INITIALIZED_IN_CLASS_P.
3268         * typeck2.c (store_init_value): Likewise.
3270 2018-04-20  Jakub Jelinek  <jakub@redhat.com>
3272         PR c++/85462
3273         * cp-tree.h (tinst_level): Remove in_system_header_p member,
3274         change refcount member from unsigned char to unsigned short,
3275         add refcount_infinity static data member, adjust comments.
3276         * pt.c (tinst_level::refcount_infinity): Define.
3277         (inc_refcount_use): Remove assert, don't increment if refcount
3278         is already refcount_infinity, adjust comment.
3279         (dec_refcount_use): Remove assert, don't decrement if refcount
3280         is refcount_infinity, adjust comment.
3281         (push_tinst_level_loc): Formatting fix.
3283 2018-04-19  Paolo Carlini  <paolo.carlini@oracle.com>
3285         PR c++/84611
3286         * pt.c (lookup_template_class_1): Check pushtag return value for
3287         error_mark_node.
3289 2018-04-19  Alexandre Oliva  <aoliva@redhat.com>
3291         PR c++/80290
3292         * cp-tree.h (tinst_level::free): Fix whitespace.
3294 2018-04-18  Paolo Carlini  <paolo.carlini@oracle.com>
3296         PR c++/84630
3297         * pt.c (tsubst_lambda_expr): Check begin_lambda_type return value
3298         for error_mark_node.
3300 2018-04-18  Jakub Jelinek  <jakub@redhat.com>
3302         PR c++/84463
3303         * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like
3304         tricks from here to ...
3305         * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here.  Only use it
3306         if INDIRECT_REF's operand is INTEGER_CST cast to pointer type.
3308 2018-04-18  Alexandre Oliva  <aoliva@redhat.com>
3310         PR c++/80290
3311         * cp-tree.h (struct tinst_level): Split decl into tldcl and
3312         targs.  Add private split_list_p, tree_list_p, and not_list_p
3313         inline const predicates; to_list private member function
3314         declaration; free public member function declaration; list_p,
3315         get_node and maybe_get_node accessors, and refcount data
3316         member.  Narrow errors to unsigned short.
3317         * error.c (print_instantiation_full_context): Use new
3318         accessors.
3319         (print_instantiation_partial_context_line): Likewise.  Drop
3320         const from tinst_level-typed parameter.
3321         * mangle.c (mangle_decl_string): Likewise.
3322         * pt.c (freelist): New template class.
3323         (tree_list_freelist_head): New var.
3324         (tree_list_freelist): New fn, along with specializations.
3325         (tinst_level_freelist_head): New var.
3326         (pending_template_freelist_head): Likewise.
3327         (tinst_level_freelist, pending_template_freelist): New fns.
3328         (tinst_level::to_list, tinst_level::free): Define.
3329         (inc_refcount_use, dec_refcount_use): New fns for tinst_level.
3330         (set_refcount_ptr): New template fn.
3331         (add_pending_template): Adjust for refcounting, freelists and
3332         new accessors.
3333         (neglectable_inst_p): Take a NULL d as a non-DECL.
3334         (limit_bad_template_recursion): Use new accessors.
3335         (push_tinst_level): New overload to create the list.
3336         (push_tinst_level_loc): Make it static, split decl into two
3337         args, adjust tests and initialization to cope with split
3338         lists, use freelist, adjust for refcounting.
3339         (push_tinst_level_loc): New wrapper with the old interface.
3340         (pop_tinst_level): Adjust for refcounting.
3341         (record_last_problematic_instantiation): Likewise.
3342         (reopen_tinst_level): Likewise.  Use new accessors.
3343         (instantiate_alias_template): Adjust for split list.
3344         (fn_type_unification): Likewise.
3345         (get_partial_spec_bindings): Likewise.
3346         (instantiate_pending_templates): Use new accessors.  Adjust
3347         for refcount.  Release pending_template to freelist.
3348         (instantiating_current_function_p): Use new accessors.
3350 2018-04-16  Alexandre Oliva  <aoliva@redhat.com>
3352         PR c++/85039
3353         * parser.c (cp_parser_builtin_offset): Reject type definitions.
3354         * mangle.c (nested_anon_class_index): Avoid crash returning -1
3355         if we've seen errors.
3357 2018-04-12  David Malcolm  <dmalcolm@redhat.com>
3359         PR c++/85385
3360         * name-lookup.c (macro_use_before_def::maybe_make): New function,
3361         checking that the use is indeed before the definition.
3362         (macro_use_before_def::macro_use_before_def): Make private.
3363         (macro_use_before_def::~macro_use_before_def): Make private.  Move
3364         check for UNKNOWN_LOCATION to macro_use_before_def::maybe_make.
3365         (lookup_name_fuzzy): Call macro_use_before_def::maybe_make rather
3366         than using new directly.
3368 2018-04-12  Jason Merrill  <jason@redhat.com>
3370         PR c++/85356 - ICE with pointer to member function.
3371         * pt.c (maybe_instantiate_noexcept): Do instantiate in templates if
3372         flag_noexcept_type.  Build the new spec within the function context.
3373         * except.c (build_noexcept_spec): Do get constant value in templates
3374         if flag_noexcept_type.
3375         * decl.c (check_redeclaration_exception_specification): Don't
3376         instantiate noexcept on a dependent declaration.
3378 2018-04-12  Marek Polacek  <polacek@redhat.com>
3380         PR c++/85258
3381         * constexpr.c (reduced_constant_expression_p): Return false for null
3382         trees.
3384 2018-04-11  Marek Polacek  <polacek@redhat.com>
3386         PR c++/85032
3387         * constexpr.c (potential_constant_expression_1): Consider conversions
3388         from classes to literal types potentially constant.
3390 2018-04-10  Paolo Carlini  <paolo.carlini@oracle.com>
3392         PR c++/70808
3393         * init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
3394         the type like TYPE_PTR_OR_PTRMEM_P.
3396 2018-04-10  Jason Merrill  <jason@redhat.com>
3398         PR debug/65821 - wrong location for main().
3399         * call.c (clear_location_r, convert_default_arg): Revert.
3400         * tree.c (break_out_target_exprs): Add clear_location parm.
3401         (struct bot_data): New.
3402         (bot_manip): Clear location if requested.
3403         * init.c (get_nsdmi): Pass clear_location.
3405 2018-04-10  David Malcolm  <dmalcolm@redhat.com>
3407         PR c++/85110
3408         * call.c (get_fndecl_argument_location): Make non-static.
3409         * cp-tree.h (get_fndecl_argument_location): New decl.
3410         * typeck.c (convert_for_assignment): When complaining due to
3411         conversions for an argument, show the location of the parameter
3412         within the decl.
3414 2018-04-10  Jakub Jelinek  <jakub@redhat.com>
3416         PR c++/85312 - P0962 cleanup
3417         * parser.c (cp_parser_perform_range_for_lookup): Remove unreachable
3418         diagnostics.
3420 2018-04-10  Jason Merrill  <jason@redhat.com>
3422         PR debug/65821 - wrong location for main().
3423         * call.c (clear_location_r): New.
3424         (convert_default_arg): Use it.
3425         * tree.c (bot_manip): Remove builtin_LINE/FILE handling.
3427         PR c++/85285 - ICE with flexible array after substitution.
3428         * pt.c (instantiate_class_template_1): Check for flexible array in
3429         union.
3431 2018-04-09  Paolo Carlini  <paolo.carlini@oracle.com>
3433         PR c++/85227
3434         * decl.c (cp_finish_decomp): In a template, if the type is incomplete
3435         issue a pedwarn and defer trying to do bindings.
3437 2018-04-09  Jason Merrill  <jason@redhat.com>
3439         PR c++/85279 - dump_expr doesn't understand decltype.
3440         * error.c (dump_expr): Handle DECLTYPE_TYPE.
3442         PR c++/85262 - ICE with redundant qualification on constructor.
3443         * call.c (build_new_method_call_1): Move make_args_non_dependent
3444         after A::A() handling.
3446         PR c++/85277 - ICE with invalid offsetof.
3447         * semantics.c (finish_offsetof): Avoid passing non-DECL to %qD.
3448         Adjust -Winvalid-offsetof diagnostic to say conditionally supported.
3450         PR c++/85264 - ICE with excess template-parameter-list.
3451         * parser.c (cp_parser_check_template_parameters): Add template_id_p
3452         parameter.  Don't allow an extra template header if true.
3453         (cp_parser_class_head): Pass template_id_p.
3454         (cp_parser_elaborated_type_specifier): Likewise.
3455         (cp_parser_alias_declaration): Likewise.
3456         (cp_parser_check_declarator_template_parameters): Likewise.
3458 2018-04-09  Jakub Jelinek  <jakub@redhat.com>
3460         PR c++/85194
3461         * parser.c (cp_parser_simple_declaration): For structured bindings,
3462         if *maybe_range_for_decl is NULL after parsing it, set it to
3463         error_mark_node.
3465 2018-04-09  Jason Merrill  <jason@redhat.com>
3467         PR c++/85256 - ICE capturing pointer to VLA.
3468         * lambda.c (add_capture): Distinguish between variable-size and
3469         variably-modified types.
3471 2018-04-06  Jason Merrill  <jason@redhat.com>
3473         PR c++/85214 - ICE with alias, generic lambda, constexpr if.
3474         * pt.c (extract_locals_r): Remember local typedefs.
3476 2018-04-06  David Malcolm  <dmalcolm@redhat.com>
3478         PR c++/84269
3479         * name-lookup.c (struct std_name_hint): Move out of
3480         get_std_name_hint; add field "min_dialect".
3481         (get_std_name_hint): Add min_dialect values to all initializers.
3482         Add <any>, <atomic>, <bitset>, <condition_variable>, <functional>,
3483         <future>, <istream>, <iterator>, <ostream>, <mutex>, <optional>,
3484         <shared_mutex>, <string_view>, <thread>, and <variant>.
3485         Add fstream, ifstream, and ofstream to <fstream>.
3486         Add istringstream, ostringstream, and stringstream to <sstream>.
3487         Add basic_string to <string>.
3488         Add tuple_element and tuple_size to <tuple>.
3489         Add declval to <utility>.
3490         Fix ordering of <queue> and <tuple>.
3491         Return a std_name_hint, rather than a const char *.
3492         (get_cxx_dialect_name): New function.
3493         (maybe_suggest_missing_std_header): Detect names that aren't yet
3494         available in the current dialect, and instead of suggesting a
3495         missing #include, warn about the dialect.
3497 2018-04-06  Jakub Jelinek  <jakub@redhat.com>
3499         PR c++/85210
3500         * pt.c (tsubst_decomp_names): Return error_mark_node and assert
3501         errorcount is set if tsubst doesn't return a VAR_DECL.
3503 2018-04-06  David Malcolm  <dmalcolm@redhat.com>
3505         PR c++/85021
3506         * name-lookup.c (using_directives_contain_std_p): New function.
3507         (has_using_namespace_std_directive_p): New function.
3508         (suggest_alternatives_for): Simplify if/else logic using early
3509         returns.  If no candidates were found, and there's a
3510         "using namespace std;" directive, call
3511         maybe_suggest_missing_std_header.
3512         (maybe_suggest_missing_header): Split later part of the function
3513         into..
3514         (maybe_suggest_missing_std_header): New.
3516 2018-04-06  Jason Merrill  <jason@redhat.com>
3518         PR c++/85242 - ICE with class definition in template parm.
3519         * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): False if
3520         processing_template_parmlist.
3522         PR c++/85240 - LTO ICE with using of undeduced auto fn.
3523         * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto.
3525 2018-04-05  Jakub Jelinek  <jakub@redhat.com>
3527         PR c++/85209
3528         * pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
3529         is not prev, if prev == decl.
3531         PR c++/85208
3532         * decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
3533         maybe_apply_pragma_weak here...
3534         (cp_maybe_mangle_decomp): ... but call it here instead.
3536 2018-04-05  Jason Merrill  <jason@redhat.com>
3538         PR c++/85136 - ICE with designated init in template.
3539         * decl.c (maybe_deduce_size_from_array_init): Handle dependent
3540         designated initializer.
3541         (check_array_designated_initializer): Update ce->index with the
3542         constant value.
3544         PR c++/83808 - ICE with VLA initialization.
3545         * typeck2.c (process_init_constructor_array): Don't require a VLA
3546         initializer to have VLA type.
3548 2018-04-05  Paolo Carlini  <paolo.carlini@oracle.com>
3550         PR c++/80956
3551         * call.c (convert_like_real): Fail gracefully for a broken
3552         std::initializer_list, missing a definition.
3554         * name-lookup.c (do_pushtag): Tweak message, use %< and %>.
3556 2018-04-05  Paolo Carlini  <paolo.carlini@oracle.com>
3558         PR c++/84792
3559         * decl.c (grokdeclarator): Fix diagnostic about typedef name used
3560         as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
3562 2018-04-05  Jason Merrill  <jason@redhat.com>
3564         PR c++/82152 - ICE with class deduction and inherited ctor.
3565         * pt.c (do_class_deduction): Ignore inherited ctors.
3567         PR c++/84665 - ICE with array of empty class.
3568         * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
3570         PR c++/85228 - ICE with lambda in enumerator in template.
3571         * pt.c (bt_instantiate_type_proc): Don't assume
3572         CLASSTYPE_TEMPLATE_INFO is non-null.
3574 2018-04-05  Ville Voutilainen  <ville.voutilainen@gmail.com>
3576         Implement P0969
3577         * decl.c (find_decomp_class_base): Check accessibility instead
3578         of declared access, adjust diagnostic.
3580 2018-04-05  Ville Voutilainen  <ville.voutilainen@gmail.com>
3582         Implement P0961
3583         * decl.c (get_tuple_decomp_init): Check the templatedness
3584         of a member get.
3586 2018-04-05  Jason Merrill  <jason@redhat.com>
3588         PR c++/85200 - ICE with constexpr if in generic lambda.
3589         * pt.c (extract_locals_r): Don't record the local specs of variables
3590         declared within the pattern.
3592 2018-04-05  Alexandre Oliva  <aoliva@redhat.com>
3594         PR c++/84979
3595         * pt.c (check_auto_in_tmpl_args): New.
3596         (tsubst_qualified_id): Use it to reject template args
3597         referencing auto for non-type templates.
3598         * parser.c (cp_parser_template_id): Likewise.
3599         * cp-tree.h (check_auto_in_tmpl_args): Declare.
3600         * typeck2.c (build_functional_cast): Report correct location
3601         for invalid use of auto.
3603 2018-04-04  Jason Merrill  <jason@redhat.com>
3605         PR c++/85215 - ICE with copy-init from conversion.
3606         * call.c (merge_conversion_sequences): Fix type of direct binding
3607         sequence.
3609         PR c++/84938 - ICE with division by ~-1.
3610         * call.c (set_up_extended_ref_temp): Call cp_fully_fold.
3612         PR c++/84936 - ICE with unexpanded pack in mem-initializer.
3613         * parser.c (cp_parser_mem_initializer_list): Call
3614         check_for_bare_parameter_packs.
3616 2018-04-04  Jakub Jelinek  <jakub@redhat.com>
3618         PR inline-asm/85172
3619         * constexpr.c (cxx_eval_builtin_function_call): For calls to
3620         builtin_valid_in_constant_expr_p functions, don't call
3621         cxx_eval_constant_expression if argument is not
3622         potential_constant_expression.
3624         PR c++/85146
3625         * cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
3626         argument.
3627         * semantics.c (calculate_bases): Add complain argument.  Use
3628         complete_type_or_maybe_complain instead of just complete_type and
3629         return an empty vector if it fails.  Move make_tree_vector () call
3630         after early return.  Formatting fixes.
3631         (calculate_direct_bases): Likewise.  Call release_tree_vector at the
3632         end.
3633         (dfs_calculate_bases_post, calculate_bases_helper): Formatting fixes.
3634         * pt.c (tsubst_pack_expansion): Adjust calculate_bases and
3635         calculate_direct_bases callers, formatting fixes.
3637 2018-04-04  Jason Merrill  <jason@redhat.com>
3639         PR c++/85006 - -fconcepts ICE with A<auto...> return type
3640         * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
3642         PR c++/85200 - ICE with constexpr if in generic lambda.
3643         * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
3645         PR c++/84221 - bogus -Wunused with attribute and template.
3646         * decl2.c (is_late_template_attribute): Handle unused and used
3647         normally on non-TYPE_DECL.
3649         PR c++/85135 - ICE with omitted template arguments.
3650         * decl.c (grokdeclarator): Catch deduced class type in trailing
3651         return type.
3653         PR c++/85133 - ICE with missing concept initializer.
3654         * decl.c (cp_finish_decl): If a concept initializer is missing, use
3655         true.
3657         PR c++/85118 - wrong error with generic lambda and std::bind.
3658         * call.c (add_template_conv_candidate): Disable if there are any
3659         call operators.
3661         PR c++/85141 - ICE with compound assignment and static member fn.
3662         * typeck.c (cp_build_modify_expr): Call decay_conversion for RHS of
3663         compound assignment.
3665         PR c++/85148 - ICE with 'this' in array NSDMI.
3666         * tree.c (replace_placeholders_r): Use handled_component_p.
3668 2018-04-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
3670         PR c++/65923
3671         * decl.c (grokfndecl): Handle standard UDL diagnostics here..
3672         * parser.c (cp_parser_unqualified_id): ..not here.
3674 2018-04-04  Alexandre Oliva  <aoliva@redhat.com>
3676         PR c++/84943
3677         * typeck.c (cp_build_addr_expr_1): Mark FUNCTION_DECL as
3678         used.
3679         * decl2.c (mark_used): Return without effects if tf_conv.
3681 2018-04-03  Jason Merrill  <jason@redhat.com>
3683         PR c++/85092 - C++17 ICE with unused list constructor.
3684         * call.c (conv_binds_ref_to_prvalue): Also count ck_identity
3685         from a TARGET_EXPR.
3687         PR c++/85113 - ICE with constexpr and __builtin_constant_p.
3688         * constexpr.c (cxx_eval_builtin_function_call): Only defer
3689         __builtin_constant_p if ctx->quiet.
3691 2018-04-03  Paolo Carlini  <paolo.carlini@oracle.com>
3693         PR c++/84768
3694         * pt.c (rewrite_template_parm): If the first argument is
3695         error_mark_node return it immediately.
3696         (build_deduction_guide): Check the return value of the
3697         latter for error_mark_node.
3698         (do_class_deduction): Check the return value of the latter.
3700 2018-04-03  Jason Merrill  <jason@redhat.com>
3702         * semantics.c (finish_if_stmt_cond): Use
3703         instantiation_dependent_expression_p.
3705         PR c++/85149 - generic lambda and constexpr if.
3706         * pt.c (build_extra_args, add_extra_args): Split from
3707         tsubst_pack_expansion.
3708         (tsubst_expr) [IF_STMT]: Use them.
3709         * cp-tree.h (IF_STMT_EXTRA_ARGS): New.
3711         * typeck.c (merge_types): Limit matching attribute shortcut to
3712         the default case.
3714 2018-04-03  Jakub Jelinek  <jakub@redhat.com>
3716         PR c++/85147
3717         * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
3719         PR c++/85140
3720         * name-lookup.c (handle_namespace_attrs): Return early if attributes
3721         is error_mark_node.
3723         PR c++/85134
3724         * decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
3725         fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
3726         instead for static data members clear init and set DECL_EXTERNAL.
3728 2018-04-02  Jason Merrill  <jason@redhat.com>
3730         PR c++/64095 - auto... parameter pack.
3731         * parser.c (cp_parser_parameter_declaration): Handle turning autos
3732         into packs here.
3733         (cp_parser_parameter_declaration_list): Not here.
3735 2018-03-31  Alexandre Oliva  <aoliva@redhat.com>
3737         PR c++/85027
3738         * class.c (instantiate_type): Peel off SAVE_EXPR before
3739         BASELINK.
3741 2018-03-30  Jason Merrill  <jason@redhat.com>
3743         * typeck2.c (process_init_constructor_record): Use
3744         init_list_type_node for the CONSTRUCTOR around an anonymous union
3745         designated initializer.
3747 2018-03-30  Jakub Jelinek  <jakub@redhat.com>
3749         PR c++/84791
3750         * semantics.c (finish_omp_reduction_clause): If
3751         OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
3752         even if processing_template_decl.
3754 2018-03-29  David Malcolm  <dmalcolm@redhat.com>
3756         PR c++/84269
3757         * name-lookup.c (get_std_name_hint): Add names from <memory>,
3758         <tuple>, and <utility>.
3760 2018-03-29  Jason Merrill  <jason@redhat.com>
3762         PR c++/85093 - too many template args with pack expansion.
3763         * pt.c (coerce_template_parms): Keep pack expansion args that will
3764         need to be empty.
3766 2018-03-29  Jason Merrill  <jason@redhat.com>
3768         * pt.c (build_non_dependent_expr): Propagate expr location.
3770 2018-03-27  Jason Merrill  <jason@redhat.com>
3772         PR c++/85060 - wrong-code with call to base member in template.
3773         * search.c (any_dependent_bases_p): Check uses_template_parms
3774         rather than processing_template_decl.
3776 2018-03-29  David Malcolm  <dmalcolm@redhat.com>
3778         PR c++/85110
3779         * typeck.c (convert_for_assignment): When complaining due to
3780         conversions for an argument, attempt to use the location of the
3781         argument.
3783 2018-03-28  Paolo Carlini  <paolo.carlini@oracle.com>
3785         PR c++/85028
3786         * pt.c (tsubst_default_argument): Early return if the type of the
3787         parameter is erroneous.
3789 2018-03-28  Alexandre Oliva  <aoliva@redhat.com>
3791         PR c++/84973
3792         * decl2.c (note_vague_linkage_fn): Don't defer uninstantiated
3793         templates.
3795         PR c++/84968
3796         * tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.
3798 2018-03-27  Paolo Carlini  <paolo.carlini@oracle.com>
3800         PR c++/85067
3801         * method.c (defaulted_late_check): Partially revert r253321 changes,
3802         do not early return upon error.
3804 2018-03-27  Jakub Jelinek  <jakub@redhat.com>
3806         PR c++/85077
3807         * cp-gimplify.c (cp_fold) <case CONSTRUCTOR>: For ctors with vector
3808         type call fold to generate VECTOR_CSTs when possible.
3810         PR c++/85076
3811         * tree.c (cp_build_reference_type): If to_type is error_mark_node,
3812         return it right away.
3814 2018-03-27  Volker Reichelt  <v.reichelt@netcologne.de>
3816         * search.c (check_final_overrider): Use inform instead of error
3817         for the diagnostics of the overridden functions.  Tweak wording.
3819 2018-03-27  Jakub Jelinek  <jakub@redhat.com>
3821         PR c++/85068
3822         * class.c (update_vtable_entry_for_fn): Don't ICE if base_binfo
3823         is NULL.  Assert if thunk_binfo is NULL then errorcount is non-zero.
3825 2018-03-27  Paolo Carlini  <paolo.carlini@oracle.com>
3826             Jason Merrill  <jason@redhat.com>
3828         PR c++/84632
3829         * init.c (build_aggr_init): When initializing from array,
3830         reject anything but CONSTRUCTORs and TARGET_EXPRs.
3831         (build_vec_init): Handle separately ARRAY_TYPEs.
3833 2018-03-26  Jason Merrill  <jason@redhat.com>
3835         PR c++/85062 - ICE with alignas in wrong place.
3836         * decl.c (grokdeclarator): Ignore attributes on type-specifiers
3837         here.
3839         PR c++/85049 - ICE with __integer_pack.
3840         * pt.c (unify_pack_expansion): Don't try to deduce generated packs.
3841         * cp-tree.h (TEMPLATE_PARM_P): New.
3843 2018-03-23  Jason Merrill  <jason@redhat.com>
3845         PR c++/78489 - wrong SFINAE behavior.
3847         PR c++/84489
3848         * pt.c (type_unification_real): Don't defer substitution failure.
3850 2018-03-23  Jakub Jelinek  <jakub@redhat.com>
3852         PR c++/85015
3853         * decl.c (compute_array_index_type): Set osize to mark_rvalue_use
3854         result.
3856         PR c++/84942
3857         * pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
3858         cp_build_unary_op call with gcc_unreachable ().
3860 2018-03-23  Marek Polacek  <polacek@redhat.com>
3862         PR c++/85045
3863         * cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
3864         Handle EXACT_DIV_EXPR and RDIV_EXPR.  Tweak condition.
3865         (cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.
3867 2018-03-23  Ville Voutilainen  <ville.voutilainen@gmail.com>
3869         Implement P0962
3870         * parser.c (cp_parser_perform_range_for_lookup): Change
3871         the condition for deciding whether to use members.
3873 2018-03-23  Marek Polacek  <polacek@redhat.com>
3875         PR c++/85033
3876         * semantics.c (finish_offsetof): Don't allow CONST_DECLs.
3878 2018-03-23  Alexandre Oliva  <aoliva@redhat.com>
3880         PR c++/71251
3881         * parser.c (cp_parser_alias_declaration): Call
3882         parser_check_template_parameters.
3884         PR c++/84789
3885         * pt.c (resolve_typename_type): Drop assert that stopped
3886         simplification to template-independent types.  Add assert to
3887         verify the initial scope is template dependent.
3888         * parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
3889         Reparse the id expression as a type-name, not a declarator.
3891         PR c++/84729
3892         * init.c (build_vec_init): Error at parenthesized array init.
3894         PR c++/84610
3895         PR c++/84642
3896         PR c++/84942
3897         * cp-tree.h (temp_override): New template class, generalizing
3898         a cleanup that was only used...
3899         * parser.c (cp_parser_parameter_declaration_clause):
3900         ... here for auto_is_implicit_function_template_parm_p.
3901         (cp_parser_gnu_attributes_opt): Use it here as well.
3902         (cp_parser_std_attribute): Likewise.
3904 2018-03-22  Marek Polacek  <polacek@redhat.com>
3906         PR c++/84854
3907         * semantics.c (finish_if_stmt_cond): Check if the type of the condition
3908         is boolean.
3910 2018-03-21  Jason Merrill  <jason@redhat.com>
3912         PR c++/81311 - wrong C++17 overload resolution.
3913         * call.c (build_user_type_conversion_1): Remove C++17 code.
3914         (conv_binds_ref_to_prvalue): New.
3915         (build_over_call): Handle C++17 copy elision.
3916         (build_special_member_call): Only do C++17 copy elision here if the
3917         argument is already the right type.
3919 2018-03-21  Alexandre Oliva  <aoliva@redhat.com>
3921         PR c++/71965
3922         * init.c (build_vec_init): Silence error, former sorry,
3923         without tf_error.
3925         PR c++/84610
3926         PR c++/84642
3927         * parser.c (abort_fully_implicit_template_p): New.
3928         (cp_parser_skip_to_end_of_statement): Use it.
3929         (cp_parser_skip_to_end_of_block_or_statement): Likewise.
3930         (finish_fully_implicit_template_p): Clear
3931         implicit_template_parms and implicit_template_scope.
3933 2018-03-21  Paolo Carlini  <paolo.carlini@oracle.com>
3935         PR c++/84972
3936         * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to
3937         error_mark_node when check_array_designated_initializer fails.
3939 2018-03-21  Jakub Jelinek  <jakub@redhat.com>
3941         PR c++/84961
3942         * cp-tree.h (genericize_compound_lvalue): Declare.
3943         * typeck.c (genericize_compound_lvalue): New function.
3944         (unary_complex_lvalue, cp_build_modify_expr): Use it.
3945         * semantics.c (finish_asm_stmt): Replace MODIFY_EXPR, PREINCREMENT_EXPR
3946         and PREDECREMENT_EXPR in output and "m" constrained input operands with
3947         COMPOUND_EXPR.  Call cxx_mark_addressable on the rightmost
3948         COMPOUND_EXPR operand.
3950 2018-03-21  Nathan Sidwell  <nathan@acm.org>
3952         PR c++/85008
3953         * tree.c (decl_linkage): Use DECL_CLONED_FUNCTION_P.
3954         * decl2.c (vague_linkage_p): Likewise.
3956 2018-03-21  David Malcolm  <dmalcolm@redhat.com>
3958         PR c++/84994
3959         * constexpr.c (constexpr_fn_retval): Make non-"static".
3960         * cp-tree.h (constexpr_fn_retval): New decl.
3961         * search.c (direct_accessor_p): Update leading comment.
3962         (reference_accessor_p): Likewise.
3963         (field_accessor_p): Replace check that function body is a
3964         RETURN_EXPR with a call to constexpr_fn_retval.  Fix
3965         indentation of "field_type" decl.
3967 2018-03-21  Nathan Sidwell  <nathan@acm.org>
3969         PR c++/84804
3970         * name-lookup.c (do_pushtag): Permit lambdas to be pushed into
3971         complete classes.
3973 2018-03-21  Martin Sebor  <msebor@redhat.com>
3975         PR c++/84850
3976         * call.c (first_non_public_field): New template and function.
3977         (first_non_trivial_field): New function.
3978         (maybe_warn_class_memaccess): Call them.
3980 2018-03-21  David Malcolm  <dmalcolm@redhat.com>
3982         PR c++/84892
3983         * search.c (field_accessor_p): Use class_of_this_parm rather than
3984         type_of_this_parm, to check that "this" is a "const T *", rather
3985         than a "T *const".
3987 2018-03-21  Nathan Sidwell  <nathan@acm.org>
3989         * class.c (finish_struct_anon_r): Refactor, deprecate anything
3990         other than public non-static data members.
3991         * parser.c (cp_parser_init_declarator): Deprecate attributes after
3992         parenthesized initializer.
3994         PR c++/84836
3995         * name-lookup.c (update_binding): Correct logic for local binding
3996         update.
3998 2018-03-21  Marek Polacek  <polacek@redhat.com>
4000         PR c++/71638, ICE with NSDMI and reference.
4001         * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
4002         even when we replace an element.
4004 2018-03-20  Marek Polacek  <polacek@redhat.com>
4006         PR c++/84978, ICE with NRVO.
4007         * constexpr.c (cxx_eval_constant_expression): Handle the case when
4008         a RESULT_DECL isn't in the hash map.
4010 2018-03-20  Jason Merrill  <jason@redhat.com>
4012         PR c++/84978, ICE with NRVO.
4013         * cvt.c (cp_get_fndecl_from_callee): Add fold parameter.
4014         (cp_get_callee_fndecl_nofold): New.
4015         * cp-gimplify.c (cp_genericize_r): Use it instead.
4016         * call.c (check_self_delegation): Likewise.
4018 2018-03-20  Nathan Sidwell  <nathan@acm.org>
4020         PR c++/84962
4021         * name-lookup.c (pushdecl_class_level): Push anon-struct's
4022         member_vec, if there is one.
4024         PR c++/84970
4025         * cp-tree.h (lookup_list_keep): Declare.
4026         * tree.c (lookup_list_keep): New, broken out of ...
4027         (build_min): ... here.  Call it.
4028         * decl.c (cp_finish_decl): Call lookup_list_keep.
4030 2018-03-19  Jason Merrill  <jason@redhat.com>
4032         PR c++/84937 - ICE with class deduction and auto.
4033         * pt.c (rewrite_template_parm): Fix auto handling.
4035 2018-03-19  Marek Polacek  <polacek@redhat.com>
4037         PR c++/84925
4038         * pt.c (enclosing_instantiation_of): Check if fn is null.
4040         PR c++/84927
4041         * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
4042         as we evaluate the elements.
4043         (cxx_eval_constant_expression): Verify constructor's flags
4044         unconditionally.
4046 2018-03-19  Jason Merrill  <jason@redhat.com>
4048         PR c++/71834 - template-id with too few arguments.
4049         * pt.c (coerce_template_parms): Check fixed_parameter_pack_p.
4051 2018-03-19  Nathan Sidwell  <nathan@acm.org>
4053         PR c++/84835
4054         * lambda.c (maybe_add_lambda_conv_op): Force C++ linkage.
4055         * pt.c (build_template_decl): Propagate language linkage.
4057         PR c++/84812
4058         * name-lookup.c (set_local_extern_decl_linkage): Defend against
4059         ambiguous lookups.
4061 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
4063         PR c/84910
4064         * parser.c (cp_parser_lambda_introducer): Remove trailing space from
4065         diagnostics.
4066         * method.c (synthesize_method): Likewise.
4067         * pt.c (convert_nontype_argument): Likewise.
4069 2018-03-16  Jason Merrill  <jason@redhat.com>
4071         PR c++/84720 - ICE with rvalue ref non-type argument.
4072         * pt.c (invalid_nontype_parm_type_p): Prohibit rvalue reference.
4073         (convert_nontype_argument): Revert earlier change.
4075         PR c++/80227 - SFINAE and negative array size.
4076         * decl.c (compute_array_index_type): Use
4077         build_converted_constant_expr and valid_constant_size_p.
4079         PR c++/84906 - silent wrong code with ambiguous conversion.
4080         * call.c (build_user_type_conversion_1): Set need_temporary_p on
4081         ambiguous conversion.
4082         (convert_like_real): Check it.
4084         PR c++/83937 - wrong C++17 handling of init-list ctor argument.
4085         * call.c (build_special_member_call): Don't convert an init-list
4086         argument directly to the class type.
4088 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
4090         PR c++/79937
4091         PR c++/82410
4092         * cp-tree.h (CONSTRUCTOR_PLACEHOLDER_BOUNDARY): Define.
4093         (find_placeholder): Declare.
4094         * tree.c (struct replace_placeholders_t): Add exp member.
4095         (replace_placeholders_r): Don't walk into ctors with
4096         CONSTRUCTOR_PLACEHOLDER_BOUNDARY flag set, unless they are equal to
4097         d->exp.  Replace PLACEHOLDER_EXPR with unshare_expr (x) rather than x.
4098         (replace_placeholders): Initialize data.exp.
4099         (find_placeholders_r, find_placeholders): New functions.
4100         * typeck2.c (process_init_constructor_record,
4101         process_init_constructor_union): Set CONSTRUCTOR_PLACEHOLDER_BOUNDARY
4102         if adding NSDMI on which find_placeholder returns true.
4103         * call.c (build_over_call): Don't call replace_placeholders here.
4104         * cp-gimplify.c (cp_genericize_r): Set TARGET_EXPR_NO_ELIDE on
4105         TARGET_EXPRs with CONSTRUCTOR_PLACEHOLDER_BOUNDARY set on
4106         TARGET_EXPR_INITIAL.
4107         (cp_fold): Copy over CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit to new
4108         ctor.
4110 2018-03-16  Jason Merrill  <jason@redhat.com>
4112         PR c++/83911 - ICE with multiversioned constructor.
4113         * cp-gimplify.c (cp_genericize_r): Replace versioned function with
4114         dispatchere here.
4115         * call.c (build_over_call): Not here.
4117 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
4119         PR c++/84874
4120         * decl.c (reshape_init_class): Don't assert d->cur->index == field
4121         if d->cur->index is a FIELD_DECL, instead set field to d->cur->index.
4123 2018-03-15  Jakub Jelinek  <jakub@redhat.com>
4125         PR c++/84222
4126         * cp-tree.h (cp_warn_deprecated_use): Declare.
4127         * tree.c (cp_warn_deprecated_use): New function.
4128         * typeck2.c (build_functional_cast): Use it.
4129         * decl.c (grokparms): Likewise.
4130         (grokdeclarator): Likewise.  Temporarily push nested class scope
4131         around grokparms call for out of class member definitions.
4133 2018-03-14  Jason Merrill  <jason@redhat.com>
4135         PR c++/84820 - no error for invalid qualified-id.
4136         * parser.c (cp_parser_make_indirect_declarator): Don't wrap
4137         cp_error_declarator.
4139         PR c++/84801 - ICE with unexpanded pack in lambda.
4140         * pt.c (check_for_bare_parameter_packs): Don't return early for a
4141         lambda in non-template context.
4143         PR c++/81236 - auto variable and auto function
4144         * pt.c (tsubst_baselink): Update the type of the BASELINK after
4145         mark_used.
4147 2018-03-14  Jason Merrill  <jason@redhat.com>
4149         PR c++/83916 - ICE with template template parameters.
4150         * pt.c (convert_template_argument): Don't substitute into type of
4151         non-type parameter if we don't have enough arg levels.
4152         (unify): Likewise.
4154 2018-03-14  Marek Polacek  <polacek@redhat.com>
4156         PR c++/84596
4157         * semantics.c (finish_static_assert): Check
4158         instantiation_dependent_expression_p instead of
4159         {type,value}_dependent_expression_p.
4161 2018-03-13  Paolo Carlini  <paolo.carlini@oracle.com>
4162             Jason Merrill  <jason@redhat.com>
4164         PR c++/82336 - link error with list-init default argument.
4165         * decl.c (check_default_argument): Unshare an initializer list.
4167 2018-03-13  Jakub Jelinek  <jakub@redhat.com>
4169         PR c++/84843
4170         * decl.c (duplicate_decls): For redefinition of built-in, use error
4171         and return error_mark_node.  For redeclaration, return error_mark_node
4172         rather than olddecl if !flag_permissive.
4174 2018-03-13  Jason Merrill  <jason@redhat.com>
4176         PR c++/82565 - ICE with concepts and generic lambda.
4177         * pt.c (instantiate_decl): Clear fn_context for lambdas.
4179 2018-03-13  Jason Merrill  <jason@redhat.com>
4181         PR c++/84720 - ICE with rvalue ref non-type argument.
4182         * pt.c (convert_nontype_argument): Handle rvalue references.
4184         PR c++/84839 - ICE with decltype of parameter pack.
4185         * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
4186         instantiating dummy parms.
4188         * parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
4189         parameter even without -Wpedantic.
4191         PR c++/84798 - ICE with auto in abstract function declarator.
4192         * parser.c (cp_parser_parameter_declaration_clause): Check
4193         parser->default_arg_ok_p.
4195 2018-03-13  Jakub Jelinek  <jakub@redhat.com>
4197         PR c++/84808
4198         * constexpr.c (find_array_ctor_elt): Don't use elt reference after
4199         first potential CONSTRUCTOR_ELTS reallocation.  Convert dindex to
4200         sizetype.  Formatting fixes.
4202 2018-03-12  Jason Merrill  <jason@redhat.com>
4204         PR c++/84355 - ICE with deduction for member class template.
4205         * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into
4206         CLASS_PLACEHOLDER_TEMPLATE.
4208         PR c++/84802 - ICE capturing uninstantiated class.
4209         * lambda.c (build_capture_proxy): Call complete_type.
4211 2018-03-09  Jason Merrill  <jason@redhat.com>
4213         PR c++/84770 - ICE with typedef and parameter pack.
4214         * pt.c (verify_unstripped_args_1): Split out from
4215         verify_unstripped_args.
4217         PR c++/84785 - ICE with alias template and default targs.
4218         * pt.c (type_unification_real): Set processing_template_decl if
4219         saw_undeduced == 1.
4221         PR c++/84752 - ICE with capture of constexpr array.
4222         * call.c (standard_conversion): Set rvaluedness_matches_p on the
4223         identity conversion under ck_lvalue.
4225 2018-03-09  Jason Merrill  <jason@redhat.com>
4226             Paolo Carlini  <paolo.carlini@oracle.com>
4228         PR c++/71169
4229         PR c++/71832
4230         * pt.c (any_erroneous_template_args_p): New.
4231         * cp-tree.h (any_erroneous_template_args_p): Declare it.
4232         * parser.c (cp_parser_class_specifier_1): Use it.
4234 2018-03-09  Jason Merrill  <jason@redhat.com>
4236         PR c++/84726 - unnecessary capture of constant vars.
4237         * cp-tree.h (LAMBDA_CAPTURE_EXPLICIT_P)
4238         (LAMBDA_EXPR_CAPTURE_OPTIMIZED): New.
4239         * expr.c (mark_use): Set LAMBDA_EXPR_CAPTURE_OPTIMIZED.
4240         * lambda.c (is_constant_capture_proxy)
4241         (current_lambda_expr, var_to_maybe_prune, mark_const_cap_r)
4242         (prune_lambda_captures): New.
4243         (finish_lambda_function): Call prune_lambda_captures.
4245 2018-03-09  Jason Merrill  <jason@redhat.com>
4246             Jakub Jelinek  <jakub@redhat.com>
4248         PR c++/84076
4249         * call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
4250         build ADDR_EXPR with REFERENCE_TYPE.
4251         (build_over_call): For purposes of check_function_arguments, if
4252         argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
4253         its operand rather than the argument itself.
4255 2018-03-09  Jakub Jelinek  <jakub@redhat.com>
4257         PR c++/84724
4258         * decl.c (duplicate_decls): Don't override __* prefixed builtins
4259         except for __[^b]*_chk, instead issue permerror and for -fpermissive
4260         also a note and return olddecl.
4262 2018-03-09  Nathan Sidwell  <nathan@acm.org>
4264         PR c++/84733
4265         * name-lookup.c (do_pushdecl_with_scope): Only clear
4266         current_function_decl when pushing a non-class (i.e. namespace)
4267         scope.
4269 2018-03-08  Jason Merrill  <jason@redhat.com>
4270             Jakub Jelinek  <jakub@redhat.com>
4272         PR c++/80598
4273         * call.c (build_over_call): In templates set TREE_USED (first_fn) when
4274         not calling mark_used for the benefit of -Wunused-function warning.
4276 2018-03-06  Jason Merrill  <jason@redhat.com>
4278         * lambda.c (is_capture_proxy_with_ref): Remove.
4279         * constexpr.c, expr.c, cp-tree.h, semantics.c: Adjust.
4281 2018-03-06  Marek Polacek  <polacek@redhat.com>
4283         PR c++/84684
4284         * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
4285         arguments.
4287 2018-03-06  Alexandre Oliva  <aoliva@redhat.com>
4289         PR c++/84231
4290         * tree.c (lvalue_kind): Use presence/absence of REFERENCE_TYPE
4291         only while processing template decls.
4292         * typeck.c (build_x_conditional_expr): Move wrapping of
4293         reference type around type...
4294         * call.c (build_conditional_expr_1): ... here.  Rename
4295         is_lvalue to is_glvalue.
4296         * parser.c (cp_parser_fold_expression): Catch REFERENCE_REF_P
4297         INDIRECT_REF of COND_EXPR too.
4299         PR c++/84593
4300         * init.c (build_zero_init_1): Zero-initialize references.
4302         PR c++/84492
4303         * semantics.c (finish_stmt_expr_expr): Reject unresolved
4304         overloads used as stmt expr values.
4306 2018-03-05  Jason Merrill  <jason@redhat.com>
4308         PR c++/84708 - ICE with lambda in local class NSDMI.
4309         * lambda.c (lambda_expr_this_capture): Handle local class NSDMI
4310         context.
4312 2018-03-05  Jakub Jelinek  <jakub@redhat.com>
4314         PR c++/84684
4315         * constexpr.c (constexpr_call_hasher::equal): Return false if
4316         lhs->hash != rhs->hash.  Change return 1 to return true and
4317         return 0 to return false.
4319 2018-03-05  Nathan Sidwell  <nathan@acm.org>
4321         PR c++/84702
4322         * pt.c (process_template_arg): Mark lookup_keep on a default arg.
4324 2018-03-05  Marek Polacek  <polacek@redhat.com>
4326         PR c++/84707
4327         * decl.c (duplicate_decls): Check DECL_NAME before accessing
4328         UDLIT_OPER_P.
4330 2018-03-05  Nathan Sidwell  <nathan@acm.org>
4332         PR c++/84694
4333         * friend.c (do_friend): Restore check for identifier_p inside
4334         TEMPLATE_ID_EXPR.
4336 2018-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
4338         PR c++/84618
4339         * parser.c (cp_parser_lambda_introducer): Reject any capture not
4340         involving a VAR_DECL or a PARM_DECL.
4342 2018-03-05  Pádraig Brady  <P@draigBrady.com>
4343             Jason  Merrill  <jason@redhat.com>
4344             Nathan Sidwell  <nathan@acm.org>
4346         PR c++/84497
4347         * decl2.c (get_tls_init_fn): Check TYPE_HAS_TRIVIAL_DFLT too.
4349 2018-03-03  Jason Merrill  <jason@redhat.com>
4351         PR c++/84686 - missing volatile loads.
4352         * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
4354 2018-03-03  Paolo Carlini  <paolo.carlini@oracle.com>
4356         PR c++/71464
4357         * optimize.c (maybe_thunk_body): Bail out immediately if either
4358         fns[0] or fns[1] is null.
4360 2018-03-02  Marek Polacek  <polacek@redhat.com>
4362         PR c++/84578
4363         * constexpr.c (get_array_or_vector_nelts): New.
4364         (cxx_eval_array_reference): Use it.
4365         (cxx_eval_vec_init_1): Likewise.
4366         (cxx_eval_store_expression): Likewise.
4368 2018-03-02  Jason Merrill  <jason@redhat.com>
4370         * semantics.c (force_paren_expr): Remove redundant test.
4372 2018-03-02  Marek Polacek  <polacek@redhat.com>
4374         PR c++/84663
4375         * decl.c (cp_complete_array_type): Check error_mark_node.
4377         PR c++/84664
4378         * typeck.c (cp_perform_integral_promotions): Check the result of
4379         mark_rvalue_use.
4381 2018-03-02  Jakub Jelinek  <jakub@redhat.com>
4383         PR c++/84662
4384         * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
4385         RETURN instead of return.
4386         <case POINTER_PLUS_EXPR>: Likewise.
4387         <case CONVERT_EXPR>: If op0 is error_mark_node, just return
4388         it instead of wrapping it into CONVERT_EXPR.
4390 2018-03-02  Jason Merrill  <jason@redhat.com>
4392         Fix MIPS16 ICE.
4393         * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC.
4395 2018-03-02  Marek Polacek  <polacek@redhat.com>
4397         PR c++/84590
4398         * cp-gimplify.c (cp_fully_fold): Unwrap TARGET_EXPR or a CONSTRUCTOR
4399         wrapped in VIEW_CONVERT_EXPR.
4401 2018-03-01  Martin Sebor  <msebor@redhat.com>
4403         PR c++/84294
4404         * decl.c (check_redeclaration_no_default_args): Merge attributes
4405         specified on redeclarations of the same function template.
4406         Remove dead code.
4408 2018-03-01  Marek Polacek  <polacek@redhat.com>
4409             Jason Merrill  <jason@redhat.com>
4411         PR c++/84582
4412         * semantics.c (force_paren_expr): Create a PAREN_EXPR when in
4413         a template.
4414         (maybe_undo_parenthesized_ref): Unwrap PAREN_EXPR.
4415         * typeck2.c (store_init_value): Call fold_non_dependent_expr instead
4416         of instantiate_non_dependent_expr.
4417         * tree.c (lvalue_kind): Handle PAREN_EXPR like NON_DEPENDENT_EXPR.
4419 2018-03-01  Nathan Sidwell  <nathan@acm.org>
4421         PR c++/84434
4422         * name-lookup.c (member_vec_dedup): Remove manually peeled
4423         iteration.  Ignore dependent ctor inheritance.
4425 2018-03-01  Jason Merrill  <jason@redhat.com>
4427         PR c++/71569 - decltype of template.
4428         * parser.c (cp_parser_decltype_expr): Handle missing template args.
4430 2018-03-01  Marek Polacek  <polacek@redhat.com>
4432         PR c++/84596
4433         * constexpr.c (require_rvalue_constant_expression): New function.
4434         * cp-tree.h: Declare it.
4435         * semantics.c (finish_static_assert): Use it instead of
4436         require_potential_rvalue_constant_expression.
4438 2018-03-01  Jason Merrill  <jason@redhat.com>
4439             Alexandre Oliva  <aoliva@redhat.com>
4441         PR c++/71569 - ICE with redundant args on member variable template.
4442         * decl.c (start_decl): Handle partial specialization of member
4443         variable template.
4444         * pt.c (determine_specialization): Allow partial specialization
4445         of member variable template without specializing enclosing class.
4446         (process_partial_specialization): Improve error message.
4448 2018-02-28  Jason Merrill  <jason@redhat.com>
4450         PR c++/71784 - ICE with ref-qualifier and explicit specialization.
4451         * pt.c (determine_specialization): Check ref-qualifier.
4453 2018-02-28  Jakub Jelinek  <jakub@redhat.com>
4455         PR c++/84609
4456         * parser.c (cp_parser_attributes_opt): Formatting fix.
4457         (cp_parser_skip_balanced_tokens, cp_parser_skip_gnu_attributes_opt,
4458         cp_parser_skip_std_attribute_spec_seq, cp_parser_skip_attributes_opt):
4459         New functions.
4460         (cp_parser_member_declaration): Use cp_parser_skip_attributes_opt
4461         instead of tentative parse to peek over optional attribute tokens
4462         to check for CPP_COLON after them.
4464         PR c++/83871
4465         PR c++/83503
4466         * pt.c (INCLUDE_STRING): Remove define.
4467         (warn_spec_missing_attributes): Use pretty_printer instead of
4468         std::string.  Fix up inform call so that the list of attributes
4469         is in %s argument.
4471 2018-02-28  Martin Sebor  <msebor@redhat.com>
4473         PR testsuite/84617
4474         * decl.c (duplicate_decls): Fully merge attributes const, pure,
4475         and malloc.
4477 2018-02-28  Nathan Sidwell  <nathan@acm.org>
4479         PR c++/84602
4480         * name-lookup.h (search_anon_aggr): Add defaulted WANT_TYPE arg.
4481         * name-lookup.c (fields_linear_search): Look in an anon-aggr
4482         regardless of want_type.
4483         (search_anon_aggr): Just use get_class_binding_direct.
4485 2018-02-28  Jakub Jelinek  <jakub@redhat.com>
4487         * decl.c (cp_finish_decomp): Don't adjust eltscnt when calling
4488         inform_n.
4490 2018-02-27  Martin Sebor  <msebor@redhat.com>
4492         * pt.c: Avoid including <string> directly.
4494 2018-02-27  Martin Sebor  <msebor@redhat.com>
4496         PR c++/83871
4497         PR c++/83503
4498         * cp-tree.h (warn_spec_missing_attributes): New function.
4499         ((check_explicit_specialization): Add an argument.  Call the above
4500         function.
4501         * decl.c (duplicate_decls): Avoid applying primary function template's
4502         attributes to its explicit specializations.
4503         cp/pt.c (warn_spec_missing_attributes): Define.
4505 2018-02-27  HÃ¥kon Sandsmark  <hsandsmark@gmail.com>
4507         PR c++/71546 - lambda init-capture with qualified-id.
4508         * parser.c (cp_parser_lambda_introducer): Clear scope after
4509         each lambda capture.
4511 2018-02-27  Nathan Sidwell  <nathan@acm.org>
4513         PR c++/84426
4514         * name-lookup.h (get_member_slot): Rename ...
4515         (find_member_slot): ... here.
4516         (add_member_slot): New.
4517         * name-lookup.c (member_vec_linear_search): No need to check for
4518         NULL slot.
4519         (get_member_slot): Rename ...
4520         (find_member_slot): ... here.  Don't add slot for incomplete class.
4521         (add_member_slot): New.
4522         * class.c (add_method): Adjust get_member_slot rename.  Bail out
4523         if push_class_level_binding fails.  Create slot and grok
4524         properties once we're committed to insertion.
4526 2018-02-27  Jason Merrill  <jason@redhat.com>
4528         PR c++/84489 - dependent default template argument
4529         * pt.c (type_unification_real): Handle early substitution failure.
4531 2018-02-26  Jason Merrill  <jason@redhat.com>
4533         PR c++/84560 - ICE capturing multi-dimensional VLA.
4534         * tree.c (array_of_runtime_bound_p): False if the element is
4535         variably-modified.
4537         PR c++/84441 - ICE with base initialized from ?:
4538         * call.c (unsafe_copy_elision_p): Handle COND_EXPR.
4540         PR c++/84520 - ICE with generic lambda in NSDMI.
4541         * lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
4542         'this' in a generic lambda instantiation.
4544         PR c++/84559 - ICE with constexpr VLA.
4545         * constexpr.c (ensure_literal_type_for_constexpr_object): Check
4546         for constexpr variable with VLA type.
4548 2018-02-26  Jakub Jelinek  <jakub@redhat.com>
4550         PR c++/84558
4551         * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like
4552         a valid constant initializer.  Formatting fixes.
4554 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
4556         PR c++/84540
4557         * pt.c (tsubst_attributes): Handle correctly tsubst_attribute
4558         returning NULL_TREE.
4559         (apply_late_template_attributes): Likewise.
4561 2018-02-26  Jakub Jelinek  <jakub@redhat.com>
4563         PR c++/84557
4564         * parser.c (cp_parser_omp_var_list_no_open): Only call
4565         cp_parser_lookup_name_simple on names satisfying identifier_p.
4566         (cp_parser_oacc_routine): Likewise.
4568 2018-02-26  Jason Merrill  <jason@redhat.com>
4570         PR c++/84551 - ICE with concepts and -g.
4571         * parser.c (add_debug_begin_stmt): Do nothing in a concept.
4573 2018-02-26  Marek Polacek  <polacek@redhat.com>
4575         PR c++/84325
4576         * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
4577         non-types.
4579 2018-02-26  Jason Merrill  <jason@redhat.com>
4581         PR c++/84447 - ICE with deleted inherited ctor with default arg.
4582         * call.c (build_over_call): Handle deleted functions in one place.
4584 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
4586         PR c++/84533
4587         * decl.c (redeclaration_error_message): Don't try to use
4588         DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.
4590 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
4592         * lambda.c (build_capture_proxy): Define static.
4593         * cp-tree.h (build_capture_proxy): Remove.
4595 2018-02-26  Marek Polacek  <polacek@redhat.com>
4597         PR c++/84537
4598         * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
4599         if name is error node.
4601 2018-02-25  Jason Merrill  <jason@redhat.com>
4603         PR c++/84015 - ICE with class deduction and auto template parm.
4604         * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
4606 2018-02-24  Marek Polacek  <polacek@redhat.com>
4608         PR c++/83692
4609         * constexpr.c (maybe_constant_init_1): New function.
4610         (maybe_constant_init): Make it a wrapper around maybe_constant_init_1.
4611         (cxx_constant_init): New function.
4612         * cp-tree.h (cxx_constant_init): Declare.
4613         * typeck2.c (store_init_value): Call cxx_constant_init instead of
4614         cxx_constant_value.  Move the maybe_constant_init call under an 'else'.
4616 2018-02-22  Jason Merrill  <jason@redhat.com>
4618         PR c++/70468 - ICE with constructor delegation via typedef.
4619         * pt.c (tsubst_initializer_list): Check for other mem-initializers
4620         with constructor delegation.
4622 2018-02-22  Jason Merrill  <jason@redhat.com>
4624         PR c++/84424 - ICE with constexpr and __builtin_shuffle.
4625         * constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
4626         VECTOR_TYPE.
4628 2018-02-22  Marek Polacek  <polacek@redhat.com>
4630         PR c++/84493
4631         * parser.c (cp_parser_braced_list): Use require_open instead of
4632         consume_open.
4634 2018-02-21  Jason Merrill  <jason@redhat.com>
4636         PR c++/84454 - ICE with pack expansion in signature.
4637         * error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.
4639 2018-02-20  Siddhesh Poyarekar  <siddhesh@sourceware.org>
4641         * cp-objcp-common.c (cxx_block_may_fallthru): Add case for
4642         IF_STMT.
4644 2018-02-20  Paolo Carlini  <paolo.carlini@oracle.com>
4646         PR c++/84446
4647         * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope
4648         on error_mark_node.
4650 2018-02-20  Jakub Jelinek  <jakub@redhat.com>
4652         PR c++/84445
4653         * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test
4654         TREE_HAS_CONSTRUCTOR if instance is not an internal function call.
4656         PR c++/84449
4657         * tree.c (bot_manip): If build_cplus_new or break_out_target_exprs
4658         returns error_mark_node, return it immediately.
4659         (break_out_target_exprs): If cp_walk_tree with bot_manip returns
4660         error_mark_node, return error_mark_node.
4662         PR c++/84455
4663         * pt.c (tsubst_lambda_expr): If not nested, increment temporarily
4664         function_depth to avoid GC during finish_lambda_function.
4666 2018-02-19  Jason Merrill  <jason@redhat.com>
4668         PR c++/84429 - ICE capturing VLA.
4669         * lambda.c (build_capture_proxy): Handle reference refs.
4671 2018-02-19  Jakub Jelinek  <jakub@redhat.com>
4673         PR c++/84448
4674         * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
4675         either operand is error_mark_node, set current.lhs to that instead of
4676         creating a binary op with error_mark_node operands.
4678         PR c++/84430
4679         * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
4681 2018-02-19  Paolo Carlini  <paolo.carlini@oracle.com>
4683         PR c++/84348
4684         * decl.c (grokdeclarator): Early return error_mark_node upon
4685         ill-formed friend declaration.
4687 2018-02-16  Marek Polacek  <polacek@redhat.com>
4688             Jakub Jelinek  <jakub@redhat.com>
4690         PR c++/84192
4691         * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
4692         set *jump_target to anything if jump_target is NULL.
4694 2018-02-16  Jason Merrill  <jason@redhat.com>
4696         PR c++/84151 - unnecessary volatile load with static member.
4697         * call.c (build_new_method_call_1): Avoid loading from a volatile
4698         lvalue used as the object argument for a static member function.
4700         PR c++/81853 - using-directive and constexpr.
4701         * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT.
4703         PR c++/84420 - ICE with structured binding in lambda.
4704         * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P.
4706         PR c++/83835 - C++17 error with constructor ctors.
4707         * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P.
4709         PR c++/82664 - ICE with reference to function template parm.
4710         * pt.c (convert_nontype_argument_function): Avoid obfuscationg
4711         NOP_EXPRs.
4713         PR c++/82764 - C++17 ICE with empty base
4714         * class.c (build_base_field_1): Set DECL_SIZE to zero for empty base.
4716 2018-02-16  Jason Merrill  <jason@redhat.com>
4718         PR c++/84421 - type-dependent if constexpr
4719         * semantics.c (finish_if_stmt_cond): Check type_dependent_expression_p.
4721 2018-02-16  Nathan Sidwell  <nathan@acm.org>
4723         Deprecate -ffriend-injection.
4724         * decl.c (cxx_init_decl_processing): Emit warning on option.
4725         * name-lookup.c (do_pushdecl): Emit warning if we push a visible
4726         friend.
4728 2018-02-16  Paolo Carlini  <paolo.carlini@oracle.com>
4730         PR c++/82468
4731         * decl.c (check_special_function_return_type): Reject template
4732         template parameter in deduction guide.
4734 2018-02-16  Nathan Sidwell  <nathan@acm.org>
4736         PR c++/84375
4737         * name-lookup.c (do_pushdecl): Bail out on bad local friend injection.
4739 2018-02-15  Jason Merrill  <jason@redhat.com>
4741         PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
4742         * call.c (convert_like_real): Don't use the copy-list-initialization
4743         shortcut for ck_base.
4745         PR c++/84045 - ICE with typedef and noexcept.
4746         * except.c (build_noexcept_spec): Use strip_typedefs_expr.
4748         PR c++/84376 - ICE with omitted template arguments.
4749         * pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
4751         PR c++/84368 - wrong error with local variable in variadic lambda.
4752         * pt.c (tsubst_pack_expansion): Fix handling of non-packs in
4753         local_specializations.
4755 2018-02-15  Paolo Carlini  <paolo.carlini@oracle.com>
4757         PR c++/84330
4758         * constraint.cc (tsubst_constraint_info): Handle an error_mark_node
4759         as first argument.
4761 2018-02-14  Paolo Carlini  <paolo.carlini@oracle.com>
4763         PR c++/84350
4764         * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null
4765         init, early return.
4767 2018-02-14  Nathan Sidwell  <nathan@acm.org>
4769         * decl2.c (mark_vtable_entries): Set input_location to decl's.
4770         (c_parse_final_cleanups): Restore input_location after emitting
4771         vtables.
4773 2018-02-14  Paolo Carlini  <paolo.carlini@oracle.com>
4775         * cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove.
4776         (do_auto_deduction (tree, tree, tree, tsubst_flags_t,
4777         auto_deduction_context, tree, int): Add defaults.
4778         * pt.c (do_auto_deduction (tree, tree, tree)): Remove definition.
4779         (tsubst_omp_for_iterator): Adjust do_auto_deduction call, forward
4780         tsubst_flags_t argument.
4781         * init.c (build_new): Likewise.
4783 2018-02-13  Jakub Jelinek  <jakub@redhat.com>
4785         PR c++/84364
4786         * typeck.c (check_return_expr): Don't emit -Weffc++ warning
4787         about return other than *this in assignment operators if
4788         retval is type dependent expression.
4790 2018-02-13  Paolo Carlini  <paolo.carlini@oracle.com>
4792         PR c++/84333
4793         * call.c (build_conditional_expr_1): Use cp_save_expr instead of
4794         save_expr for the G++ extension.
4796 2018-02-13  Jason Merrill  <jason@redhat.com>
4798         PR c++/84080 - ICE with return type deduction and specialization.
4799         * pt.c (determine_specialization): Check uses_template_parms.
4801         Fix more variadic capture issues.
4802         * pt.c (find_parameter_packs_r): Also look at explicit captures.
4803         (check_for_bare_parameter_packs): Check current_class_type for
4804         lambda context.
4805         (extract_locals_r): Handle seeing a full instantiation of a pack.
4806         (tsubst_pack_expansion): Likewise.  Force lambda capture.
4807         * parser.c (cp_parser_lambda_introducer): Don't
4808         check_for_bare_parameter_packs.
4810         PR c++/84338 - wrong variadic sizeof.
4811         * pt.c (argument_pack_select_arg): Like the macro, but look through
4812         a pack expansion.
4813         (tsubst, tsubst_copy, dependent_template_arg_p): Use it.
4814         (extract_fnparm_pack): Do make_pack_expansion.
4815         (extract_locals_r): Do strip a pack expansion.
4816         * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove.
4818 2018-02-12  Jakub Jelinek  <jakub@redhat.com>
4820         PR c++/84341
4821         * parser.c (cp_parser_binary_expression): Use build_min instead of
4822         build2_loc to build the no_toplevel_fold_p toplevel binary expression.
4824 2018-02-12  Nathan Sidwell  <nathan@acm.org>
4826         PR c++/84263
4827         * parser.c (cp_parser_decltype): Push and pop
4828         deferring_access_checks.  Reorganize to avoid goto.
4830 2018-02-12  Richard Biener  <rguenther@suse.de>
4832         PR c++/84281
4833         * constexpr.c (cxx_eval_vec_init_1): Use a RANGE_EXPR to compact
4834         uniform constructors and delay allocating them fully.
4836 2018-02-09  Jason Merrill  <jason@redhat.com>
4838         PR c++/84036 - ICE with variadic capture.
4839         Handle variadic capture proxies more like non-variadic.
4840         * lambda.c (build_capture_proxy): Remove workaround.
4841         * pt.c (find_parameter_packs_r): The proxy is a pack.
4842         (instantiate_class_template_1): Remove dead lambda code.
4843         (extract_fnparm_pack): Don't make_pack_expansion.
4844         (extract_locals_r): Don't strip a pack expansion.
4845         (tsubst_pack_expansion): Handle proxy packs.  Use
4846         PACK_EXPANSION_EXTRA_ARGS less.
4847         (tsubst_decl) [FIELD_DECL]: Don't register_specialization.
4848         (tsubst_copy) [FIELD_DECL]: Don't retrieve*_specialization.
4849         [VAR_DECL]: Handle ARGUMENT_PACK_SELECT.
4850         (tsubst_expr) [DECL_EXPR]: Handle proxy packs.
4851         (tsubst_copy_and_build) [VAR_DECL]: Handle proxy packs normally.
4853 2018-02-10  Jakub Jelinek  <jakub@redhat.com>
4855         PR sanitizer/83987
4856         * tree.c (cp_free_lang_data): Revert 2018-01-23 change.
4858 2018-02-09  Jason Merrill  <jason@redhat.com>
4860         PR c++/81917 - ICE with void_t and partial specialization.
4861         * pt.c (instantiate_class_template_1): Set TYPE_BEING_DEFINED before
4862         calling most_specialized_partial_spec.
4864 2018-02-09  Nathan Sidwell  <nathan@acm.org>
4866         PR c/84293
4867         * typeck.c (cp_build_indirect_ref_1, build_reinterpret_cast_1):
4868         Pass expr location to strict_aliasing_warning.
4870 2018-02-09  Jason Merrill  <jason@redhat.com>
4872         PR c++/84296 - ICE with qualified-id in template.
4873         PR c++/83714
4874         * pt.c (unknown_base_ref_p): New.
4875         (instantiation_dependent_scope_ref_p): Use it instead of
4876         any_dependent_bases_p.
4878 2018-02-09  Marek Polacek  <polacek@redhat.com>
4879             Jakub Jelinek  <jakub@redhat.com>
4881         PR c++/83659
4882         * constexpr.c (cxx_fold_indirect_ref): Sync some changes from
4883         fold_indirect_ref_1, including poly_*int64.  Verify first that
4884         tree_fits_poly_int64_p (op01).  Formatting fixes.
4886 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
4888         * constexpr.c (cxx_eval_component_reference): Use INDIRECT_REF_P.
4889         * lambda.c (build_capture_proxy): Likewise.
4890         * search.c (field_access_p): Likewise.
4891         * semantics.c (omp_clause_decl, omp_privatize_field,
4892         finish_omp_clauses): Likewise.
4894 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
4896         PR c++/83806
4897         * typeck.c (decay_conversion): Use mark_rvalue_use for the special
4898         case of nullptr too.
4900 2018-02-08  Nathan Sidwell  <nathan@acm.org>
4902         * class.c (finish_struct): Fix std:initializer_list diagnostic
4903         formatting.
4905 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
4907         PR c++/83204
4908         * pt.c (tsubst_copy_and_build): Use force_paren_expr for INDIRECT_REF.
4910 2018-02-07  Jakub Jelinek  <jakub@redhat.com>
4912         PR c++/84082
4913         * parser.c (cp_parser_dot_deref_incomplete): New function.
4914         (cp_parser_postfix_dot_deref_expression): Use it.
4916 2018-02-07  David Malcolm  <dmalcolm@redhat.com>
4918         PR c++/81610
4919         PR c++/80567
4920         * name-lookup.c (suggest_rid_p): New function.
4921         (lookup_name_fuzzy): Replace enum-rid-filtering logic with call to
4922         suggest_rid_p.
4924 2018-02-07  Jason Merrill  <jason@redhat.com>
4926         PR c++/84182 - ICE with captured lambda
4927         PR c++/84181
4928         * pt.c (extract_locals_r, extract_local_specs): New.
4929         (tsubst_pack_expansion): Use them.
4931 2018-02-07  Martin Liska  <mliska@suse.cz>
4933         PR c++/84059.
4934         * class.c (add_method): Append argument value.
4935         * cp-tree.h (maybe_version_functions): Add new argument.
4936         * decl.c (decls_match): Call it if a declaration does not
4937         have DECL_FUNCTION_VERSIONED.
4938         (maybe_version_functions): record argument is added.
4940 2018-02-05  Marek Polacek  <polacek@redhat.com>
4942         * class.c: Remove unused global variables.
4943         (build_primary_vtable): Don't gather statistics.
4944         (print_class_statistics): Remove.
4945         * cp-tree.h (print_class_statistics): Remove.
4946         * tree.c (cxx_print_statistics): Don't call print_class_statistics.
4948 2018-02-02  Paolo Carlini  <paolo.carlini@oracle.com>
4950         * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD.
4951         * constexpr.c (cx_check_missing_mem_inits): Likewise.
4952         * decl.c (next_initializable_field, find_decomp_class_base,
4953         cp_finish_decomp): Likewise.
4954         * typeck2.c (process_init_constructor_record): Likewise.
4956 2018-02-02  Jason Merrill  <jason@redhat.com>
4958         PR c++/84181 - ICE with lambda parm in template argument.
4959         * tree.c (strip_typedefs_expr): Use cp_tree_operand_length.
4961 2018-02-01  Jason Merrill  <jason@redhat.com>
4963         PR c++/84160 - ICE with nested variadic capture.
4964         * lambda.c (is_capture_proxy_with_ref): New.
4965         (insert_capture_proxy): Don't set DECL_CAPTURED_VARIABLE from a
4966         COMPONENT_REF.
4967         * expr.c (mark_use): Use is_capture_proxy_with_ref.
4968         * constexpr.c (potential_constant_expression_1): Likewise.
4969         * semantics.c (process_outer_var_ref): Likewise.
4971 2018-02-01  Marek Polacek  <polacek@redhat.com>
4973         PR c++/84125
4974         * typeck.c (build_address): Relax the assert when
4975         processing_template_decl.
4977 2018-02-01  Jason Merrill  <jason@redhat.com>
4979         PR c++/84126 - ICE with variadic generic lambda
4980         PR c++/84036
4981         PR c++/82249
4982         * pt.c (tsubst_pack_expansion): Handle function parameter_packs in
4983         PACK_EXPANSION_EXTRA_ARGS.
4985 2018-02-01  Paolo Carlini  <paolo.carlini@oracle.com>
4987         PR c++/83796
4988         * call.c (convert_like_real): If w're initializing from {} explicitly
4989         call abstract_virtuals_error_sfinae.
4991 2018-01-31  Jason Merrill  <jason@redhat.com>
4992             Jakub Jelinek  <jakub@redhat.com>
4994         PR c++/83993
4995         * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
4996         around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
4997         on ADDR_EXPR.
4999 2018-01-31  Jakub Jelinek  <jakub@redhat.com>
5001         PR c++/83993
5002         * constexpr.c (diag_array_subscript): Emit different diagnostics
5003         if TYPE_DOMAIN (arraytype) is NULL.
5004         (cxx_eval_array_reference, cxx_eval_store_expression): For arrays
5005         with NULL TYPE_DOMAIN use size_zero_node as nelts.
5007 2018-01-31  Paolo Carlini  <paolo.carlini@oracle.com>
5009         PR c++/84092
5010         * semantics.c (finish_qualified_id_expr): When handling an
5011         UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
5013 2018-01-31  Marek Polacek  <polacek@redhat.com>
5015         PR c++/84138
5016         * cp-gimplify.c (cp_fold): Check if X is an error node before
5017         calling useless_type_conversion_p.
5019 2018-01-30  Jason Merrill  <jason@redhat.com>
5021         PR c++/84091 - ICE with local class in lambda in template.
5022         * decl2.c (determine_visibility): Look for outer containing template
5023         instantiation.
5025         PR c++/84098 - ICE with lambda in template NSDMI.
5026         * pt.c (instantiate_class_template_1): Ignore more lambdas.
5028 2018-01-29  Jason Merrill  <jason@redhat.com>
5030         PR c++/68810 - wrong location for reinterpret_cast error.
5031         * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
5032         !dofold.
5034 2018-01-29  Marek Polacek  <polacek@redhat.com>
5036         PR c++/83996
5037         * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
5038         => fooarray[1] in offset_int.
5040 2018-01-29  Jason Merrill  <jason@redhat.com>
5042         PR c++/83942 - wrong unused warning with static_cast.
5043         * cvt.c (ocp_convert): Call mark_rvalue_use.
5045 2018-01-26  Jason Merrill  <jason@redhat.com>
5047         PR c++/83956 - wrong dtor error with anonymous union
5048         * method.c (walk_field_subobs): Variant members only affect
5049         deletedness.
5050         (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
5052         PR c++/84036 - ICE with variadic capture.
5053         PR c++/82249
5054         * pt.c (tsubst_pack_expansion): When optimizing a simple
5055         substitution, pull a single pack expansion out of its pack.
5057         PR c++/82514 - ICE with local class in generic lambda.
5058         * pt.c (regenerated_lambda_fn_p): Remove.
5059         (enclosing_instantiation_of): Don't use it.
5060         (tsubst_function_decl): Call enclosing_instantiation_of.
5062         * pt.c (lookup_template_class_1): Add sanity check.
5063         * name-lookup.c (do_pushtag): Don't add closures to local_classes.
5065 2018-01-25  Jakub Jelinek  <jakub@redhat.com>
5067         PR c++/84031
5068         * decl.c (find_decomp_class_base): Ignore unnamed bitfields.  Ignore
5069         recursive calls that return ret.
5070         (cp_finish_decomp): Ignore unnamed bitfields.
5072 2018-01-23  Jason Merrill  <jason@redhat.com>
5074         PR c++/82249 - wrong mismatched pack length error.
5075         * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
5076         unsubstituted function parameter pack.
5078 2018-01-23  Paolo Carlini  <paolo.carlini@oracle.com>
5080         PR c++/83921
5081         * decl.c (check_for_uninitialized_const_var): Not static; add
5082         bool and tsubst_flags_t parameters; adjust to be used both in
5083         constexpr context and not.
5084         * constexpr.c (potential_constant_expression_1): Use the above.
5085         * cp-tree.h (check_for_uninitialized_const_var): Declare.
5087 2018-01-23  Jason Merrill  <jason@redhat.com>
5089         PR c++/83947 - ICE with auto declarations.
5090         * pt.c (do_auto_deduction): Don't deduce from an auto decl.
5091         * decl.c (undeduced_auto_decl): Limit to vars and fns.
5093 2018-01-23  David Malcolm  <dmalcolm@redhat.com>
5095         PR c++/83974
5096         * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
5097         for pointer to member function types.
5099 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
5101         PR sanitizer/83987
5102         * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
5103         DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
5105 2018-01-23  Nathan Sidwell  <nathan@acm.org>
5107         PR c++/83988
5108         * pt.c (tsubst_baselink): Remove optype assert.
5109         * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
5111 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
5113         PR c++/83958
5114         * decl.c (cp_finish_decomp): Diagnose if reference structure binding
5115         refers to incomplete type.
5117 2018-01-23  Nathan Sidwell  <nathan@acm.org>
5119         Deprecate ARM-era for scope handling
5120         * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
5121         (cxx_init_decl_processing): Deprecate flag_new_for_scope being
5122         cleared.
5123         * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
5124         cleanup handling.
5125         * semantics.c (begin_for_scope): Flag_new_for_scope is
5126         boolean-like.
5127         (finish_for_stmt, begin_range_for_stmt): Likewise.
5129 2018-01-22  Jason Merrill  <jason@redhat.com>
5131         PR c++/83720
5132         * decl2.c (determine_visibility): Fix template_decl handling
5133         instead of blocking it.
5135         PR c++/83720 - ICE with lambda and LTO.
5136         * decl2.c (determine_visibility): Clear template_decl for
5137         function-scope decls.  Propagate anonymous linkage from containing
5138         function.
5140 2018-01-22  Marek Polacek  <polacek@redhat.com>
5142         PR c++/81933
5143         * typeck2.c (split_nonconstant_init_1): Return false if we didn't
5144         split out anything.
5146 2018-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>
5148         PR c++/83895
5149         * decl.c (grokdeclarator): Don't diagnose extra parens
5150         on typedefs.
5152 2018-01-19  Jakub Jelinek  <jakub@redhat.com>
5154         PR c++/81167
5155         * call.c (joust): Use TREE_TYPE (source) if source is
5156         a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
5158         PR c++/83919
5159         * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
5160         for direct enum init.
5161         * decl.c (reshape_init): Likewise.
5163 2018-01-19  Marek Polacek  <polacek@redhat.com>
5165         * constexpr.c (fold_simple): Simplify.
5167 2018-01-18  Jason Merrill  <jason@redhat.com>
5169         PR c++/83714
5170         * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
5171         * pt.c (instantiation_dependent_scope_ref_p): True if
5172         any_dependent_bases_p.
5174 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
5176         * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
5177         vs DECL_NONTRIVIALLY_INITIALIZED_P).
5179 2018-01-18  Jason Merrill  <jason@redhat.com>
5181         PR c++/82461 - constexpr list-initialized member
5182         * constexpr.c (potential_constant_expression_1): Check
5183         TARGET_EXPR_DIRECT_INIT_P.
5185 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
5187         PR c++/81013
5188         * decl.c (xref_basetypes): Early return upon error about derived
5189         union.
5191 2018-01-18  Nathan Sidwell  <nathan@acm.org>
5193         PR c++/83160
5194         * cp-tree.h (mark_use): Declare.
5195         * expr.c (mark_use): Make extern.
5196         * call.c (direct_reference_binding): Set inner conv's
5197         rvaluedness_matches_p, if it is an identity.
5198         (convert_like_real): Mark lvalue or rvalue use for identity as
5199         rvaledness_matches_p demands.
5201 2018-01-18  Jakub Jelinek  <jakub@redhat.com>
5203         PR c++/83824
5204         * parser.c (attr_chainon): New function.
5205         (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
5206         cp_parser_namespace_definition, cp_parser_init_declarator,
5207         cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
5208         cp_parser_gnu_attributes_opt): Use it.
5209         (cp_parser_member_declaration, cp_parser_objc_class_ivars,
5210         cp_parser_objc_struct_declaration): Likewise.  Don't reset
5211         prefix_attributes if attributes is error_mark_node.
5213 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
5215         PR c++/78344
5216         * decl.c (grokdeclarator): Do not append the error_mark_node
5217         due to an erroneous optional attribute-specifier-seq.
5219 2018-01-17  Jakub Jelinek  <jakub@redhat.com>
5221         PR c++/83897
5222         * cp-gimplify.c (cp_maybe_instrument_return): Handle
5223         CLEANUP_POINT_EXPR.
5225 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
5227         PR c++/81054
5228         * constexpr.c (ensure_literal_type_for_constexpr_object): Return
5229         error_mark_node when we give an error.
5230         * decl.c (cp_finish_decl): Use the latter.
5232 2018-01-17  Nathan Sidwell  <nathan@acm.org>
5234         PR c++/83287
5235         * init.c (build_raw_new_expr): Scan list for lookups to keep.
5237 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
5239         PR c++/83814
5240         * expr.c (fold_for_warn): Move from c-common.c, reducing to just
5241         the C++ part.  If processing a template, call
5242         fold_non_dependent_expr rather than fully folding.
5244 2018-01-17  Jason Merrill  <jason@redhat.com>
5246         PR c++/81067 - redundant NULL warning.
5247         * call.c (convert_like_real): Restore null_node handling.
5249 2018-01-17  Jason Merrill  <jason@redhat.com>
5251         PR c++/81843 - ICE with variadic member template.
5252         PR c++/72801
5253         * pt.c (unify_pack_expansion): Don't try to deduce enclosing
5254         template args.
5256 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
5258         PR c++/83799
5259         * pt.c (type_dependent_expression_p): Strip any location wrapper
5260         before testing tree codes.
5261         (selftest::test_type_dependent_expression_p): New function.
5262         (selftest::cp_pt_c_tests): Call it.
5264 2018-01-17  Nathan Sidwell  <nathan@acm.org>
5266         PR c++/83739
5267         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
5268         this not a final instantiation.
5270 2018-01-16  Jason Merrill  <jason@redhat.com>
5272         PR c++/83714 - ICE checking return in template.
5273         * typeck.c (check_return_expr): Call build_non_dependent_expr.
5275 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
5277         PR c++/83817
5278         * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
5279         is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
5280         instead of CALL_FROM_THUNK_P.
5282         PR c++/83825
5283         * name-lookup.c (member_vec_dedup): Return early if len is 0.
5284         (resort_type_member_vec, set_class_bindings,
5285         insert_late_enum_def_bindings): Use vec qsort method instead of
5286         calling qsort directly.
5288 2018-01-15  Martin Sebor  <msebor@redhat.com>
5290         PR c++/83588
5291         * class.c (find_flexarrays): Make a record of multiple flexible array
5292         members.
5294 2018-01-12  Jason Merrill  <jason@redhat.com>
5296         PR c++/83186 - ICE with static_cast of list-initialized temporary.
5297         * typeck.c (build_static_cast): Use build_non_dependent_expr.
5299 2018-01-12  Nathan Sidwell  <nathan@acm.org>
5301         * cp-tree.h (mark_rvalue_use): Add parm name.
5302         * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
5303         mark_rvalue_use.
5304         * call.c (convert_like_real): Fix formatting.
5306 2018-01-11  Jason Merrill  <jason@redhat.com>
5308         PR c++/82728 - wrong -Wunused-but-set-variable
5309         PR c++/82799
5310         PR c++/83690
5311         * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
5312         * decl.c (case_conversion): Likewise.
5313         * semantics.c (finish_static_assert): Call
5314         perform_implicit_conversion_flags.
5316 2018-01-11  Nathan Sidwell  <nathan@acm.org>
5318         * method.c (enum mangling_flags): Delete long-dead enum.
5320 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
5322         * parser.c (cp_parser_std_attribute_spec): When
5323         token_pair::require_open / require_close return false simply
5324         return error_mark_node, avoid duplicate cp_parser_error about
5325         expected '(' / ')', respectively.
5327 2018-01-10  David Malcolm  <dmalcolm@redhat.com>
5329         PR c++/43486
5330         * call.c (null_ptr_cst_p): Strip location wrappers when
5331         converting from '0' to a pointer type in C++11 onwards.
5332         (conversion_null_warnings): Replace comparison with null_node with
5333         call to null_node_p.
5334         (build_over_call): Likewise.
5335         * cp-gimplify.c (cp_fold): Remove the early bailout when
5336         processing_template_decl.
5337         * cp-lang.c (selftest::run_cp_tests): Call
5338         selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
5339         * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
5340         (selftest::run_cp_tests): Move decl to bottom of file.
5341         (null_node_p): New inline function.
5342         (selftest::cp_pt_c_tests): New decl.
5343         (selftest::cp_tree_c_tests): New decl.
5344         * cvt.c (build_expr_type_conversion): Replace comparison with
5345         null_node with call to null_node_p.
5346         * error.c (args_to_string): Likewise.
5347         * except.c (build_throw): Likewise.
5348         * mangle.c (write_expression): Skip location wrapper nodes.
5349         * parser.c (literal_integer_zerop): New function.
5350         (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
5351         the result for RID_TYPEID. Pass true for new "wrap_locations_p"
5352         param of cp_parser_parenthesized_expression_list.  When calling
5353         warn_for_memset, replace integer_zerop calls with
5354         literal_integer_zerop, eliminating the double logical negation
5355         cast to bool.  Eliminate the special-casing for CONST_DECL in
5356         favor of the fold_for_warn within warn_for_memset.
5357         (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
5358         param, defaulting to false.  Convert "expr" to a cp_expr, and call
5359         maybe_add_location_wrapper on it when wrap_locations_p is true.
5360         (cp_parser_unary_expression): Call maybe_add_location_wrapper on
5361         the result for RID_ALIGNOF and RID_SIZEOF.
5362         (cp_parser_builtin_offsetof): Likewise.
5363         * pt.c: Include "selftest.h".
5364         (tsubst_copy): Handle location wrappers.
5365         (tsubst_copy_and_build): Likewise.
5366         (build_non_dependent_expr): Likewise.
5367         (selftest::test_build_non_dependent_expr): New function.
5368         (selftest::cp_pt_c_tests): New function.
5369         * tree.c: Include "selftest.h".
5370         (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
5371         (selftest::test_lvalue_kind): New function.
5372         (selftest::cp_tree_c_tests): New function.
5373         * typeck.c (string_conv_p): Strip any location wrapper from "exp".
5374         (cp_build_binary_op): Replace comparison with null_node with call
5375         to null_node_p.
5376         (build_address): Use location of operand when building address
5377         expression.
5379 2018-01-10  Marek Polacek  <polacek@redhat.com>
5381         PR c++/82541
5382         * call.c (build_conditional_expr_1): Check complain before warning.
5383         * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
5384         -Wduplicated-branches.
5386 2018-01-10  Jakub Jelinek  <jakub@redhat.com>
5388         PR c++/81327
5389         * call.c (maybe_warn_class_memaccess): Add forward declaration.
5390         Change last argument from tree * to const vec<tree, va_gc> *, adjust
5391         args uses and check number of operands too.  Don't strip away any
5392         nops.  Use maybe_constant_value when looking for INTEGER_CST args.
5393         Deal with src argument not having pointer type.  Check
5394         tree_fits_uhwi_p before calling tree_to_uhwi.  Remove useless
5395         test.
5396         (build_over_call): Call maybe_warn_class_memaccess here on the
5397         original arguments.
5398         (build_cxx_call): Rather than here on converted arguments.
5400 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
5402         PR c++/81055
5403         * init.c (build_vec_init): Avoid building an INIT_EXPR with
5404         error_mark_node as second argument.
5406 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
5408         PR c++/83734
5409         * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
5410         in STATEMENT_LIST.  Remove unneeded assert.
5412 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5413             Alan Hayward  <alan.hayward@arm.com>
5414             David Sherwood  <david.sherwood@arm.com>
5416         * constexpr.c (cxx_eval_array_reference): Handle polynomial
5417         VECTOR_CST_NELTS.
5418         (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
5419         * call.c (build_conditional_expr_1): Likewise.
5420         * decl.c (cp_finish_decomp): Likewise.
5421         * mangle.c (write_type): Likewise.
5422         * typeck.c (structural_comptypes): Likewise.
5423         (cp_build_binary_op): Likewise.
5424         * typeck2.c (process_init_constructor_array): Likewise.
5426 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
5428         PR c++/83555
5429         * typeck.c (build_static_cast_1): For static casts to reference types,
5430         call build_base_path with flag_delete_null_pointer_checks as nonnull
5431         instead of always false.  When -fsanitize=null, call
5432         ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
5433         * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
5434         call if the first argument is INTEGER_CST with REFERENCE_TYPE.
5436 2018-01-03  Nathan Sidwell  <nathan@acm.org>
5438         PR c++/83667
5439         * method.c (make_alias_for): Copy DECL_CONTEXT.
5441 2018-01-03  Marek Polacek  <polacek@redhat.com>
5443         PR c++/83592
5444         * decl.c (grokdeclarator): Don't warn about MVP in typename context.
5446 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
5448         PR preprocessor/83602
5449         * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
5450         for builtin macros.
5452         PR c++/83634
5453         * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
5454         error_mark_node, return error_mark_node.
5456         Update copyright years.
5458 2018-01-02  Jakub Jelinek  <jakub@redhat.com>
5460         PR c++/83556
5461         * tree.c (replace_placeholders_r): Pass NULL as last argument to
5462         cp_walk_tree instead of d->pset.  If non-TREE_CONSTANT and
5463         non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
5464         to false and return.
5465         (replace_placeholders): Pass NULL instead of &pset as last argument
5466         to cp_walk_tree.
5468 2018-01-02  Nathan Sidwell  <nathan@acm.org>
5470         * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
5471         lval var.
5473 Copyright (C) 2018 Free Software Foundation, Inc.
5475 Copying and distribution of this file, with or without modification,
5476 are permitted in any medium without royalty provided the copyright
5477 notice and this notice are preserved.