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