* cp-tree.h (struct cp_evaluated): New.
[official-gcc.git] / gcc / cp / ChangeLog
blob066d293e531ef329f226b8af34c7fba3ca538f6c
1 2018-11-12  Jason Merrill  <jason@redhat.com>
3         * cp-tree.h (struct cp_evaluated): New.
4         * init.c (get_nsdmi): Use it.
5         * parser.c (cp_parser_enclosed_template_argument_list): Use it.
6         * pt.c (coerce_template_parms, tsubst_aggr_type): Use it.
8 2018-11-09  Jakub Jelinek  <jakub@redhat.com>
10         * parser.c (cp_parser_omp_clause_final, cp_parser_omp_clause_if): Use
11         cp_parser_assignment_expression instead of cp_parser_condition.
12         (cp_parser_omp_clause_num_threads, cp_parser_omp_clause_num_tasks,
13         cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority,
14         cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit,
15         cp_parser_omp_clause_linear, cp_parser_omp_clause_device): Use
16         cp_parser_assignment_expression instead of cp_parser_expression.
17         (cp_parser_omp_clause_hint): Likewise.  Formatting fix.
19         * parser.c (cp_parser_omp_clause_reduction): Call sorry_at on
20         reduction clause with inscan modifier.
22         * parser.c (cp_parser_omp_requires): Call sorry_at on requires
23         clauses other than atomic_default_mem_order.
25 2018-11-09  Martin Sebor  <msebor@redhat.com>
27         PR middle-end/81824
28         * pt.c (warn_spec_missing_attributes): Move code to attribs.c.
29         Call decls_mismatched_attributes.
31 2018-11-08  Jakub Jelinek  <jakub@redhat.com>
33         * constexpr.c (potential_constant_expression_1): Handle OMP_DEPOBJ.
34         * cp-gimplify.c (cp_genericize_r): Handle
35         OMP_CLAUSE_{IN,TASK}_REDUCTION.
36         (cxx_omp_predetermined_sharing_1): Don't return
37         OMP_CLAUSE_DEFAULT_SHARED for const qualified decls with no mutable
38         member.  Return OMP_CLAUSE_DEFAULT_FIRSTPRIVATE for this pointer.
39         * cp-objcp-common.c (cp_common_init_ts): Handle OMP_DEPOBJ.
40         * cp-tree.def (OMP_DEPOBJ): New tree code.
41         * cp-tree.h (OMP_ATOMIC_DEPENDENT_P): Return true also for first
42         argument being OMP_CLAUSE.
43         (OMP_DEPOBJ_DEPOBJ, OMP_DEPOBJ_CLAUSES): Define.
44         (cp_convert_omp_range_for, cp_finish_omp_range_for): Declare.
45         (finish_omp_atomic): Add LOC, CLAUSES and MO arguments.  Remove
46         SEQ_CST argument.
47         (finish_omp_for_block): Declare.
48         (finish_omp_flush): Add MO argument.
49         (finish_omp_depobj): Declare.
50         * cxx-pretty-print.c (cxx_pretty_printer::statement): Handle
51         OMP_DEPOBJ.
52         * dump.c (cp_dump_tree): Likewise.
53         * lex.c (cxx_init): Likewise.
54         * parser.c: Include memmodel.h.
55         (cp_parser_for): Pass false as new is_omp argument to
56         cp_parser_range_for.
57         (cp_parser_range_for): Add IS_OMP argument, return before finalizing
58         if it is true.
59         (cp_parser_omp_clause_name): Handle nontemporal, in_reduction and
60         task_reduction clauses.
61         (cp_parser_omp_var_list_no_open): Handle
62         OMP_CLAUSE_{IN,TASK}_REDUCTION.  For OMP_CLAUSE_DEPEND, parse clause
63         operands as either an array section, or lvalue assignment expression.
64         (cp_parser_omp_clause_if): Handle cancel and simd modifiers.
65         (cp_parser_omp_clause_defaultmap): Parse new kinds of defaultmap
66         clause.
67         (cp_parser_omp_clause_reduction): Add IS_OMP and KIND arguments.
68         Parse reduction modifiers.  Pass KIND to c_parser_omp_variable_list.
69         (cp_parser_omp_clause_lastprivate, cp_parser_omp_iterators): New
70         functions.
71         (cp_parser_omp_clause_depend): Parse iterator modifier and handle
72         iterators.  Parse mutexinoutset and depobj kinds.
73         (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_reduction
74         callers.
75         (cp_parser_omp_all_clauses): Likewise.  Handle
76         PRAGMA_OMP_CLAUSE_NONTEMPORAL and
77         PRAGMA_OMP_CLAUSE_{IN,TASK}_REDUCTION.  Call
78         cp_parser_omp_clause_lastprivate for OpenMP lastprivate clause.
79         (cp_parser_omp_atomic): Pass pragma_tok->location as
80         LOC to finish_omp_atomic.  Parse hint and memory order clauses.
81         Handle default memory order from requires directive if any.  Adjust
82         finish_omp_atomic caller.
83         (cp_parser_omp_critical): Allow comma in between (name) and hint
84         clause.
85         (cp_parser_omp_depobj): New function.
86         (cp_parser_omp_flush): Parse flush with memory-order-clause.
87         (cp_parser_omp_for_cond): Allow NE_EXPR even in OpenMP loops.
88         (cp_convert_omp_range_for, cp_finish_omp_range_for): New functions.
89         (cp_parser_omp_for_loop): Parse C++11 range for loops among omp
90         loops.  Handle OMP_CLAUSE_IN_REDUCTION like OMP_CLAUSE_REDUCTION.
91         (OMP_SIMD_CLAUSE_MASK): Add if and nontemporal clauses.
92         (cp_parser_omp_simd, cp_parser_omp_for): Call keep_next_level before
93         begin_omp_structured_block and call finish_omp_for_block on
94         finish_omp_structured_block result.
95         (cp_parser_omp_master): Add p_name, mask and cclauses arguments.
96         Allow to be called while parsing combined parallel master.
97         Parse combined master taskloop{, simd}.
98         (cp_parser_omp_parallel): Parse combined
99         parallel master{, taskloop{, simd}} constructs.
100         (cp_parser_omp_single): Use SET_EXPR_LOCATION.
101         (OMP_TASK_CLAUSE_MASK): Add in_reduction clause.
102         (OMP_TASKWAIT_CLAUSE_MASK): Define.
103         (cp_parser_omp_taskwait): Handle taskwait with depend clauses.
104         (OMP_TASKGROUP_CLAUSE_MASK): Define.
105         (cp_parser_omp_taskgroup): Parse taskgroup clauses, adjust
106         c_finish_omp_taskgroup caller.
107         (cp_parser_omp_distribute): Call keep_next_level before
108         begin_omp_structured_block and call finish_omp_for_block on
109         finish_omp_structured_block result.
110         (cp_parser_omp_teams): Force a BIND_EXPR with BLOCK around teams
111         body.
112         (cp_parser_omp_target_data): Allow target data with only
113         use_device_ptr clauses.
114         (cp_parser_omp_target): Set OMP_REQUIRES_TARGET_USED bit in
115         omp_requires_mask.
116         (cp_parser_omp_requires): New function.
117         (OMP_TASKLOOP_CLAUSE_MASK): Add reduction and in_reduction clauses.
118         (cp_parser_omp_taskloop): Add forward declaration.  Disallow
119         in_reduction clause when combined with parallel master.  Call
120         keep_next_level before begin_omp_structured_block and call
121         finish_omp_for_block on finish_omp_structured_block result.
122         (cp_parser_omp_construct): Adjust cp_parser_omp_master caller.
123         (cp_parser_pragma): Handle PRAGMA_OMP_DEPOBJ and PRAGMA_OMP_REQUIRES.
124         * pt.c (tsubst_omp_clause_decl): Add iterators_cache argument.
125         Adjust recursive calls.  Handle iterators.
126         (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION and
127         OMP_CLAUSE_NONTEMPORAL.  Adjust tsubst_omp_clause_decl callers.
128         (tsubst_decomp_names):
129         (tsubst_omp_for_iterator): Change orig_declv into a reference.
130         Handle range for loops.  Move orig_declv handling after declv/initv
131         handling.
132         (tsubst_expr): Force a BIND_EXPR with BLOCK around teams body.
133         Adjust finish_omp_atomic caller.  Call keep_next_level before
134         begin_omp_structured_block.  Call cp_finish_omp_range_for for range
135         for loops and use {begin,finish}_omp_structured_block instead of
136         {push,pop}_stmt_list if there are any range for loops.  Call
137         finish_omp_for_block on finish_omp_structured_block result.
138         Handle OMP_DEPOBJ.  Handle taskwait with depend clauses.  For
139         OMP_ATOMIC call tsubst_omp_clauses on clauses if any, adjust
140         finish_omp_atomic caller.  Use OMP_ATOMIC_MEMORY_ORDER rather
141         than OMP_ATOMIC_SEQ_CST.  Handle clauses on OMP_TASKGROUP.
142         (dependent_omp_for_p): Always return true for range for loops if
143         processing_template_decl.  Return true if class type iterator
144         does not have INTEGER_CST increment.
145         * semantics.c: Include memmodel.h.
146         (handle_omp_array_sections_1): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION
147         like OMP_CLAUSE_REDUCTION.
148         (handle_omp_array_sections): Likewise.  Call save_expr on array
149         reductions before calling build_index_type.  Handle depend clauses
150         with iterators.
151         (finish_omp_reduction_clause): Call save_expr for whole array
152         reduction sizes.  Don't mark OMP_CLAUSE_DECL addressable if it has
153         reference type.  Do mark decl_placeholder addressable if needed.
154         Use error_at with OMP_CLAUSE_LOCATION (c) as first argument instead
155         of error.
156         (cp_omp_finish_iterators): New function.
157         (finish_omp_clauses): Don't diagnose nonmonotonic clause with static,
158         runtime or auto schedule kinds.  Diagnose nogroup clause used with
159         reduction clause(s).  Handle depend clause with
160         OMP_CLAUSE_DEPEND_DEPOBJ.  Diagnose bit-fields.  Require
161         omp_depend_t type for OMP_CLAUSE_DEPEND_DEPOBJ kinds and
162         some different type for other kinds.  Use cp_build_addr_expr
163         and cp_build_indirect_ref instead of cxx_mark_addressable.
164         Handle depend clauses with iterators.  Only handle static data members
165         in the special case that const qualified vars may be specified in
166         firstprivate clause.  Complain if const qualified vars without mutable
167         members are mentioned in data-sharing clauses other than firstprivate
168         or shared.  Use error_at with OMP_CLAUSE_LOCATION (c) as first
169         argument instead of error.  Diagnose more than one nontemporal clause
170         refering to the same variable.  Use error_at rather than error for
171         priority and hint clause diagnostics.  Fix pasto for hint clause.
172         Diagnose hint expression that doesn't fold into INTEGER_CST.
173         Diagnose if clause with modifier other than cancel.  Handle
174         OMP_CLAUSE_{IN,TASK}_REDUCTION like OMP_CLAUSE_REDUCTION.  Allow any
175         lvalue as OMP_CLAUSE_DEPEND operand (besides array section), adjust
176         diagnostics.
177         (handle_omp_for_class_iterator): Don't create a new TREE_LIST if one
178         has been created already for range for, just fill TREE_PURPOSE and
179         TREE_VALUE.  Call cp_fully_fold on incr.
180         (finish_omp_for): Don't check cond/incr if cond is global_namespace.
181         Pass to c_omp_check_loop_iv_exprs orig_declv if non-NULL.  Don't
182         use IS_EMPTY_STMT on NULL pre_body.  Adjust c_finish_omp_for caller.
183         (finish_omp_for_block): New function.
184         (finish_omp_atomic): Add LOC argument, pass it through
185         to c_finish_omp_atomic and set it as location of OMP_ATOMIC* trees.
186         Remove SEQ_CST argument.  Add CLAUSES and MO arguments.  Adjust
187         c_finish_omp_atomic caller.  Stick clauses if any into first argument
188         of wrapping OMP_ATOMIC.
189         (finish_omp_depobj): New function.
190         (finish_omp_flush): Add MO argument, if not
191         MEMMODEL_LAST, emit __atomic_thread_fence call with the given value.
192         (finish_omp_cancel): Diagnose if clause with modifier other than
193         cancel.
195 2018-11-07  Nathan Sidwell  <nathan@acm.org>
197         PR c++/87904
198         * cp-tree.h (struct tree_overload): Fix comment.
199         * tree.c (ovl_iterator::reveal_node): Propagate OVL_DEDUP_P.
201 2018-11-04  Jason Merrill  <jason@redhat.com>
203         Implement UDL changes from P0732R2.
204         * cp-tree.h (struct releasing_vec): Move from mangle.c.
205         Add get_ref method.
206         * parser.c (cp_parser_userdef_string_literal): Use it.  Handle
207         passing the string to a single template parameter of class type.
208         (cp_parser_template_declaration_after_parameters): Allow it.
209         Pedwarn about the character pack template that was proposed but not
210         accepted for C++14, and don't suggest it.
212         Implement P0732R2, class types in non-type template parameters.
213         * error.c (dump_simple_decl): Look through a template parm object.
214         * mangle.c (write_template_arg): Likewise.
215         (mangle_template_parm_object): New.
216         * pt.c (template_parm_object_p, get_template_parm_object): New.
217         (invalid_tparm_referent_p): Factor from convert_nontype_argument.
218         (convert_nontype_argument, invalid_nontype_parm_type_p): Handle
219         class-type template arguments.
220         * tree.c (lvalue_kind): Likewise.
222         * cvt.c (ocp_convert): Don't wrap a CONSTRUCTOR in a NOP_EXPR.
223         * constexpr.c (initialized_type): Fix AGGR_INIT_EXPR handling.
224         (cxx_eval_vec_init_1): Correct type of AGGR_INIT_EXPR.
225         (cxx_eval_outermost_constant_expr): Make sure a CONSTRUCTOR has the
226         right type.  Don't wrap a CONSTRUCTOR if one was passed in.
227         * tree.c (build_aggr_init_expr): Check for void.
229         PR c++/60503 - wrong lambda attribute syntax.
230         * parser.c (cp_parser_lambda_declarator_opt): Fix attribute
231         handling.
233 2018-11-02  Nathan Sidwell  <nathan@acm.org>
235         * decl.c (duplicate_decls): Refactor checks.
237 2018-11-01  Marek Polacek  <polacek@redhat.com>
239         Implement P0846R0, ADL and function templates.
240         * decl.c (grokfndecl): Allow FUNCTION_DECL in assert.
241         * lex.c (unqualified_fn_lookup_error): Handle TEMPLATE_ID_EXPR.
242         * parser.c (cp_parser_postfix_expression): Do ADL for a template-name.
243         (cp_parser_template_id): Give errors if parsing the template argument
244         list didn't go well.  Allow FUNCTION_DECL in assert.
245         (cp_parser_template_name): Consider a name to refer to a template if
246         it is an unqualified-id followed by a <.  Don't return the identifier
247         if the decl is a function and dependent.
248         * pt.c (tsubst_copy) <case OVERLOAD>: Remove assert.
250 2018-11-01  Nathan Sidwell  <nathan@acm.org>
252         * cp-tree.h (struct lang_function): Delete x_local_names field.
253         (struct lang_decl_base): Rename u2sel to spare.
254         (struct lang_decl_min): Remove lang_decl_u2 union.  Keep access
255         field.
256         (LANG_DECL_U2_CHECK): Delete.
257         (DECL_DISCRIMINATOR_P): Require function scope.
258         (DECL_DISCRIMINATOR): Adjust.
259         (DECL_DISCRIMINATOR_SET_P): Delete.
260         (DECL_CAPTURED_VARIABLE, DECL_ACCESS, THUnK_VIRTUAL_OFFSET): Adjust.
261         (local_classes): Don't declare.
262         (determine_local_discriminator): Declare.
263         * decl.c (push_local_name): Delete.
264         (local_entities, determina_local_discrminator): New.
265         (duplicate_decls): Copy DECL_ACCESS. Fix formatting.
266         (cp_finish_decl): Use determine_local_discriminator.
267         (save_function_data): Drop x_local_names.
268         (finish_function): Drop local_names.
269         * decl2.c (finish_anon_union): Use determine_local_disciminator.
270         * mangle.c (write_unnamed_type_name): Use
271         discriminator_for_local_entity.
272         (local_class_index): Delete.
273         (discriminator_for_local_entity): Reimplement.
274         (write_local_name): Adjust discriminator code.
275         * name-lookup.c (do_pushtag): Call determine_local_discrimiator.
276         * semantics.c (finish_omp_threadprivate): Drop DECL_DISCRIMINATOR
277         handling.
278         * class.c (local_classes): Delete.
279         (init_class_processing): Don't init it.
281 2018-11-01  Martin Liska  <mliska@suse.cz>
282             Jason Merrill  <jason@redhat.com>
284         PR c++/64266
285         PR bootstrap/70422
286         PR ipa/81277
287         * cp-tree.h (DECL_FNAME_P): New macro.
288         * decl.c (cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P,
289         DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
290         (cp_finish_decl):
291         * lambda.c (is_capture_proxy): Use DECL_FNAME_P.
292         * pt.c (tsubst_expr): Handle DECL_PRETTY_FUNCTION_P.
294 2018-10-31  Nathan Sidwell  <nathan@acm.org>
296         * cp-tree.h (OVL_DEDUP_P): New.
297         * name-lookup.c (name_lookup::add_overload): Check OVL_DEDUP_P.
298         (get_class_binding_direct): Likwise.
299         * tree.c (ovl_make): Propagate OVL_DEDUP_P.
300         (ovl_copy): Copy it.
301         (ovl_insert): Do not keep using-decls ordered.
302         (lookup_maybe_add): Adjust comment.
304 2018-10-30  Marek Polacek  <polacek@redhat.com>
306         Implement P0892R2, explicit(bool).
307         * call.c (add_template_candidate_real): Return if the declaration is
308         explicit and we're only looking for non-converting constructor.
309         * cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit.
310         (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro.
311         (cp_decl_specifier_seq): Add explicit_specifier field.
312         (build_explicit_specifier, store_explicit_specifier): Declare.
313         * decl.c (grokdeclarator): Call store_explicit_specifier.
314         (build_explicit_specifier): New function.
315         * parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>:
316         Parse C++20 explicit(bool).
317         * pt.c (store_explicit_specifier, lookup_explicit_specifier): New.
318         (tsubst_function_decl): Handle explicit(dependent-expr).
320 2018-10-30  Paolo Carlini  <paolo.carlini@oracle.com>
322         * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
323         about flexible array members.
325 2018-10-29  David Malcolm  <dmalcolm@redhat.com>
327         * cp-name-hint.h: New file.
328         * cp-tree.h (expr_to_string): New decl.
329         (suggest_alternatives_for): Move to cp-name-hint.h, changing
330         return type from bool to name_hint.
331         (suggest_alternative_in_explicit_scope): Likewise.
332         * error.c: Define INCLUDE_UNIQUE_PTR.  Include "cp-name-hint.h".
333         (expr_to_string): Make non-static.
334         (qualified_name_lookup_error): For the non-"::" case, take
335         responsibity for issuing any suggestion from
336         suggest_alternative_in_explicit_scope, as it changes from
337         returning a bool to returning a name_hint.  Replace fallback call
338         to suggest_alternatives_for to a call to
339         suggest_alternatives_in_other_namespaces, capturing the fact that
340         we don't have enough location information to issue a fix-it hint
341         for this case.  Update the error to support emitting a fix-it hint
342         where appropriate.  For the "::" case, take responsibility for
343         issuing any suggestion from suggest_alternatives_for, supporting
344         emitting a fix-it hint.
345         * lex.c: Define INCLUDE_UNIQUE_PTR.  Include "gcc-rich-location.h"
346         and "cp-name-hint.h".
347         (unqualified_name_lookup_error): Take responsibility for issuing
348         any suggestion from suggest_alternatives_for, supporting emitting
349         a fix-it hint.
350         * name-lookup.c (class namespace_limit_reached): New subclass of
351         deferred_diagnostic.
352         (class show_candidate_location): Likewise.
353         (class suggest_alternatives): Likewise.
354         (class namespace_hints): New class.
355         (suggest_alternatives_for): Convert return type from bool to
356         name_hint, replacing all direct diagnostic emission by setting
357         suggestions on the return value, or creating deferred diagnostics.
358         Specifically, split out initial traversal of namespaces into
359         namespace_hints' ctor, and maybe_decorate_with_limit, and move the
360         rest of the implementation to
361         namespace_hints::convert_candidates_to_name_hint and
362         suggest_alternatives_for_1.
363         (namespace_hints::namespace_hints): New ctor, adapted from
364         suggest_alternatives_for's initial namespace traversal, storing
365         location and name, and converting locals "candidates", "limited"
366         and "limit" into members.
367         (namespace_hints::convert_candidates_to_name_hint): New member
368         function.
369         (namespace_hints::maybe_decorate_with_limit): New member function.
370         (suggest_alternatives_for_1): New function, based on second half
371         of old implementation of suggest_alternatives_for, converting from
372         immediate emission of suggestions to using name_hint.
373         (suggest_alternatives_in_other_namespaces): New function.
374         (maybe_suggest_missing_std_header): Convert from immediate
375         emission of suggestions to using name_hint, moving emission
376         implementation to...
377         (class missing_std_header): New subclass of deferred_diagnostic.
378         (maybe_suggest_missing_header): Convert return type from bool to
379         name_hint.
380         (suggest_alternative_in_explicit_scope): Convert from immediate
381         emission of suggestions to using name_hint.
382         * parser.c: Replace include of "c-family/name-hint.h" with
383         "cp-name-hint.h".
384         (cp_parser_diagnose_invalid_type_name): Update
385         "is there a suggestion" logic for change to
386         name_hint::operator bool.  Take responsibility for emitting
387         fix-it hints from suggest_alternative_in_explicit_scope.
388         (cp_parser_namespace_name): Take responsibility for emitting
389         fix-it hints from suggest_alternative_in_explicit_scope.  Don't
390         emit the "expected namespace-name" error if we've already emitted
391         an "is not a namespace-name" error.
393 2018-10-29  David Malcolm  <dmalcolm@redhat.com>
395         PR c++/56856
396         * call.c (build_over_call): Eliminate the "arglocs" array, and the
397         call to maybe_constant_value when building "fargs".
399 2018-10-29  Paolo Carlini  <paolo.carlini@oracle.com>
401         * decl.c (create_array_type_for_decl): Add location_t parameter
402         and use it.
403         (grokdeclarator): Adjust call.
405 2018-10-29  Marek Polacek  <polacek@redhat.com>
407         PR c++/87594 - constexpr rejects-valid with range-based for.
408         * constexpr.c (potential_constant_expression_1): If the condition
409         can't be evaluated, return true.
411 2018-10-29  Joseph Myers  <joseph@codesourcery.com>
412             Julian Brown  <julian@codesourcery.com>
414         PR c++/66053
415         * semantics.c (handle_omp_array_sections_1): Allow array
416         sections with "this" pointer for OpenACC.
418 2018-10-25  Jason Merrill  <jason@redhat.com>
420         * parser.c (cp_parser_sizeof_operand): Remove redundant use of
421         grokdeclarator.
423 2018-10-24  Jakub Jelinek  <jakub@redhat.com>
425         PR c++/86288
426         * parser.c (cp_parser_std_attribute): Canonicalize attr_ns, and when
427         :: is not present and attr_ns non-NULL, canonicalize also attr_id.
428         (cp_parser_attribute_spec): Fix comment typo.
430 2018-10-24  Martin Sebor  <msebor@redhat.com>
432         PR c++/84851
433         * call.c (maybe_warn_class_memaccess): Tighten up.
435 2018-10-17  David Malcolm  <dmalcolm@redhat.com>
437         * Make-lang.in (selftest-c++): New.
438         (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
439         (selftest-c++-gdb, selftest-c++-valgrind): Move here from
440         gcc/Makefile.in.
442 2018-10-17  Paolo Carlini  <paolo.carlini@oracle.com>
444         PR c++/84705
445         * tree.c (build_cplus_new): Avoid duplicate diagnostic about
446         incomplete type, early return error_mark_node if the second
447         argument is error_mark_node.
449 2018-10-12  Nathan Sidwell  <nathan@acm.org>
451         * parser.h (struct cp_parser): Drop implicit_extern_c.
452         * parser.c (cp_debug_parser): Drop implicit_extern_c.
453         (cp_parser_new): Likewise.
454         (cp_parser_translation_unit): Handle implicit extern c here.  Call
455         cp_parser_toplevel_declaration.
456         (cp_parser_toplevel_declaration): New, broken out of ...
457         (cp_parser_declaration_seq_opt): ... here.  Call it.  Drop
458         implicit extern C handling.
460 2018-10-11  Will Wray  <wjwray@gmail.com>
462         PR c++/87364
463         * cxx-pretty-print.c (pp_cxx_enumeration_constant): New function.
464         (cxx_pretty_printer::constant): Use it.
466 2018-10-11  David Malcolm  <dmalcolm@redhat.com>
468         PR c++/84993
469         * call.c (enforce_access): Move diagnostics to...
470         (complain_about_access): ...this new function.
471         * cp-tree.h (class access_failure_info): Rename split out field
472         "m_field_decl" into "m_decl" and "m_diag_decl".
473         (access_failure_info::record_access_failure): Add tree param.
474         (access_failure_info::was_inaccessible_p): New accessor.
475         (access_failure_info::get_decl): New accessor.
476         (access_failure_info::get_diag_decl): New accessor.
477         (access_failure_info::get_any_accessor): New member function.
478         (access_failure_info::add_fixit_hint): New static member function.
479         (complain_about_access): New decl.
480         * typeck.c (access_failure_info::record_access_failure): Update
481         for change to fields.
482         (access_failure_info::maybe_suggest_accessor): Split out into...
483         (access_failure_info::get_any_accessor): ...this new function...
484         (access_failure_info::add_fixit_hint): ...and this new function.
485         (finish_class_member_access_expr): Split out "has no member named"
486         error-handling into...
487         (complain_about_unrecognized_member): ...this new function, and
488         check that the guessed name is accessible along the access path.
489         Only provide a spell-correction fix-it hint if it is; otherwise,
490         attempt to issue an accessor fix-it hint.
492 2018-10-11  Nathan Sidwell  <nathan@acm.org>
494         * parser.c (cp_parser_translation_unit): Return void.  Don't fail
495         at first extra }, simplify logic.
496         (c_parse_file): Call finish_translation_unit here.
498 2018-10-11  Jakub Jelinek  <jakub@redhat.com>
500         PR c++/87582
501         * typeck.c (maybe_warn_about_returning_address_of_local): If
502         whats_returned is a structured binding identifier and the structured
503         binding is a reference, recurse on its initializer.
505         PR c++/87547
506         * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead
507         of TREE_TYPE.
509 2018-10-10  Marek Polacek  <polacek@redhat.com>
511         PR c++/87567 - constexpr rejects call to non-constexpr function.
512         * constexpr.c (potential_constant_expression_1) <case FOR_STMT>: Return
513         true if the condition is always false.
514         <case WHILE_STMT>: Likewise.
516 2018-10-09  Paolo Carlini  <paolo.carlini@oracle.com>
518         PR c++/84423
519         * pt.c (convert_template_argument): Immediately return error_mark_node
520         if the second argument is erroneous.
521         * parser.c (cp_parser_type_id): Add location_t * parameter.
522         (cp_parser_type_id_1): Likewise.
523         (cp_parser_alias_declaration): Adjust cp_parser_type_id call,
524         obtain the location of the type and save it.
525         (cp_parser_template_type_arg): Adjust.
526         (cp_parser_trailing_type_id): Likewise.
527         * decl.c (grokdeclarator): Improve error message for 'auto' in
528         alias declaration.
530 2018-10-08  Paolo Carlini  <paolo.carlini@oracle.com>
532         PR c++/71128
533         * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
534         explicitly instantiated.
536 2018-10-05  David Malcolm  <dmalcolm@redhat.com>
538         PR c++/56856
539         * call.c (build_over_call): Build a vec of locations of the
540         arguments before the call to maybe_constant_value, and pass to
541         check_function_arguments.
542         * cp-lang.c (LANG_HOOKS_GET_SUBSTRING_LOCATION): Define as
543         c_get_substring_location.
544         * parser.c (cp_parser_string_literal): Capture string
545         concatenation locations.
547 2018-10-04  Nathan Sidwell  <nathan@acm.org>
549         * lang-specs.h: Use string contatenation, not line splicing.
551 2018-10-03  Jason Merrill  <jason@redhat.com>
553         Implement P0840, language support for empty objects.
554         * tree.c (handle_no_unique_addr_attribute): New.
555         (cxx_attribute_table): Add [[no_unique_address]].
556         * class.c (field_poverlapping_p): New.
557         (layout_class_type): Check it.  Adjust DECL_SIZE of potentially
558         overlapping fields.
559         (layout_empty_base_or_field): Rename from layout_empty_base, handle
560         FIELD_DECL as well.
561         (build_base_field, record_subobject_offsets): Adjust.
563 2018-10-03  Martin Liska  <mliska@suse.cz>
565         PR gcov-profile/86109
566         * parser.c (cp_parser_lambda_declarator_opt):
567         Set DECL_LAMBDA_FUNCTION for lambdas.
569 2018-10-02  Richard Biener  <rguenther@suse.de>
571         * name-lookup.c (check_local_shadow): Do not test DECL_FROM_INLINE.
573 2018-09-28  Eric Botcazou  <ebotcazou@adacore.com>
574             Pierre-Marie de Rodat  <derodat@adacore.com>
576         * method.c (use_thunk): Adjust call to cgraph_node::create_thunk.
578 2018-09-28  Richard Biener  <rguenther@suse.de>
580         * error.c (cp_print_error_function): Simplify by eliding
581         the BLOCK_ABSTRACT_ORIGIN chasing.
583 2018-09-27  Paolo Carlini  <paolo.carlini@oracle.com>
585         PR c++/84940
586         * semantics.c (finish_unary_op_expr): Check return value of
587         build_x_unary_op for error_mark_node.
589 2018-09-25  Jakub Jelinek  <jakub@redhat.com>
591         PR c++/87398
592         * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Only
593         look through COMPONENT_REFs with DECL_FIELD_IS_BASE FIELD_DECLs.
595 2018-09-25  Martin Liska  <mliska@suse.cz>
597         * name-lookup.c (namespace_scope_ht_size): Remove
598         unused function.
599         * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
601 2018-09-24  Paolo Carlini  <paolo.carlini@oracle.com>
603         PR c++/85070
604         * method.c (lazily_declare_fn): During error-recovery add_method
605         may return false.
607 2018-09-21  Marek Polacek  <polacek@redhat.com>
609         PR c++/87372 - __func__ constexpr evaluation.
610         * constexpr.c (maybe_constant_init_1): Pass false for strict down to
611         cxx_eval_outermost_constant_expr.
613 2018-09-20  Marek Polacek  <polacek@redhat.com>
615         PR c++/87109 - wrong ctor with maybe-rvalue semantics.
616         * call.c (build_user_type_conversion_1): Refine the maybe-rvalue
617         check to only return if we're converting the return value to a base
618         class.
620 2018-09-20  Allan Sandfeld Jensen  <allan.jensen@qt.io>
622         * g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
624 2018-09-20  Jason Merrill  <jason@redhat.com>
626         PR c++/87075 - ICE with constexpr array initialization.
627         * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization.
629 2018-09-19  Marek Polacek  <polacek@redhat.com>
631         Add -Wclass-conversion.
632         * decl.c (grok_op_properties): Change a warning from -Wconversion to
633         -Wclass-conversion.  Make it print the types.
635 2018-09-19  Paolo Carlini  <paolo.carlini@oracle.com>
637         PR c++/87324
638         * parser.c (cp_parser_initializer_list): Assign error_mark_node
639         to the index upon error.
641 2018-09-19  Marek Polacek  <polacek@redhat.com>
643         PR c++/87357 - missing -Wconversion warning
644         * decl.c (grok_op_properties): Remove diagnostic parts mentioning
645         a conversion to a reference to void.  Use
646         same_type_ignoring_top_level_qualifiers_p rather than comparing types
647         directly.
649 2018-09-18  Marek Polacek  <polacek@redhat.com>
651         P1064R0 - Allowing Virtual Function Calls in Constant Expressions
652         * call.c (build_over_call): No longer check if we're outside a template
653         function.
654         * class.c (build_vtbl_initializer): Build vtable's constructor with
655         indexes.
656         * constexpr.c (cxx_eval_constant_expression): Don't ignore _vptr's
657         initializer.  Handle OBJ_TYPE_REF.
658         (potential_constant_expression_1): Handle OBJ_TYPE_REF.
659         * decl.c (maybe_commonize_var): Bail out for any DECL_ARTIFICIAL.
660         (initialize_artificial_var): Mark the variable as constexpr.
661         (grokdeclarator): Change error to pedwarn.  Only warn when
662         pedantic and not C++2a.
664 2018-09-18  Paolo Carlini  <paolo.carlini@oracle.com>
666         PR c++/85065
667         * cp-tree.h (NON_ERROR): New.
668         * pt.c (auto_hash::hash): Use it.
669         (do_auto_deduction): Likewise.
671 2018-09-18  Nathan Sidwell  <nathan@acm.org>
673         PR c++/86881
674         * name-lookup.c (check_local_shadow): Ignore auto types.
676 2018-09-17  David Malcolm  <dmalcolm@redhat.com>
678         * error.c (range_label_for_type_mismatch::get_text): Update for
679         new param.
681 2018-09-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>
683         * typeck2.c (digest_init_r): Fix overlength strings.
685 2018-09-13  Ville Voutilainen  <ville.voutilainen@gmail.com>
687         PR c++/87093
688         * method.c (constructible_expr): We're in an unevaluated context
689         in all cases, not just for class targets.
691 2018-09-12  David Malcolm  <dmalcolm@redhat.com>
693         PR c++/85110
694         * call.c (struct conversion_info): Add "loc" field.
695         (arg_conversion_rejection): Add "loc" param, using it to
696         initialize the new field.
697         (bad_arg_conversion_rejection): Likewise.
698         (explicit_conversion_rejection): Initialize the new field to
699         UNKNOWN_LOCATION.
700         (template_conversion_rejection): Likewise.
701         (add_function_candidate): Pass on the argument location to the new
702         param of arg_conversion_rejection.
703         (add_conv_candidate): Likewise.
704         (build_builtin_candidate): Likewise.
705         (build_user_type_conversion_1): Likewise.
706         (single_z_candidate): New function.
707         (maybe_get_bad_conversion_for_unmatched_call): New function.
708         (complain_about_bad_argument): New function, based on part of
709         convert_for_assignment.
710         (build_new_method_call_1): Split out handling of the "no viable
711         candidates" case into...
712         (complain_about_no_candidates_for_method_call): ...this new
713         function, and use the new functions above to special-case the
714         handling of a single non-viable candidate due to a bad argument.
715         * cp-tree.h (complain_about_bad_argument): New decl.
716         * typeck.c (convert_for_assignment): Split out one error-handling
717         case into complain_about_bad_argument.
719 2018-09-09  Cesar Philippidis  <cesar@codesourcery.com>
720             Julian Brown  <julian@codesourcery.com>
722         PR middle-end/86336
723         * semantics.c (finish_omp_clauses): Treat C++ references the same in
724         OpenACC as OpenMP.
726 2018-08-28  Martin Liska  <mliska@suse.cz>
728         * constexpr.c (cxx_eval_call_expression): Add quotes
729         to -fconstexpr-depth=.
731 2018-09-10  Marek Polacek  <polacek@redhat.com>
733         * class.c (build_vtbl_ref): Remove.
734         (build_vtbl_ref_1): Rename to build_vtbl_ref.
735         (build_vfn_ref): Call build_vtbl_ref instead of build_vtbl_ref_1.
737 2018-09-08  Marek Polacek  <polacek@redhat.com>
739         PR c++/87150 - wrong ctor with maybe-rvalue semantics.
740         * call.c (struct conversion): Update commentary.
741         (standard_conversion): Set rvaluedness_matches_p if LOOKUP_PREFER_RVALUE
742         for ck_base.
744 2018-09-08  Jason Merrill  <jason@redhat.com>
746         PR c++/86678 - constexpr function with non-constant after return.
747         * constexpr.c (potential_constant_expression_1): Add jump_target.
748         (breaks): Check for BREAK_STMT.
749         (continues): Check for CONTINUE_STMT.
751 2018-09-08  Marek Polacek  <polacek@redhat.com>
753         * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
754         RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
756 2018-09-07  Marek Polacek  <polacek@redhat.com>
758         PR c++/87152 - range-based for loops with initializer broken in templates.
759         * constexpr.c (potential_constant_expression_1) <case RANGE_FOR_STMT>:
760         Recur into RANGE_FOR_INIT_STMT.
761         * cp-tree.def: Add RANGE_FOR_INIT_STMT to RANGE_FOR_STMT.
762         * cp-tree.h (RANGE_FOR_INIT_STMT): Define.
763         * dump.c (cp_dump_tree) <case RANGE_FOR_STMT>: Also dump
764         RANGE_FOR_INIT_STMT.
765         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Recur into
766         RANGE_FOR_INIT_STMT.
767         * semantics.c (begin_range_for_stmt): Adjust call to build_stmt.
768         Do put the init statement in RANGE_FOR_INIT_STMT.
769         (finish_range_for_decl): Pop it for templates.
771 2018-09-06  Bernd Edlinger  <bernd.edlinger@hotmail.de>
773         * decl.c (check_initializer): Call cp_complete_array_type.
775 2018-09-05  Marek Polacek  <polacek@redhat.com>
777         PR c++/87109, wrong overload with ref-qualifiers.
778         * call.c (build_user_type_conversion_1): Use NULL instead of 0.  Bail
779         out if performing the maybe-rvalue overload resolution and a conversion
780         function is getting called.
782         PR c++/86982, -Wreturn-local-addr and std::move and std::forward.
783         * typeck.c (maybe_warn_about_returning_address_of_local): Handle calls
784         to std::move or std::forward.
785         (is_std_forward_p): New function.
787 2018-09-05  Pádraig Brady  <p@draigbrady.com>
789         PR c++/87185
790         * lambda.c (prune_lambda_captures): Protect against const_vars.get
791         returning NULL.
793 2018-09-04  Marek Polacek  <polacek@redhat.com>
795         * cp-tree.h (treat_lvalue_as_rvalue_p): Declare.
796         * except.c (build_throw): Use it.  Use CP_TYPE_VOLATILE_P.
797         * typeck.c (treat_lvalue_as_rvalue_p): No longer static.  Add PARM_OK
798         parameter.
799         (maybe_warn_pessimizing_move): Adjust treat_lvalue_as_rvalue_p call.
800         (check_return_expr): Likewise.
802 2018-09-03  Paolo Carlini  <paolo.carlini@oracle.com>
804         PR c++/84980
805         * constraint.cc (finish_shorthand_constraint): Early return if the
806         constraint is erroneous.
808 2018-09-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>
810         * decl.c (eval_check_narrowing): Remove.
811         (check_initializer): Move call to braced_list_to_string from here ...
812         * typeck2.c (store_init_value): ... to here.
813         (digest_init_r): Remove handing of signed/unsigned char strings.
815 2018-08-31  Nathan Sidwell  <nathan@acm.org>
817         PR c++/87155
818         PR c++/84707
819         * name-lookup.c (name_lookup::search_namespace): Don't look at
820         inlines when searching for NULL names.
822         * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
823         of return types and parms.
824         * parser.c (cp_parser_parameter_declaration_clause): Likewise,
825         '()' always means '(void)'.
827 2018-08-29  Jakub Jelinek  <jakub@redhat.com>
829         PR c++/87095
830         * decl.c (begin_destructor_body): If current_class_type has
831         virtual bases and the primary base is nearly empty virtual base,
832         voidify clearing of vptr and make it conditional on in-charge
833         argument.
835 2018-08-29  Paolo Carlini  <paolo.carlini@oracle.com>
837         PR c++/85265
838         * parser.c (cp_parser_introduction_list): If cp_parser_identifier
839         returns error_mark_node early exit the loop.
840         (cp_parser_template_introduction): Improve error-recovery, remove
841         error call about empty introduction-list.
843 2018-08-29  David Malcolm  <dmalcolm@redhat.com>
845         PR c++/85110
846         * call.c (print_conversion_rejection): Add "fn" param and use it
847         for "no known conversion" messages to underline the pertinent
848         param.
849         (print_z_candidate): Supply "fn" to the new param above.
851 2018-08-29  Jakub Jelinek  <jakub@redhat.com>
853         PR c++/87122
854         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
855         processing_template_decl and decl is structured binding decl, call
856         cp_finish_decomp.
858 2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>
860         PR c++/86546
861         * decl.c (finish_case_label): If the type is erroneous early
862         return error_mark_node.
864 2018-08-27  David Malcolm  <dmalcolm@redhat.com>
866         PR c++/63392
867         * parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
868         hint.
870 2018-08-27  Jakub Jelinek  <jakub@redhat.com>
872         PR c++/86993
873         * cp-tree.h (cxx_readonly_error): Add location_t argument.
874         * typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
875         ERROR_FOR_ASSIGNMENT macro and readonly_error.  Add LOC argument
876         to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
877         pass LOC to it.  Formatting fixes.
878         * typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
879         (cp_build_modify_expr): Pass loc to cxx_readonly_error.
880         * semantics.c (finish_asm_stmt): Pass input_location to
881         cxx_readonly_error.
883 2018-08-27  David Malcolm  <dmalcolm@redhat.com>
885         PR c++/87091
886         * decl.c (grokdeclarator): Update for conversion of show_caret_p
887         to a tri-state.
888         * error.c (cp_printer): Likewise.
889         * name-lookup.c (maybe_suggest_missing_std_header): Update call to
890         maybe_add_include_fixit to suggest overriding the location, as it
891         is for a note.
892         * parser.c (cp_parser_string_literal): Update for conversion of
893         show_caret_p to a tri-state.
894         (cp_parser_elaborated_type_specifier): Likewise.
895         (set_and_check_decl_spec_loc): Likewise.
896         * pt.c (listify): Update call to maybe_add_include_fixit to not
897         override the location, as it is for an error.
898         * rtti.c (typeid_ok_p): Likewise.
900 2018-08-27  Martin Liska  <mliska@suse.cz>
902         * call.c (build_call_a): Use new function
903         fndecl_built_in_p and remove check for FUNCTION_DECL if
904         possible.
905         (build_cxx_call): Likewise.
906         * constexpr.c (constexpr_fn_retval): Likewise.
907         (cxx_eval_builtin_function_call): Likewise.
908         (cxx_eval_call_expression): Likewise.
909         (potential_constant_expression_1): Likewise.
910         * cp-gimplify.c (cp_gimplify_expr): Likewise.
911         (cp_fold): Likewise.
912         * decl.c (decls_match): Likewise.
913         (validate_constexpr_redeclaration): Likewise.
914         (duplicate_decls): Likewise.
915         (make_rtl_for_nonlocal_decl): Likewise.
916         * name-lookup.c (consider_binding_level): Likewise.
917         (cp_emit_debug_info_for_using): Likewise.
918         * semantics.c (finish_call_expr): Likewise.
919         * tree.c (builtin_valid_in_constant_expr_p): Likewise.
921 2018-08-26  Marek Polacek  <polacek@redhat.com>
923         PR c++/87080
924         * typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.
926         PR c++/87029, Implement -Wredundant-move.
927         * typeck.c (treat_lvalue_as_rvalue_p): New function.
928         (maybe_warn_pessimizing_move): Call convert_from_reference.
929         Warn about redundant moves.
931 2018-08-24  Marek Polacek  <polacek@redhat.com>
933         PR c++/67012
934         PR c++/86942
935         * decl.c (grokdeclarator): Disallow functions with trailing return
936         type with decltype(auto) as its type.  Also check the function if
937         it's inner declarator doesn't exist
939 2018-08-21  Marek Polacek  <polacek@redhat.com>
941         PR c++/86499
942         * parser.c (cp_parser_lambda_introducer): Give error if a non-local
943         lambda has a capture-default.
945 2018-08-21  Paolo Carlini  <paolo.carlini@oracle.com>
947         * decl.c (check_static_variable_definition): Change to return void.
949 2018-08-21  Marek Polacek  <polacek@redhat.com>
951         PR c++/86981, Implement -Wpessimizing-move.
952         * typeck.c (decl_in_std_namespace_p): New.
953         (is_std_move_p): New.
954         (maybe_warn_pessimizing_move): New.
955         (can_do_nrvo_p): New, factored out of ...
956         (check_return_expr): ... here.  Warn about potentially harmful
957         std::move in a return statement.
959         PR c++/65043
960         * call.c (standard_conversion): Set check_narrowing.
961         * typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
962         than comparing with INTEGER_TYPE.
964         * cp-tree.h: Fix typo.
966 2018-08-20  David Malcolm  <dmalcolm@redhat.com>
968         PR other/84889
969         * call.c (build_user_type_conversion_1): Add auto_diagnostic_group
970         instance(s).
971         (print_error_for_call_failure): Likewise.
972         (build_op_call_1): Likewise.
973         (build_conditional_expr_1): Likewise.
974         (build_new_op_1): Likewise.
975         (build_op_delete_call): Likewise.
976         (convert_like_real): Likewise.
977         (build_over_call): Likewise.
978         (build_new_method_call_1): Likewise.
979         (joust): Likewise.
980         * class.c (check_tag): Likewise.
981         (finish_struct_anon_r): Likewise.
982         (one_inherited_ctor): Likewise.
983         (finalize_literal_type_property): Likewise.
984         (explain_non_literal_class): Likewise.
985         (find_flexarrays): Likewise.
986         (resolve_address_of_overloaded_function): Likewise.
987         * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
988         (is_valid_constexpr_fn): Likewise.
989         (cx_check_missing_mem_inits): Likewise.
990         * cp-gimplify.c (cp_genericize_r): Likewise.
991         * cvt.c (maybe_warn_nodiscard): Likewise.
992         * decl.c (warn_extern_redeclared_static): Likewise.
993         (check_redeclaration_exception_specification): Likewise.
994         (check_no_redeclaration_friend_default_args): Likewise.
995         (duplicate_decls): Likewise.
996         (redeclaration_error_message): Likewise.
997         (warn_misplaced_attr_for_class_type): Likewise.
998         * decl2.c (finish_static_data_member_decl): Likewise.
999         (no_linkage_error): Likewise.
1000         (cp_warn_deprecated_use): Likewise.
1001         * error.c (qualified_name_lookup_error): Likewise.
1002         * friend.c (make_friend_class): Likewise.
1003         (do_friend): Likewise.
1004         * init.c (perform_member_init): Likewise.
1005         (build_new_1): Likewise.
1006         (build_vec_delete_1): Likewise.
1007         (build_delete): Likewise.
1008         * lex.c (unqualified_name_lookup_error): Likewise.
1009         * name-lookup.c (check_extern_c_conflict): Likewise.
1010         (inform_shadowed): New function.
1011         (check_local_shadow): Add auto_diagnostic_group instances,
1012         replacing goto "inform_shadowed" label with call to subroutine.
1013         (set_local_extern_decl_linkage): Add auto_diagnostic_group
1014         instance(s).
1015         * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
1016         (cp_parser_namespace_name): Likewise.
1017         * pt.c (check_specialization_namespace): Likewise.
1018         (check_template_variable): Likewise.
1019         (warn_spec_missing_attributes): Likewise.
1020         (check_explicit_specialization): Likewise.
1021         (process_partial_specialization): Likewise.
1022         (lookup_template_class_1): Likewise.
1023         (finish_template_variable): Likewise.
1024         (do_auto_deduction): Likewise.
1025         * search.c (check_final_overrider): Likewise.
1026         (look_for_overrides_r): Likewise.
1027         * tree.c (maybe_warn_parm_abi): Likewise.
1028         * typeck.c (cxx_sizeof_expr): Likewise.
1029         (cp_build_function_call_vec): Likewise.
1030         (cp_build_binary_op): Likewise.
1031         (convert_for_assignment): Likewise.
1032         (maybe_warn_about_returning_address_of_local): Likewise.
1033         * typeck2.c (abstract_virtuals_error_sfinae): Likewise.
1034         (check_narrowing): Likewise.
1036 2018-08-17  David Malcolm  <dmalcolm@redhat.com>
1038         * typeck.c (string_conv_p): Extract location from EXP and use it
1039         in preference to input_location when issuing warnings.
1041 2018-08-15  David Malcolm  <dmalcolm@redhat.com>
1043         * call.c: Include "gcc-rich-location.h".
1044         (convert_like_real): Add range label for "invalid conversion"
1045         diagnostic.
1046         (perform_implicit_conversion_flags): Add type label to the
1047         "could not convert" error.
1048         * error.c: Include "gcc-rich-location.h".
1049         (range_label_for_type_mismatch::get_text): New function.
1050         * typeck.c (convert_for_assignment): Add type label to
1051         the "cannot convert" error if a location is available.
1053 2018-08-15  Paolo Carlini  <paolo.carlini@oracle.com>
1055         * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
1056         emit an error instead of a permerror.
1058 2018-08-13  Marek Polacek  <polacek@redhat.com>
1060         PR c++/57891
1061         * call.c (struct conversion): Add check_narrowing_const_only.
1062         (build_converted_constant_expr): Set check_narrowing and
1063         check_narrowing_const_only.  Give error if expr is error node.
1064         (convert_like_real): Pass it to check_narrowing.
1065         * cp-tree.h (check_narrowing): Add a default parameter.
1066         * decl.c (compute_array_index_type): Use input_location instead of
1067         location_of.
1068         * pt.c (convert_nontype_argument): Return NULL_TREE if tf_error.
1069         * typeck2.c (check_narrowing): Don't warn for instantiation-dependent
1070         expressions.  Call maybe_constant_value instead of
1071         fold_non_dependent_expr.  Don't mention { } in diagnostic.  Only check
1072         narrowing for constants if CONST_ONLY.
1074 2018-08-13  Martin Sebor  <msebor@redhat.com>
1076         PR tree-optimization/71625
1077         * decl.c (check_initializer):  Call braced_list_to_string.
1078         (eval_check_narrowing): New function.
1079         * gcc/cp/typeck2.c (digest_init_r): Accept strings literals
1080         as initilizers for all narrow character types.
1082 2018-08-13  Marek Polacek  <polacek@redhat.com>
1084         P0806R2 - Deprecate implicit capture of this via [=]
1085         * lambda.c (add_default_capture): Formatting fixes.  Warn about
1086         deprecated implicit capture of this via [=].
1088         PR c++/86915
1089         * decl.c (create_array_type_for_decl): Handle null name.
1091 2018-08-10  Jason Merrill  <jason@redhat.com>
1093         PR c++/86728 - C variadic generic lambda.
1094         * parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into
1095         a pack if it's followed by a declarator-id.
1097 2018-08-08  Jakub Jelinek  <jakub@redhat.com>
1099         P0595R1 - is_constant_evaluated
1100         * cp-tree.h (enum cp_built_in_function): New.
1101         (maybe_constant_init): Add pretend_const_required argument.
1102         * typeck2.c (store_init_value): Pass true as new argument to
1103         maybe_constant_init.
1104         * constexpr.c (constexpr_fn_retval): Check also DECL_BUILT_IN_CLASS
1105         for BUILT_IN_UNREACHABLE.
1106         (struct constexpr_ctx): Add pretend_const_required field.
1107         (cxx_eval_builtin_function_call): Use DECL_IS_BUILTIN_CONSTANT_P
1108         macro.  Handle CP_BUILT_IN_IS_CONSTANT_EVALUATED.  Check also
1109         DECL_BUILT_IN_CLASS for BUILT_IN_UNREACHABLE.
1110         (cxx_eval_outermost_constant_expr): Add pretend_const_required
1111         argument, initialize pretend_const_required field in ctx.  If the
1112         result is TREE_CONSTANT and non_constant_p, retry with
1113         pretend_const_required false if it was true.
1114         (is_sub_constant_expr): Initialize pretend_const_required_field in
1115         ctx.
1116         (cxx_constant_value): Pass true as pretend_const_required to
1117         cxx_eval_outermost_constant_expr.
1118         (maybe_constant_value): Pass false as pretend_const_required to
1119         cxx_eval_outermost_constant_expr.
1120         (fold_non_dependent_expr): Likewise.
1121         (maybe_constant_init_1): Add pretend_const_required argument, pass it
1122         down to cxx_eval_outermost_constant_expr.  Pass !allow_non_constant
1123         instead of false as strict to cxx_eval_outermost_constant_expr.
1124         (maybe_constant_init): Add pretend_const_required argument, pass it
1125         down to maybe_constant_init_1.
1126         (cxx_constant_init): Pass true as pretend_const_required to
1127         maybe_constant_init_1.
1128         * cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPRs to
1129         CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1130         (cp_fold): Don't fold CP_BUILT_IN_IS_CONSTANT_EVALUATED calls.
1131         * decl.c: Include langhooks.h.
1132         (cxx_init_decl_processing): Register __builtin_is_constant_evaluated
1133         built-in.
1134         * tree.c (builtin_valid_in_constant_expr_p): Return true for
1135         CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1136         * pt.c (declare_integer_pack): Initialize DECL_FUNCTION_CODE.
1138         PR c++/86836
1139         * pt.c (tsubst_expr): For structured bindings, call tsubst_decomp_names
1140         before tsubst_init, not after it.
1142         PR c++/86738
1143         * constexpr.c (cxx_eval_binary_expression): For arithmetics involving
1144         NULL pointer set *non_constant_p to true.
1145         (cxx_eval_component_reference): For dereferencing of a NULL pointer,
1146         set *non_constant_p to true and return t.
1148 2018-08-07  Paolo Carlini  <paolo.carlini@oracle.com>
1150         PR c++/59480, DR 136
1151         * decl.c (check_no_redeclaration_friend_default_args): New.
1152         (duplicate_decls): Use the latter; also check that a friend
1153         declaration specifying default arguments is a definition.
1155 2018-08-07  Ville Voutilainen  <ville.voutilainen@gmail.com>
1157         PR c++/79133
1158         * name-lookup.c (check_local_shadow): Reject captures and parameters
1159         with the same name.
1161 2018-08-06  Marek Polacek  <polacek@redhat.com>
1163         PR c++/86767
1164         * constexpr.c (cxx_eval_statement_list): Handle continue.
1166 2018-08-03  David Malcolm  <dmalcolm@redhat.com>
1167             Jonathan Wakely  <jwakely@redhat.com>
1169         * decl.c: Include "gcc-rich-location.h".
1170         (add_return_star_this_fixit): New function.
1171         (finish_function): When warning about missing return statements in
1172         functions returning non-void, add a "return *this;" fix-it hint for
1173         assignment operators.
1175 2018-08-03  Jason Merrill  <jason@redhat.com>
1177         PR c++/86706
1178         * class.c (build_base_path): Use currently_open_class.
1180 2018-08-02  David Malcolm  <dmalcolm@redhat.com>
1182         * error.c (cxx_print_error_function): Duplicate "file" before
1183         passing it to pp_set_prefix.
1184         (cp_print_error_function): Use pp_take_prefix when saving the
1185         existing prefix.
1187 2018-08-02  Richard Biener  <rguenther@suse.de>
1189         PR c++/86763
1190         * class.c (layout_class_type): Copy TYPE_TYPELESS_STORAGE
1191         to the CLASSTYPE_AS_BASE.
1193 2018-08-01  Martin Sebor  <msebor@redhat.com>
1195         PR tree-optimization/86650
1196         * error.c (cp_printer): Move usage of EXPR_LOCATION (t) and
1197         TREE_BLOCK (t) from within percent_K_format to this callsite.
1199 2018-08-01  Paolo Carlini  <paolo.carlini@oracle.com>
1201         PR c++/86661
1202         * class.c (note_name_declared_in_class): Use location_of in permerror
1203         instead of DECL_SOURCE_LOCATION (for OVERLOADs).
1205 2018-07-31  Tom de Vries  <tdevries@suse.de>
1207         PR debug/86687
1208         * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
1210 2018-07-31  Jakub Jelinek  <jakub@redhat.com>
1212         P1008R1 - prohibit aggregates with user-declared constructors
1213         * class.c (check_bases_and_members): For C++2a set
1214         CLASSTYPE_NON_AGGREGATE based on TYPE_HAS_USER_CONSTRUCTOR rather than
1215         type_has_user_provided_or_explicit_constructor.
1217 2018-07-31  Martin Liska  <mliska@suse.cz>
1219         PR c++/86653
1220         * parser.c (cp_parser_condition): Initialize non_constant_p
1221         to false.
1223 2018-07-28  David Malcolm  <dmalcolm@redhat.com>
1225         * error.c (cp_printer): In the leading comment, move "%H" and "%I"
1226         into alphabetical order, and add missing "%G" and "%K".  Within
1227         the switch statement, move cases 'G', 'H', 'I' and 'K' so that the
1228         cases are in alphabetical order.
1230 2018-07-25  Jakub Jelinek  <jakub@redhat.com>
1232         * cp-tree.h (enum cp_tree_index): Add
1233         CPTI_{ABI_TAG,ALIGNED,BEGIN,END,GET,TUPLE_{ELEMENT,SIZE}}_IDENTIFIER
1234         and CPTI_{GNU,TYPE,VALUE,FUN,CLOSURE}_IDENTIFIER.
1235         (abi_tag_identifier, aligned_identifier, begin_identifier,
1236         end_identifier, get__identifier, gnu_identifier,
1237         tuple_element_identifier, tuple_size_identifier, type_identifier,
1238         value_identifier, fun_identifier, closure_identifier): Define.
1239         * decl.c (initialize_predefined_identifiers): Initialize the above
1240         identifiers.
1241         (get_tuple_size): Use tuple_size_identifier instead of
1242         get_identifier ("tuple_size") and value_identifier instead of
1243         get_identifier ("value").
1244         (get_tuple_element_type): Use tuple_element_identifier instead of
1245         get_identifier ("tuple_element") and type_identifier instead of
1246         get_identifier ("type").
1247         (get_tuple_decomp_init): Use get__identifier instead of
1248         get_identifier ("get").
1249         * lambda.c (maybe_add_lambda_conv_op): Use fun_identifier instead of
1250         get_identifier ("_FUN").
1251         * parser.c (cp_parser_lambda_declarator_opt): Use closure_identifier
1252         instead of get_identifier ("__closure").
1253         (cp_parser_std_attribute): Use gnu_identifier instead of
1254         get_identifier ("gnu").
1255         (cp_parser_std_attribute_spec): Likewise.  Use aligned_identifier
1256         instead of get_identifier ("aligned").
1257         * class.c (check_abi_tags, inherit_targ_abi_tags): Use
1258         abi_tag_identifier instead of get_identifier ("abi_tag").
1260         PR c++/85515
1261         * cp-tree.h (enum cp_tree_index): Add
1262         CPTI_FOR_{RANGE,BEGIN,END}{,_}_IDENTIFIER.
1263         (for_range__identifier, for_begin__identifier, for_end__identifier,
1264         for_range_identifier, for_begin_identifier, for_end_identifier):
1265         Define.
1266         * decl.c (initialize_predefined_identifiers): Initialize
1267         for_{range,begin,end}{,_}_identifier.
1268         * parser.c (build_range_temp): Use for_range__identifier instead of
1269         get_identifier ("__for_range").
1270         (cp_convert_range_for): Use for_begin__identifier and
1271         for_end__identifier instead of get_identifier ("__for_begin") and
1272         get_identifier ("__for_end").
1273         * semantics.c (finish_for_stmt): Rename "__for_{range,begin,end} "
1274         local symbols to "__for_{range,begin,end}".
1276 2018-07-23  Jakub Jelinek  <jakub@redhat.com>
1278         PR c++/86569
1279         * cp-gimplify.c (cp_fold): Don't fold comparisons into other kind
1280         of expressions other than INTEGER_CST regardless of TREE_NO_WARNING
1281         or warn_nonnull_compare.
1283 2018-07-19  Paolo Carlini  <paolo.carlini@oracle.com>
1285         Revert fix for c++/59480 (and testsuite followup)
1287         2019-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
1289         PR c++/59480, DR 136
1290         * decl.c (check_no_redeclaration_friend_default_args): New.
1291         (duplicate_decls): Use the latter; also check that a friend
1292         declaration specifying default arguments is a definition.
1294 2018-07-18  Jakub Jelinek  <jakub@redhat.com>
1296         PR c++/86550
1297         * parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
1298         specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
1300 2018-07-18  Marek Polacek  <polacek@redhat.com>
1302         PR c++/86190 - bogus -Wsign-conversion warning
1303         * typeck.c (cp_build_binary_op): Fix formatting.  Add a warning
1304         sentinel.
1306 2018-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
1308         PR c++/59480, DR 136
1309         * decl.c (check_no_redeclaration_friend_default_args): New.
1310         (duplicate_decls): Use the latter; also check that a friend
1311         declaration specifying default arguments is a definition.
1313 2018-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
1315         * class.c (note_name_declared_in_class): Prefer permerror + inform
1316         to a pair of permerrors; use DECL_SOURCE_LOCATION.
1318 2018-07-18  Richard Biener  <rguenther@suse.de>
1320         PR debug/86523
1321         * decl2.c (c_parse_final_cleanups): Call write_out_vars before
1322         start_static_storage_duration_function sets current_function_decl.
1324 2018-07-17  Jason Merrill  <jason@redhat.com>
1326         PR c++/86480 - nested variadic lambda and constexpr if.
1327         * pt.c (find_parameter_packs_r) [IF_STMT]: Don't walk into
1328         IF_STMT_EXTRA_ARGS.
1329         * tree.c (cp_walk_subtrees) [DECLTYPE_TYPE]: Set
1330         cp_unevaluated_operand.
1331         [ALIGNOF_EXPR] [SIZEOF_EXPR] [NOEXCEPT_EXPR]: Likewise.
1333 2018-07-16  Paolo Carlini  <paolo.carlini@oracle.com>
1335         * class.c (resolve_address_of_overloaded_function): Don't emit an
1336         inform if the matching permerror returns false.
1337         * pt.c (check_specialization_namespace): Likewise.
1339 2018-07-16  Jakub Jelinek  <jakub@redhat.com>
1341         PR c++/3698
1342         PR c++/86208
1343         * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or
1344         in TREE_USED flag from stmt to h->to.
1346 2018-07-13  Nathan Sidwell  <nathan@acm.org>
1348         PR c++/86374
1349         * pt.c (lookup_template_class_1): Use tsubst_aggr_type for
1350         contexts that are classes.
1351         * parser.c (cp_parser_template_id): Combine entering_scope decl &
1352         initializer.
1354 2018-07-12  Jakub Jelinek  <jakub@redhat.com>
1356         * decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable
1357         type here, instead add "omp declare target implicit" attribute.  Add
1358         that attribute instead of "omp declare target" also when
1359         processing_template_decl.
1360         * decl.c (cp_finish_decl): Diagnose vars without mappable type here,
1361         and before calling cp_omp_mappable_type call complete_type.
1363 2018-07-10  Jakub Jelinek  <jakub@redhat.com>
1365         PR sanitizer/86406
1366         * cp-gimplify.c (cp_maybe_instrument_return): Skip trailing
1367         DEBUG_BEGIN_STMTs.
1369         PR c++/86443
1370         * semantics.c (handle_omp_for_class_iterator): Remove lastp argument,
1371         instead of setting *lastp turn orig_declv elt into a TREE_LIST.
1372         (finish_omp_for): Adjust handle_omp_for_class_iterator caller.
1373         * pt.c (tsubst_omp_for_iterator): Allow OMP_FOR_ORIG_DECLS to contain
1374         TREE_LIST for both the original class iterator and the "last" helper
1375         var.
1377 2018-07-09  Paolo Carlini  <paolo.carlini@oracle.com>
1379         * decl.c (grokdeclarator): Use rich_location::add_range in three
1380         more places; include gcc-rich-location.h.
1382 2018-07-07  Aldy Hernandez  <aldyh@redhat.com>
1384         * decl.c (build_enumerator): Change overflow type to overflow_type.
1385         * init.c (build_new_1): Same.
1387 2018-07-05  Nathan Sidwell  <nathan@acm.org>
1389         * cp/decl.c (decls_match): Check SYSTEM_IMPLICIT_EXTERN_C not
1390         NO_IMPLICIT_EXTERN_C.
1391         * cp/parser.c (cp_parser_parameter_declaration_clause): Likewise.
1393 2018-07-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
1395         PR c++/86398
1396         * method.c (is_trivially_xible): Return false
1397         if is_xible_helper returns a NULL_TREE.
1399 2018-07-03  Paolo Carlini  <paolo.carlini@oracle.com>
1401         * decl.c (min_location): New.
1402         (smallest_type_quals_location): Use the latter.
1403         (check_concept_fn): Use DECL_SOURCE_LOCATION.
1404         (grokdeclarator): Use accurate locations in a number of error
1405         messages involving ds_thread, ds_storage_class, ds_virtual,
1406         ds_constexpr, ds_typedef and ds_friend; exploit min_location.
1408 2018-07-03  Marek Polacek  <polacek@redhat.com>
1410         PR c++/86201
1411         * typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.
1413 2018-07-03  Jason Merrill  <jason@redhat.com>
1415         PR c++/86378 - functional cast in noexcept-specifier.
1416         * tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
1418 2018-07-02  Paolo Carlini  <paolo.carlini@oracle.com>
1420         * parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range
1421         in error message about __thread and thread_local at the same time.
1423 2018-06-29  Marek Polacek  <polacek@redhat.com>
1425         PR c++/86184
1426         * tree.c (cp_save_expr): Don't call save_expr for TARGET_EXPRs.
1428 2018-06-28  David Malcolm  <dmalcolm@redhat.com>
1430         * parser.c (cp_parser_error_1): After issuing a conflict marker
1431         error, consume tokens until the end of the source line.
1433 2018-06-28  Jason Merrill  <jason@redhat.com>
1435         PR c++/86342 - -Wdeprecated-copy and system headers.
1436         * decl2.c (cp_warn_deprecated_use): Don't warn about declarations
1437         in system headers.
1439 2018-06-27  David Malcolm  <dmalcolm@redhat.com>
1441         PR c++/86329
1442         * name-lookup.c (consider_binding_level): Filter out names that
1443         match anon_aggrname_p.
1445 2018-06-27  Jason Merrill  <jason@redhat.com>
1447         * name-lookup.c (do_pushtag): If we skip a class level, also skip
1448         its template level.
1450 2018-06-26  Jason Merrill  <jason@redhat.com>
1452         PR c++/86320 - memory-hog with std::array of pair
1453         * typeck2.c (process_init_constructor_array): Only compute a
1454         constant initializer once.
1456         PR c++/80290 - memory-hog with std::pair.
1457         * pt.c (fn_type_unification): Add convs parameter.
1458         (check_non_deducible_conversion): Remember conversion.
1459         (check_non_deducible_conversions): New.  Do checks here.
1460         (type_unification_real): Not here.  Remove flags parm.
1461         * call.c (add_function_candidate): Make convs a parameter.
1462         Don't recalculate the conversion if it's already set.
1463         (add_template_candidate_real): Allocate convs here.
1464         (good_conversion, conv_flags): New.
1466 2018-06-26  Jakub Jelinek  <jakub@redhat.com>
1468         PR c++/86291
1469         * parser.c (cp_parser_omp_for_loop_init): Change for_block argument
1470         type from vec<tree, va_gc> * to vec<tree, va_gc> *&.
1472 2018-06-23  Paolo Carlini  <paolo.carlini@oracle.com>
1474         * decl.c (bad_specifiers): Add const location_t* parameter and
1475         use locations in error messages about 'inline' and 'virtual'.
1476         (mark_inline_variable): Add location_t parameter and use it in
1477         error_at and pedwarn messages.
1478         (grokdeclarator): Use declspecs->locations[ds_constexpr],
1479         declspecs->locations[ds_concept], declspecs->locations[ds_virtual],
1480         declspecs->locations[ds_inline] in many error messages; adjust
1481         bad_specifiers and mark_inline_variable calls.
1482         (grokvardecl): Use declspecs->locations[ds_concept] in error message.
1484 2018-06-22  Jason Merrill  <jason@redhat.com>
1486         PR c++/86219 - ICE with erroneous initializer in template.
1487         * constexpr.c (fold_non_dependent_expr): Add complain parm.
1488         * call.c, expr.c, init.c, pt.c, semantics.c, typeck.c, typeck2.c:
1489         Pass it.
1490         * call.c (build_cxx_call): Don't mess with builtins in a template.
1491         * typeck2.c (store_init_value): If fold_non_dependent_expr didn't
1492         produce a constant value, go back to the uninstantiated form.
1494         Avoid taking the address of something just because it's in parens.
1495         * constexpr.c (same_type_ignoring_tlq_and_bounds_p): New.
1496         (cxx_fold_indirect_ref): Use it.
1497         (cxx_eval_constant_expression) [VIEW_CONVERT_EXPR]: Use it.
1498         * cp-tree.h (REF_PARENTHESIZED_P): Allow VIEW_CONVERT_EXPR.
1499         * semantics.c (force_paren_expr): Use VIEW_CONVERT_EXPR instead of
1500         static_cast to reference type.
1501         (maybe_undo_parenthesized_ref): Handle VIEW_CONVERT_EXPR.
1503 2018-06-21  Jason Merrill  <jason@redhat.com>
1505         * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS.
1507         * name-lookup.c (do_push_to_top_level): Don't allocate
1508         current_lang_base.
1509         (do_pop_from_top_level): Release current_lang_base.
1511         Let -fmem-report see callers of cxx_make_type.
1512         * lex.c (cxx_make_type): Add MEM_STAT_DECL.
1513         (make_class_type): Likewise.
1514         (cxx_make_type_hook): New.
1515         * cp-objcp-common.h (LANG_HOOKS_MAKE_TYPE): Use cxx_make_type_hook.
1517 2018-06-20  Nathan Sidwell  <nathan@acm.org>
1519         PR c++/85634
1520         * friend.c (add_friend): Keep lookup sets of tempate sets.
1522 2018-06-20  Paolo Carlini  <paolo.carlini@oracle.com>
1524         * decl.c (grokfndecl): Add const cp_decl_specifier_seq* parameter;
1525         tidy handling of a null location_t argument; use proper location
1526         information in a few additional error messages.
1527         (grokdeclarator): Update calls.
1529 2018-06-20  Chung-Lin Tang <cltang@codesourcery.com>
1530             Thomas Schwinge <thomas@codesourcery.com>
1531             Cesar Philippidis  <cesar@codesourcery.com>
1533         * parser.c (cp_parser_omp_clause_name): Add support for finalize
1534         and if_present. Make present_or_{copy,copyin,copyout,create} aliases
1535         to their non-present_or_* counterparts. Make 'self' an alias to
1536         PRAGMA_OACC_CLAUSE_HOST.
1537         (cp_parser_oacc_data_clause): Update GOMP mappings for
1538         PRAGMA_OACC_CLAUSE_{COPY,COPYIN,COPYOUT,CREATE,DELETE}. Remove
1539         PRAGMA_OACC_CLAUSE_{SELF,PRESENT_OR_*}.
1540         (cp_parser_oacc_all_clauses): Handle finalize and if_present clauses.
1541         Remove support for present_or_* clauses.
1542         (OACC_KERNELS_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
1543         (OACC_PARALLEL_CLAUSE_MASK): Likewise.
1544         (OACC_DECLARE_CLAUSE_MASK): Likewise.
1545         (OACC_DATA_CLAUSE_MASK): Likewise.
1546         (OACC_ENTER_DATA_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
1547         (OACC_EXIT_DATA_CLAUSE_MASK): Add FINALIZE clause.
1548         (OACC_UPDATE_CLAUSE_MASK): Remove SELF, add IF_PRESENT.
1549         (cp_parser_oacc_declare): Remove PRESENT_OR_* clauses.
1550         * pt.c (tsubst_omp_clauses): Handle IF_PRESENT and FINALIZE.
1551         * semantics.c (finish_omp_clauses): Handle IF_PRESENT and FINALIZE.
1553 2018-06-20  Marek Polacek  <polacek@redhat.com>
1555         PR c++/86240
1556         * constexpr.c (cxx_eval_constant_expression): Handle ABSU_EXPR.
1557         (fold_simple_1): Likewise.
1558         * error.c (dump_expr): Likewise.
1560 2018-06-20  Nathan Sidwell  <nathan@acm.org>
1562         PR c++/85634
1563         * cp-tree.h (lookup_keep): Drop KEEP parm.
1564         (lookup_list_keep): Delete.
1565         (maybe_get_fns): Declare.
1566         * parser.c (cp_parser_primary_expression): Call lookup_keep here.
1567         (cp_parser_template_id): Not here ...
1568         * decl.c (cp_finish_decl): ... nor here ...
1569         * init.c (build_raw_new_expr): ... nor here ...
1570         * pt.c (process_template_parm): ... nor here ...
1571         * semantics.c (perform_koenig_lookup): Call lookup_keep.
1572         (finish_call_expr): Not here.
1573         * tree.c (ovl_cache): Delete.
1574         (ovl_make, ovl_copy): No cache.
1575         (lookup_keep): Always keep.
1576         (lookup_list_keep): Delete.
1577         (maybe_get_fns): New, broken out of ...
1578         (get_fns): ... here.  Call it.
1579         (built_min_nt_loc, build_min, build_min_non_dep): Drop lookup_keep.
1580         (build_min_nt_call_vec): Likewise.
1582 2018-06-19  Jason Merrill  <jason@redhat.com>
1584         * cp-tree.h (CONSTRUCTOR_NO_IMPLICIT_ZERO): Remove.
1585         * constexpr.c: Use CONSTRUCTOR_NO_CLEARING instead.
1587         PR c++/86182 - ICE with anonymous union passed to template.
1588         * pt.c (tsubst_expr) [DECL_EXPR]: Handle an anonymous union type
1589         used to declare a named variable.
1591 2018-06-18  Jason Merrill  <jason@redhat.com>
1593         * tree.c (cp_expr_location): New.
1594         * cp-tree.h (cp_expr_loc_or_loc): New.
1595         * call.c, cvt.c, constexpr.c, constraint.cc, cp-gimplify.c, decl.c,
1596         error.c, init.c, lex.c, parser.c, pt.c, semantics.c, typeck.c,
1597         typeck2.c: Use it instead of EXPR_LOC_OR_LOC.
1599         * parser.c (cp_parser_lambda_expression): Use a range for
1600         LAMBDA_EXPR_LOCATION.
1602         PR c++/86200 - ICE with unexpanded pack in lambda parameter.
1603         * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
1604         function type.
1606         PR c++/81060 - ICE with unexpanded parameter pack.
1607         * pt.c (check_for_bare_parameter_packs): Add loc parameter.
1608         * decl.c (grokdeclarator): Call it for qualifying_scope.
1610         PR c++/86171 - ICE with recursive alias instantiation.
1611         * pt.c (tsubst_decl): Handle recursive alias instantiation.
1613 2018-06-18  Paolo Carlini  <paolo.carlini@oracle.com>
1615         * decl.c (duplicate_decls): Consistently use DECL_SOURCE_LOCATION
1616         in errors about redefined default arguments; tidy.
1618 2018-06-16  Kugan Vivekanandarajah  <kuganv@linaro.org>
1620         * constexpr.c (potential_constant_expression_1): Handle ABSU_EXPR.
1621         * cp-gimplify.c (cp_fold): Likewise.
1623 2018-06-15  Jason Merrill  <jason@redhat.com>
1625         PR c++/86147 - wrong capture for template argument.
1626         * expr.c (mark_use): Look through NOP_EXPR.
1628         * name-lookup.c (do_pushtag): Don't look through complete types, but
1629         don't add to them either.  Get context from current_binding_level.
1630         * pt.c (tsubst_default_argument): Use push_to/pop_from_top_level.
1632         * decl.c (start_enum): Do compare dependent underlying type.
1634         PR c++/82882 - ICE with lambda in template default argument.
1635         * lambda.c (record_null_lambda_scope): New.
1636         * pt.c (tsubst_lambda_expr): Use it.
1637         * name-lookup.c (do_pushtag): Don't give a lambda DECL_CONTEXT of a
1638         function that isn't open.
1640         * tree.c (maybe_warn_parm_abi): Inform the location of the class.
1642 2018-06-14  Marek Polacek  <polacek@redhat.com>
1644         PR c++/86063
1645         * decl2.c (cp_check_const_attributes): Skip trees that are not
1646         TREE_LISTs.
1648 2018-06-14  Jakub Jelinek  <jakub@redhat.com>
1650         P0624R2 - Default constructible and assignable stateless lambdas
1651         * method.c (synthesized_method_walk): For C++2a don't mark
1652         sfk_constructor or sfk_copy_assignment as deleted if lambda has
1653         no lambda-captures.
1655 2018-06-14  Paolo Carlini  <paolo.carlini@oracle.com>
1657         * decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in
1658         OPT_Wshadow warning_at.
1659         (grokfndecl): Consistently use the location_t argument in
1660         literal operator diagnostic messages.
1661         (grokdeclarator): Use declspecs->locations[ds_storage_class]
1662         in error_at call.
1663         * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION
1664         in permerror call.
1666 2018-06-13  Jason Merrill  <jason@redhat.com>
1668         PR c++/86099 - ICE with trivial copy and non-trivial default ctor.
1669         * constexpr.c (instantiate_cx_fn_r): Don't synthesize trivial
1670         constructors.
1672         PR c++/86094 - wrong code with defaulted move ctor.
1673         * class.c (classtype_has_non_deleted_move_ctor): New.
1674         * tree.c (maybe_warn_parm_abi, type_has_nontrivial_copy_init):
1675         Handle v12 breakage.
1677 2018-06-12  Jason Merrill  <jason@redhat.com>
1679         PR c++/86098 - ICE with template placeholder for TTP.
1680         * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
1681         CLASS_PLACEHOLDER_TEMPLATE.
1683 2018-06-12  Paolo Carlini  <paolo.carlini@oracle.com>
1685         * decl2.c (coerce_new_type, coerce_delete_type): Add location_t
1686         parameter and adjust error_at calls.
1687         * decl.c (grok_op_properties): Adjust calls.
1688         * cp-tree.h (oerce_new_type, coerce_delete_type): Adjust decls.
1690 2018-06-12  Marek Polacek  <polacek@redhat.com>
1692         Core issue 1331 - const mismatch with defaulted copy constructor
1693         * class.c (check_bases_and_members): When checking a defaulted
1694         function, mark it as deleted rather than giving an error.
1696 2018-06-11  Jason Merrill  <jason@redhat.com>
1698         PR c++/85792 -Wctor-dtor-privacy and inherited constructor.
1699         * class.c (maybe_warn_about_overly_private_class): Handle inherited
1700         constructors.
1702         PR c++/85963 - -Wunused-but-set with ?: in template.
1703         * pt.c (tsubst_copy_and_build) [COND_EXPR]: Call mark_rvalue_use.
1705 2018-06-11  Paolo Carlini  <paolo.carlini@oracle.com>
1707         * decl.c (grok_op_properties): Consistently use the location
1708         of the decl; remove special casing of POSTINCREMENT_EXPR and
1709         POSTDECREMENT_EXPR wrt default arguments.
1711 2018-06-05  Jason Merrill  <jason@redhat.com>
1713         * constexpr.c (cxx_eval_binary_expression): Special case comparison
1714         of pointers to members of the same union.
1716 2018-06-11  Jason Merrill  <jason@redhat.com>
1718         PR c++/86094 - wrong code with defaulted move ctor.
1719         * tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.
1721 2018-06-10  Paolo Carlini  <paolo.carlini@oracle.com>
1723         * decl.c (grokfndecl): Use the location_t argument in two more places.
1725 2018-06-06  Marek Polacek  <polacek@redhat.com>
1727         PR c++/85977
1728         * pt.c (unify): If ELTTYPE has no deducible template parms, skip
1729         deduction from the list elements.
1730         (type_unification_real): Check convertibility of list elements.
1732 2018-06-06  Jason Merrill  <jason@redhat.com>
1734         PR c++/86060 - ICE on range for with -std=c++98.
1735         * parser.c (cp_parser_init_statement): Don't clobber *decl after
1736         pedwarn.
1738         PR c++/85710 - ICE with -Wmemset-elt-size.
1739         * semantics.c (finish_call_expr): Call warn_for_memset here.
1740         * parser.c (cp_parser_postfix_expression): Not here.
1741         (literal_integer_zerop): No longer static.
1742         * pt.c (build_non_dependent_expr): Don't wrap CONST_DECL.
1744 2018-06-05  Marek Polacek  <polacek@redhat.com>
1746         PR c++/85976
1747         * tree.c (cp_tree_equal): Handle USING_DECL.
1749 2018-06-05  Jason Merrill  <jason@redhat.com>
1751         PR c++/85731 - wrong error with qualified-id in template.
1752         * semantics.c (finish_qualified_id_expr): build_qualified_name
1753         for unbound names in the current class.
1755 2018-06-04  Jason Merrill  <jason@redhat.com>
1757         PR c++/61806 - missed SFINAE with partial specialization.
1758         * cp-tree.h (deferring_access_check_sentinel): Add deferring_kind
1759         parameter to constructor.
1760         * pt.c (instantiate_class_template_1): Enable access checking
1761         before call to most_specialized_partial_spec.
1763         PR c++/85765 - SFINAE and non-type default template arg.
1764         * pt.c (type_unification_real): Do full semantic processing if
1765         substituting a partial args list replaces all template parms.
1767 2018-06-03  Jason Merrill  <jason@redhat.com>
1769         PR c++/85739 - ICE with pointer to member template parm.
1770         * cvt.c (perform_qualification_conversions): Use cp_fold_convert.
1772 2018-06-02  Jason Merrill  <jason@redhat.com>
1774         PR c++/85761 - ICE with ill-formed use of const outer variable.
1775         * expr.c (mark_use): Handle location wrappers.
1777 2018-06-01  Jason Merrill  <jason@redhat.com>
1779         PR c++/85764 - bogus 'this' not captured error.
1780         * lambda.c (resolvable_dummy_lambda): Use nonlambda_method_basetype.
1781         (nonlambda_method_basetype): Handle NSDMI.
1783         CWG 1581: When are constexpr member functions defined?
1784         * constexpr.c (instantiate_cx_fn_r, instantiate_constexpr_fns): New.
1785         (cxx_eval_outermost_constant_expr): Call instantiate_constexpr_fns.
1787         PR c++/58281 - explicit instantiation of constexpr
1788         * pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.
1790         * pt.c (instantiate_decl): Any defaulted function is defined.
1792 2018-05-30  Jonathan Wakely  <jwakely@redhat.com>
1794         PR c++/77777
1795         * call.c (resolve_args): Use location of expression, not current input
1796         location.
1798 2018-05-30  Ville Voutilainen  <ville.voutilainen@gmail.com>
1800         Do not warn about zero-as-null when NULL is used.
1801         * call.c (conversion_null_warnings): Check for pointer
1802         types converted from zero constants.
1803         (convert_like_real): Add a warning sentinel at the end.
1804         * tree.c (maybe_warn_zero_as_null_pointer_constant): Also
1805         check null_node_p.
1807 2018-05-30  Jason Merrill  <jason@redhat.com>
1809         PR c++/85807 - ICE with call in template NSDMI.
1810         * init.c (get_nsdmi): Use push_to/pop_from_top_level.
1811         * tree.c (bot_manip): Don't set_flags_from_callee in a template.
1813         PR c++/85873 - constant initializer_list array not in .rodata.
1814         * tree.c (build_target_expr): Set TREE_READONLY.
1815         * call.c (set_up_extended_ref_temp): Set TREE_READONLY.
1817         * parser.c (cp_parser_check_condition_declarator): Handle
1818         cp_error_declarator.
1820 2018-05-30  Jonathan Wakely  <jwakely@redhat.com>
1822         * typeck.c (cxx_sizeof_or_alignof_type): Return size_one_node instead
1823         of using it in dead store.
1825 2018-05-29  Jason Merrill  <jason@redhat.com>
1827         PR c++/67445 - returning temporary initializer_list.
1828         PR c++/67711 - assigning from temporary initializer_list.
1829         PR c++/48562 - new initializer_list.
1830         * typeck.c (maybe_warn_about_returning_address_of_local): Also warn
1831         about returning local initializer_list.
1832         * cp-tree.h (AUTO_TEMP_NAME, TEMP_NAME_P): Remove.
1833         * call.c (build_over_call): Warn about assignment from temporary
1834         init_list.
1835         * init.c (build_new_1): Warn about 'new std::initializer_list'.
1836         (find_list_begin, maybe_warn_list_ctor): New.
1837         (perform_member_init): Use maybe_warn_list_ctor.
1839 2018-05-29  Marek Polacek  <polacek@redhat.com>
1841         PR c++/85883
1842         * init.c (build_new): Handle deducing a class with new
1843         with more than one argument.
1845 2018-05-29  Jakub Jelinek  <jakub@redhat.com>
1847         PR c++/85952
1848         * init.c (build_aggr_init): For structured binding initialized from
1849         array call mark_rvalue_use on the initializer.
1851 2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
1853         * decl2.c (start_static_storage_duration_function): Use
1854         splay_tree_delete_pointers.
1856 2018-05-25  Jason Merrill  <jason@redhat.com>
1858         PR c++/85815 - reference to member of enclosing template.
1859         * search.c (lookup_base): Use currently_open_class.
1860         (lookup_member): Use it regardless of -fconcepts.
1861         * parser.c (cp_parser_postfix_dot_deref_expression): Check it.
1863         CWG 616, 1213 - value category of subobject references.
1864         * tree.c (lvalue_kind): Fix handling of ARRAY_REF of pointer.
1866 2018-05-24  Jason Merrill  <jason@redhat.com>
1868         PR c++/85842 - -Wreturn-type, constexpr if and generic lambda.
1869         * pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
1870         generic lambda.
1872 2018-05-24  Ville Voutilainen  <ville.voutilainen@gmail.com>
1874         Pedwarn on a non-standard position of a C++ attribute.
1875         * parser.c (cp_parser_namespace_definition): Pedwarn about attributes
1876         after the namespace name.
1878 2018-05-24  Paolo Carlini  <paolo.carlini@oracle.com>
1880         * cp-tree.h (INDIRECT_TYPE_P): New.
1881         * call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
1882         joust): Use it instead of POINTER_TYPE_P.
1883         * class.c (update_vtable_entry_for_fn, find_flexarrays,
1884         * fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
1885         * constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
1886         * cxx_eval_increment_expression, potential_constant_expression_1):
1887         Likewise.
1888         * cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
1889         * cp-objcp-common.c (cxx_get_alias_set): Likewise.
1890         * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
1891         cp_ubsan_maybe_instrument_downcast): Likewise.
1892         * cvt.c (cp_convert_to_pointer, ocp_convert,
1893         cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
1894         * cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
1895         pp_cxx_offsetof_expression_1): Likewise.
1896         * decl.c (grokparms, static_fn_type): Likewise.
1897         * decl2.c (grokbitfield): Likewise.
1898         * error.c (dump_expr): Likewise.
1899         * except.c (initialize_handler_parm, check_noexcept_r): Likewise.
1900         * init.c (warn_placement_new_too_small): Likewise.
1901         * lambda.c (build_capture_proxy, add_capture): Likewise.
1902         * parser.c (cp_parser_omp_for_loop): Likewise.
1903         * pt.c (convert_nontype_argument, fn_type_unification,
1904         uses_deducible_template_parms, check_cv_quals_for_unify,
1905         dependent_type_p_r): Likewise.
1906         * search.c (check_final_overrider): Likewise.
1907         * semantics.c (handle_omp_array_sections, finish_omp_clauses,
1908         finish_omp_for): Likewise.
1909         * tree.c (cp_build_qualified_type_real): Likewise.
1910         * typeck.c (build_class_member_access_expr,
1911         finish_class_member_access_expr, build_x_indirect_ref,
1912         cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
1913         Likewise.
1915 2018-05-24  Jason Merrill  <jason@redhat.com>
1917         PR c++/85864 - literal template and default template arg.
1918         * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
1920 2018-05-24  Marek Polacek  <polacek@redhat.com>
1922         PR c++/85847
1923         * init.c (build_new_1): Use fold_non_dependent_expr.  Use a dedicated
1924         variable for its result.  Fix a condition.
1925         (build_new): Use fold_non_dependent_expr.  Tweak a condition.
1927 2018-05-23  Jason Merrill  <jason@redhat.com>
1929         Fix cast to rvalue reference from prvalue.
1930         * cvt.c (diagnose_ref_binding): Handle rvalue reference.
1931         * rtti.c (build_dynamic_cast_1): Don't try to build a reference to
1932         non-class type.  Handle xvalue argument.
1933         * typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
1934         rvalue reference.
1935         * semantics.c (finish_compound_literal): Do direct-initialization,
1936         not cast, to initialize a reference.
1938         CWG 616, 1213 - value category of subobject references.
1939         * tree.c (lvalue_kind): A reference to a subobject of a prvalue is
1940         an xvalue.
1941         * typeck2.c (build_m_component_ref): Likewise.
1942         * typeck.c (cp_build_addr_expr_1, lvalue_or_else): Remove diagnostic
1943         distinction between temporary and xvalue.
1945 2018-05-23  Marek Polacek  <polacek@redhat.com>
1947         Implement P0614R1, Range-based for statements with initializer.
1948         * parser.c (cp_parser_range_based_for_with_init_p): New.
1949         (cp_parser_init_statement): Use it.  Parse the optional init-statement
1950         for a range-based for loop.
1951         (cp_parser_skip_to_closing_parenthesis_1): Handle balancing ?:.
1953 2018-05-22  Jason Merrill  <jason@redhat.com>
1955         PR c++/81420 - not extending temporary lifetime.
1956         * call.c (extend_ref_init_temps_1): Handle ARRAY_REF.
1957         * class.c (build_base_path): Avoid redundant move of an rvalue.
1959         PR c++/85866 - error with .* in default template arg.
1960         * pt.c (tsubst_copy_and_build): Handle partial instantiation.
1962 2018-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
1964         * parser.c (cp_parser_parameter_declaration_list): Remove
1965         bool* parameter.
1966         (cp_parser_parameter_declaration_clause): Adjust.
1967         (cp_parser_cache_defarg): Likewise.
1969 2018-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
1971         PR c++/84588
1972         * parser.c (cp_parser_maybe_commit_to_declaration,
1973         cp_parser_check_condition_declarator): New.
1974         (cp_parser_simple_declaration): Use the first above.
1975         (cp_parser_condition): Use both the above; enforce
1976         [stmt.stmt]/2 about the declarator not specifying
1977         a function or an array; improve error-recovery.
1979 2018-05-20  Jason Merrill  <jason@redhat.com>
1981         PR libstdc++/85843 - warning in logic_error copy constructor.
1982         * class.c (type_has_user_nondefault_constructor): Check for a
1983         user-provided ctor, not user-declared.
1985 2018-05-19  Jason Merrill  <jason@redhat.com>
1987         * pt.c (tsubst_pack_expansion): Sorry rather than abort
1988         on __integer_pack as subexpression of pattern.
1990 2018-05-18  Jason Merrill  <jason@redhat.com>
1992         PR c++/58407 - deprecated implicit copy ops.
1993         * call.c (build_over_call): Warn about deprecated trivial fns.
1994         * class.c (classtype_has_user_copy_or_dtor): New.
1995         (type_build_ctor_call): Check TREE_DEPRECATED.
1996         (type_build_dtor_call): Likewise.
1997         * decl2.c (cp_warn_deprecated_use): Move from tree.c.
1998         Add checks.  Return bool.  Handle -Wdeprecated-copy.
1999         (mark_used): Use it.
2000         * decl.c (grokdeclarator): Remove redundant checks.
2001         * typeck2.c (build_functional_cast): Likewise.
2002         * method.c (lazily_declare_fn): Mark deprecated copy ops.
2003         * init.c (build_aggr_init): Only set TREE_USED if there are
2004         side-effects.
2006 2018-05-18  Cesar Philippidis  <cesar@codesourcery.com>
2008         PR c++/85782
2009         * cp-gimplify.c (cp_genericize_r): Call genericize_omp_for_stmt for
2010         OACC_LOOPs.
2012 2018-05-18  Richard Sandiford  <richard.sandiford@linaro.org>
2014         * constexpr.c (cxx_eval_constant_expression): Remove FMA_EXPR handling.
2015         (potential_constant_expression_1): Likewise.
2017 2018-05-16  Marek Polacek  <polacek@redhat.com>
2019         PR c++/85363
2020         * call.c (set_flags_from_callee): Handle AGGR_INIT_EXPRs too.
2021         * tree.c (bot_manip): Call set_flags_from_callee for
2022         AGGR_INIT_EXPRs too.
2024 2018-05-15  Jason Merrill  <jason@redhat.com>
2026         * cp-tree.h (cp_expr): Remove copy constructor.
2027         * mangle.c (struct releasing_vec): Declare copy constructor.
2029         * constexpr.c (cxx_eval_vec_init_1): Pass tf_none if ctx->quiet.
2031         PR c++/64372 - CWG 1560, gratuitous lvalue-rvalue conversion in ?:
2032         * call.c (build_conditional_expr_1): Don't force_rvalue when one arm
2033         is a throw-expression.
2035 2018-05-15  Paolo Carlini  <paolo.carlini@oracle.com>
2037         * cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.
2038         (FOR_EACH_CLONE): Update.
2039         * decl.c (grokdeclarator): Use it.
2040         * decl2.c (vague_linkage_p): Likewise.
2041         * mangle.c (mangle_decl): Likewise.
2042         * method.c (lazily_declare_fn): Likewise.
2043         * optimize.c (can_alias_cdtor, maybe_clone_body): Likewise.
2044         * repo.c (repo_emit_p): Likewise.
2045         * tree.c (decl_linkage): Likewise.
2047 2018-05-14  Jason Merrill  <jason@redhat.com>
2049         Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec.
2050         * tree.c (build_cp_fntype_variant): New.
2051         (build_ref_qualified_type, build_exception_variant)
2052         (strip_typedefs, cxx_copy_lang_qualifiers): Use it.
2053         (cxx_type_hash_eq, cp_check_qualified_type): Check
2054         TYPE_HAS_LATE_RETURN_TYPE.
2055         (cp_build_type_attribute_variant): Check cxx_type_hash_eq.
2056         (cp_build_qualified_type_real): No need to preserve C++ qualifiers.
2057         * class.c (build_clone): Use cxx_copy_lang_qualifiers.
2058         (adjust_clone_args): Likewise.
2059         * decl.c (grokfndecl): Add late_return_type_p parameter.  Use
2060         build_cp_fntype_variant.
2061         (grokdeclarator): Pass late_return_type_p to grokfndecl.
2062         (check_function_type): Use cxx_copy_lang_qualifiers.
2063         (static_fn_type): Use cxx_copy_lang_qualifiers.
2064         * decl2.c (build_memfn_type, maybe_retrofit_in_chrg)
2065         (cp_reconstruct_complex_type, coerce_new_type, coerce_delete_type)
2066         (change_return_type): Use cxx_copy_lang_qualifiers.
2067         * mangle.c (write_type): Use cxx_copy_lang_qualifiers.
2068         * parser.c (cp_parser_lambda_declarator_opt): Represent an explicit
2069         return type on the declarator like a normal trailing return type.
2070         * pt.c (tsubst_function_type): Use build_cp_fntype_variant.
2071         (copy_default_args_to_explicit_spec): Use cxx_copy_lang_qualifiers.
2072         * typeck.c (merge_types): Use build_cp_fntype_variant.
2074 2018-05-14  Paolo Carlini  <paolo.carlini@oracle.com>
2076         * cp-tree.h (TYPE_REF_P): New.
2077         (TYPE_OBJ_P, TYPE_REF_OBJ_P, TYPE_REFFN_P): Update.
2078         * call.c (build_list_conv, build_aggr_conv, standard_conversion,
2079         direct_reference_binding, reference_binding, implicit_conversion,
2080         add_builtin_candidate, build_user_type_conversion_1, build_op_call_1,
2081         build_new_op_1, build_x_va_arg, conv_binds_ref_to_prvalue,
2082         build_over_call, perform_implicit_conversion_flags,
2083         extend_ref_init_temps, type_has_extended_temps): Use it.
2084         * class.c (one_inheriting_sig, check_field_decls,
2085         check_bases_and_members, find_flexarrays, finish_struct,
2086         fixed_type_or_null): Likewise.
2087         * constexpr.c (literal_type_p, cxx_bind_parameters_in_call,
2088         non_const_var_error, cxx_eval_constant_expression,
2089         potential_constant_expression_1): Likewise.
2090         * cp-gimplify.c (omp_var_to_track, omp_cxx_notice_variable,
2091         cp_genericize_r, cxx_omp_privatize_by_reference,
2092         cxx_omp_const_qual_no_mutable, cxx_omp_finish_clause,
2093         cp_fold_maybe_rvalue): Likewise.
2094         * cp-ubsan.c (cp_ubsan_maybe_instrument_downcast): Likewise.
2095         * cvt.c (build_up_reference, convert_to_reference,
2096         convert_from_reference, convert_to_void, noexcept_conv_p,
2097         fnptr_conv_p): Likewise.
2098         * decl.c (poplevel, check_for_uninitialized_const_var,
2099         check_initializer, initialize_local_var, cp_finish_decl,
2100         get_tuple_decomp_init, cp_finish_decomp, grokdeclarator, copy_fn_p,
2101         move_signature_fn_p, grok_op_properties, finish_function): Likewise.
2102         * decl2.c (grok_array_decl, cp_reconstruct_complex_type,
2103         decl_maybe_constant_var_p): Likewise.
2104         * error.c (dump_type_prefix, dump_expr): Likewise.
2105         * except.c (initialize_handler_parm, complete_ptr_ref_or_void_ptr_p,
2106         is_admissible_throw_operand_or_catch_parameter): Likewise.
2107         * expr.c (mark_use): Likewise.
2108         * init.c (build_zero_init_1, build_value_init_noctor,
2109         perform_member_init, diagnose_uninitialized_cst_or_ref_member_1,
2110         build_new, build_delete): Likewise.
2111         * lambda.c (build_lambda_object): Likewise.
2112         * mangle.c (write_expression, write_template_arg): Likewise.
2113         * method.c (forward_parm, do_build_copy_constructor,
2114         do_build_copy_assign, build_stub_object, constructible_expr,
2115         walk_field_subobs): Likewise.
2116         * parser.c (cp_parser_omp_for_loop_init,
2117         cp_parser_omp_declare_reduction_exprs,
2118         cp_parser_omp_declare_reduction): Likewise.
2119         * pt.c (convert_nontype_argument_function, convert_nontype_argument,
2120         convert_template_argument, tsubst_pack_expansion,
2121         tsubst_function_decl, tsubst_decl, tsubst, tsubst_copy_and_build,
2122         maybe_adjust_types_for_deduction, check_cv_quals_for_unify, unify,
2123         more_specialized_fn, invalid_nontype_parm_type_p, dependent_type_p_r,
2124         value_dependent_expression_p, build_deduction_guide): Likewise.
2125         * semantics.c (finish_handler_parms, finish_non_static_data_member,
2126         finish_compound_literal, omp_privatize_field,
2127         handle_omp_array_sections_1, handle_omp_array_sections,
2128         cp_check_omp_declare_reduction, finish_omp_reduction_clause,
2129         finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink,
2130         finish_omp_clauses, finish_decltype_type, capture_decltype,
2131         finish_builtin_launder): Likewise.
2132         * tree.c (lvalue_kind, cp_build_reference_type, move,
2133         cp_build_qualified_type_real, stabilize_expr, stabilize_init): Likewise.
2134         * typeck.c (cxx_safe_arg_type_equiv_p, build_class_member_access_expr,
2135         cp_build_indirect_ref_1, convert_arguments, warn_for_null_address,
2136         cp_build_addr_expr_1, maybe_warn_about_useless_cast,
2137         build_static_cast_1, build_static_cast, build_reinterpret_cast_1,
2138         build_const_cast_1, cp_build_c_cast, cp_build_modify_expr,
2139         convert_for_initialization,
2140         maybe_warn_about_returning_address_of_local, check_return_expr,
2141         cp_type_quals, casts_away_constness, non_reference): Likewise.
2142         * typeck2.c (cxx_readonly_error, store_init_value,
2143         process_init_constructor_record, build_x_arrow, build_functional_cast,
2144         add_exception_specifier): Likewise.
2146 2018-05-14  Jason Merrill  <jason@redhat.com>
2148         * pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p.
2149         (tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl.
2151 2018-05-11  Jakub Jelinek  <jakub@redhat.com>
2153         PR c/85696
2154         * cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
2155         * cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
2156         cxx_omp_predetermined_sharing_1.  Rename old function to ...
2157         (cxx_omp_predetermined_sharing_1): ... this.
2158         * semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
2159         instead of cxx_omp_predetermined_sharing.
2161 2018-05-10  Jason Merrill  <jason@redhat.com>
2163         * decl.c (cp_finish_decl): Don't instantiate auto variable.
2164         (check_static_variable_definition): Allow auto.
2165         * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
2167         * cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
2168         (DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.
2170         Core issue 2310 - conversion to base of incomplete type.
2171         * class.c (build_base_path): Check COMPLETE_TYPE_P for source type.
2173         CWG 2267 - list-initialization of reference temporary
2174         * call.c (reference_binding): List-initializing a reference
2175         temporary is copy-list-initialization.
2177         * parser.c (cp_parser_class_head): Use num_template_headers_for_class.
2179         * pt.c (instantiate_decl): Make sure we aren't trying to do a nested
2180         instantiation in template context.
2182         * class.c (vbase_has_user_provided_move_assign): Use
2183         user_provided_p.
2185         * lambda.c (lambda_expr_this_capture): Improve logic.
2187         * decl.c (make_typename_type): s/parameters/arguments/.
2188         * parser.c (cp_parser_nested_name_specifier_opt): Likewise.
2189         * pt.c (make_pack_expansion): Correct error message.
2191 2018-05-10  Jakub Jelinek  <jakub@redhat.com>
2193         PR c++/85662
2194         * cp-gimplify.c (cp_fold): Use fold_offsetof rather than
2195         fold_offsetof_1, pass TREE_TYPE (x) as TYPE to it and drop the
2196         fold_convert.
2198 2018-05-10  Eric Botcazou  <ebotcazou@adacore.com>
2200         PR c++/85400
2201         * decl2.c (adjust_var_decl_tls_model): New static function.
2202         (comdat_linkage): Call it on a variable.
2203         (maybe_make_one_only): Likewise.
2205 2018-05-09  Paolo Carlini  <paolo.carlini@oracle.com>
2207         PR c++/85713
2208         Revert:
2209         2018-05-08  Paolo Carlini  <paolo.carlini@oracle.com>
2211         PR c++/84588
2212         * parser.c (cp_parser_parameter_declaration_list): When the
2213         entire parameter-declaration-list is erroneous maybe call
2214         abort_fully_implicit_template.
2216 2018-05-08  Jason Merrill  <jason@redhat.com>
2218         PR c++/85706 - class deduction under decltype
2219         * pt.c (for_each_template_parm_r): Handle DECLTYPE_TYPE.  Clear
2220         *walk_subtrees whether or not we walked into the operand.
2221         (type_uses_auto): Only look at deduced contexts.
2223 2018-05-08  Paolo Carlini  <paolo.carlini@oracle.com>
2225         PR c++/84588
2226         * parser.c (cp_parser_parameter_declaration_list): When the
2227         entire parameter-declaration-list is erroneous maybe call
2228         abort_fully_implicit_template.
2230 2018-05-08  Marek Polacek  <polacek@redhat.com>
2232         PR c++/85695
2233         * semantics.c (finish_if_stmt_cond): See through typedefs.
2235 2018-05-07  Jason Merrill  <jason@redhat.com>
2237         PR c++/85646 - lambda visibility.
2238         * decl2.c (determine_visibility): Don't mess with template arguments
2239         from the containing scope.
2240         (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor
2241         thunk.
2243 2018-05-07  Nathan Sidwell  <nathan@acm.org>
2245         Remove fno-for-scope
2246         * cp-tree.h (DECL_ERROR_REPORTED, DECL_DEAD_FOR_LOCAL)
2247         (DECL_HAS_SHADOWED_FOR_VAR_P, DECL_SHADOWED_FOR_VAR)
2248         (SET_DECL_SHADOWED_FOR_VAR): Delete.
2249         (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
2250         (check_for_out_of_scope_variable, init_shadowed_var_for_decl):
2251         Don't declare.
2252         * name-lookup.h (struct cp_binding_level): Remove
2253         dead_vars_from_for field.
2254         * cp-lang.c (cp_init_ts): Delete.
2255         (LANG_HOOKS_INIT_TS): Override to cp_common_init_ts.
2256         * cp-objcp-common.c (shadowed_var_for_decl): Delete.
2257         (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
2258         (init_shadowed_var_for_decl): Delete.
2259         * decl.c (poplevel): Remove shadowed for var handling.
2260         (cxx_init_decl_processing): Remove -ffor-scope deprecation.
2261         * name-lookup.c (find_local_binding): Remove shadowed for var
2262         handling.
2263         (check_local_shadow): Likewise.
2264         (check_for_out_of_scope_variable): Delete.
2265         * parser.c (cp_parser_primary_expression): Remove shadowed for var
2266         handling.
2267         * pt.c (tsubst_decl): Remove DECL_DEAD_FOR_LOCAL setting.
2268         * semantics.c (begin_for_scope): Always have a scope.
2269         (begin_for_stmt, finish_for_stmt): Remove ARM-for scope handling.
2270         (begin_range_for_stmt, finish_id_expression): Likewise.
2272 2018-05-07  Jason Merrill  <jason@redhat.com>
2274         PR c++/85618 - ICE with initialized VLA.
2275         * tree.c (vla_type_p): New.
2276         * typeck2.c (store_init_value, split_nonconstant_init_1): Check it
2277         rather than array_of_runtime_bound_p.
2279 2018-05-05  Paolo Carlini  <paolo.carlini@oracle.com>
2281         * cvt.c (ocp_convert): Early handle the special case of a
2282         null_ptr_cst_p expr converted to a NULLPTR_TYPE_P type.
2284 2018-05-03  Jason Merrill  <jason@redhat.com>
2286         PR c++/85600 - virtual delete failure.
2287         * init.c (build_delete): Always save_expr when deleting.
2289 2018-05-03  Nathan Sidwell  <nathan@acm.org>
2291         * decl.c (cxx_init_decl_processing): Remove flag_friend_injection.
2292         * name-lookup.c (do_pushdecl): Likewise.
2294 2018-05-02  Paolo Carlini  <paolo.carlini@oracle.com>
2295             Jason Merrill  <jason@redhat.com>
2297         PR c++/68374
2298         * name-lookup.c (check_local_shadow): Don't handle static old
2299         declarations in the block handling locals shadowing locals.
2301 2018-05-01  Jason Merrill  <jason@redhat.com>
2303         PR c++/85587 - error with scoped enum in template.
2304         * semantics.c (finish_qualified_id_expr): Don't return an
2305         unqualified IDENTIFIER_NODE.
2307 2018-04-30  Jason Merrill  <jason@redhat.com>
2309         PR c++/85580 - extern "C" and local variables
2310         * name-lookup.c (check_extern_c_conflict): Ignore local decls.
2312         PR c++/84701 - unsigned typeof.
2313         * decl.c (grokdeclarator): Overhaul diagnostics for invalid use
2314         of long/short/signed/unsigned.
2316         PR c++/85305 - pack in lambda init-capture.
2317         * parser.c (cp_parser_initializer): Add subexpression_p parm; don't
2318         check_for_bare_parameter_packs in a subexpression.
2319         (cp_parser_lambda_introducer): Use it.
2321         PR c++/61982 - dead stores to destroyed objects.
2322         * call.c (build_trivial_dtor_call): New, assigns a clobber.
2323         (build_over_call, build_special_member_call): Use it.
2324         * cp-tree.h: Declare it.
2325         * init.c (build_delete): Remove trivial path.
2327         * init.c (build_dtor_call): Use build_special_member_call.
2328         (build_delete): Remove redundant uses of save_addr.
2330         * decl.c (build_clobber_this): Use build_clobber.
2332 2018-04-27  Jakub Jelinek  <jakub@redhat.com>
2334         PR c++/85553
2335         * init.c (build_zero_init_1): For zero initialization of
2336         NULLPTR_TYPE_P type use build_int_cst directly.
2338 2018-04-27  David Malcolm  <dmalcolm@redhat.com>
2340         PR c++/85515
2341         * name-lookup.c (consider_binding_level): Skip compiler-generated
2342         variables.
2343         * search.c (lookup_field_fuzzy_info::fuzzy_lookup_field): Flatten
2344         nested if statements into a series of rejection tests.  Reject
2345         lambda-ignored entities as suggestions.
2347 2018-04-27  Jason Merrill  <jason@redhat.com>
2349         * cvt.c (cp_fold_convert): Use convert_ptrmem.
2350         * typeck.c (convert_ptrmem): Add a NOP even if no adjustment.
2352 2018-04-27  Paolo Carlini  <paolo.carlini@oracle.com>
2354         PR c++/84691
2355         * decl.c (grokdeclarator): Clear friendp upon definition in local
2356         class definition error.
2358 2018-04-27  Jason Merrill  <jason@redhat.com>
2360         PR c++/85545 - ICE with noexcept PMF conversion.
2361         * cvt.c (cp_fold_convert): Pass PMF CONSTRUCTORs to
2362         build_ptrmemfunc.
2363         * typeck.c (build_ptrmemfunc): Don't build a NOP_EXPR for zero
2364         adjustment.
2365         (build_ptrmemfunc_access_expr): Special-case CONSTRUCTORs.
2367 2018-04-27  Nathan Sidwell  <nathan@acm.org>
2369         * typeck.c (convert_ptrmem): Move local var decls to initialization.
2371         * cp-tree.h (TEMPLATE_INFO): Fix comments.
2372         (TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO.
2373         (NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line.
2374         (dump, print_other_binding_stacks): Remove declarations.
2375         * name-lookup.c (print_other_binding_stack): Make static.
2376         * pt.c (build_template_decl): Make static.
2378 2018-04-26  Jason Merrill  <jason@redhat.com>
2380         PR c++/85545 - ICE with noexcept PMF conversion.
2381         * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly.
2383 2018-04-25  Nathan Sidwell  <nathan@acm.org>
2385         PR c++/85437
2386         PR c++/49171
2387         * cp-tree.h (REINTERPRET_CAST_P): New.
2388         * constexpr.c (cxx_eval_constant_expression) <case NOP_EXPR>:
2389         Reject REINTERPET_CAST_P conversions.  Use cplus_expand_constant
2390         for non-trivial PTRMEM_CST cases.
2391         * typeck.c (build_nop_reinterpret): New.
2392         (build_reinterpret_cast_1): Use it.  Set REINTERPRET_CAST_P on
2393         NOP_EXPRs returned by cp_convert.
2395 2018-04-23  Jason Merrill  <jason@redhat.com>
2397         PR c++/69560 - wrong alignof(double) on x86.
2398         CWG 1879 - Inadequate definition of alignment requirement.
2399         * cp-tree.h (ALIGNOF_EXPR_STD_P): New.
2400         * typeck.c (cxx_sizeof_or_alignof_type): Add std_alignof parm.
2401         (cxx_sizeof_expr, cxx_sizeof_nowarn, cxx_alignas_expr)
2402         (cxx_alignof_expr): Pass it.
2403         * parser.c (cp_parser_unary_expression): Pass it.
2404         * pt.c (tsubst_copy): Copy it.
2405         (tsubst_copy_and_build): Pass it.
2406         * decl.c (fold_sizeof_expr): Pass it.
2408 2018-04-23  Jakub Jelinek  <jakub@redhat.com>
2409             Jason Merrill  <jason@redhat.com>
2411         PR c++/85470 - wrong error with static data member.
2412         * decl.c (check_initializer): Check DECL_INITIALIZED_IN_CLASS_P.
2413         * typeck2.c (store_init_value): Likewise.
2415 2018-04-20  Jakub Jelinek  <jakub@redhat.com>
2417         PR c++/85462
2418         * cp-tree.h (tinst_level): Remove in_system_header_p member,
2419         change refcount member from unsigned char to unsigned short,
2420         add refcount_infinity static data member, adjust comments.
2421         * pt.c (tinst_level::refcount_infinity): Define.
2422         (inc_refcount_use): Remove assert, don't increment if refcount
2423         is already refcount_infinity, adjust comment.
2424         (dec_refcount_use): Remove assert, don't decrement if refcount
2425         is refcount_infinity, adjust comment.
2426         (push_tinst_level_loc): Formatting fix.
2428 2018-04-19  Paolo Carlini  <paolo.carlini@oracle.com>
2430         PR c++/84611
2431         * pt.c (lookup_template_class_1): Check pushtag return value for
2432         error_mark_node.
2434 2018-04-19  Alexandre Oliva  <aoliva@redhat.com>
2436         PR c++/80290
2437         * cp-tree.h (tinst_level::free): Fix whitespace.
2439 2018-04-18  Paolo Carlini  <paolo.carlini@oracle.com>
2441         PR c++/84630
2442         * pt.c (tsubst_lambda_expr): Check begin_lambda_type return value
2443         for error_mark_node.
2445 2018-04-18  Jakub Jelinek  <jakub@redhat.com>
2447         PR c++/84463
2448         * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like
2449         tricks from here to ...
2450         * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here.  Only use it
2451         if INDIRECT_REF's operand is INTEGER_CST cast to pointer type.
2453 2018-04-18  Alexandre Oliva <aoliva@redhat.com>
2455         PR c++/80290
2456         * cp-tree.h (struct tinst_level): Split decl into tldcl and
2457         targs.  Add private split_list_p, tree_list_p, and not_list_p
2458         inline const predicates; to_list private member function
2459         declaration; free public member function declaration; list_p,
2460         get_node and maybe_get_node accessors, and refcount data
2461         member.  Narrow errors to unsigned short.
2462         * error.c (print_instantiation_full_context): Use new
2463         accessors.
2464         (print_instantiation_partial_context_line): Likewise.  Drop
2465         const from tinst_level-typed parameter.
2466         * mangle.c (mangle_decl_string): Likewise.
2467         * pt.c (freelist): New template class.
2468         (tree_list_freelist_head): New var.
2469         (tree_list_freelist): New fn, along with specializations.
2470         (tinst_level_freelist_head): New var.
2471         (pending_template_freelist_head): Likewise.
2472         (tinst_level_freelist, pending_template_freelist): New fns.
2473         (tinst_level::to_list, tinst_level::free): Define.
2474         (inc_refcount_use, dec_refcount_use): New fns for tinst_level.
2475         (set_refcount_ptr): New template fn.
2476         (add_pending_template): Adjust for refcounting, freelists and
2477         new accessors.
2478         (neglectable_inst_p): Take a NULL d as a non-DECL.
2479         (limit_bad_template_recursion): Use new accessors.
2480         (push_tinst_level): New overload to create the list.
2481         (push_tinst_level_loc): Make it static, split decl into two
2482         args, adjust tests and initialization to cope with split
2483         lists, use freelist, adjust for refcounting.
2484         (push_tinst_level_loc): New wrapper with the old interface.
2485         (pop_tinst_level): Adjust for refcounting.
2486         (record_last_problematic_instantiation): Likewise.
2487         (reopen_tinst_level): Likewise.  Use new accessors.
2488         (instantiate_alias_template): Adjust for split list.
2489         (fn_type_unification): Likewise.
2490         (get_partial_spec_bindings): Likewise.
2491         (instantiate_pending_templates): Use new accessors.  Adjust
2492         for refcount.  Release pending_template to freelist.
2493         (instantiating_current_function_p): Use new accessors.
2495 2018-04-16  Alexandre Oliva <aoliva@redhat.com>
2497         PR c++/85039
2498         * parser.c (cp_parser_builtin_offset): Reject type definitions.
2499         * mangle.c (nested_anon_class_index): Avoid crash returning -1
2500         if we've seen errors.
2502 2018-04-12  David Malcolm  <dmalcolm@redhat.com>
2504         PR c++/85385
2505         * name-lookup.c (macro_use_before_def::maybe_make): New function,
2506         checking that the use is indeed before the definition.
2507         (macro_use_before_def::macro_use_before_def): Make private.
2508         (macro_use_before_def::~macro_use_before_def): Make private.  Move
2509         check for UNKNOWN_LOCATION to macro_use_before_def::maybe_make.
2510         (lookup_name_fuzzy): Call macro_use_before_def::maybe_make rather
2511         than using new directly.
2513 2018-04-12  Jason Merrill  <jason@redhat.com>
2515         PR c++/85356 - ICE with pointer to member function.
2516         * pt.c (maybe_instantiate_noexcept): Do instantiate in templates if
2517         flag_noexcept_type.  Build the new spec within the function context.
2518         * except.c (build_noexcept_spec): Do get constant value in templates
2519         if flag_noexcept_type.
2520         * decl.c (check_redeclaration_exception_specification): Don't
2521         instantiate noexcept on a dependent declaration.
2523 2018-04-12  Marek Polacek  <polacek@redhat.com>
2525         PR c++/85258
2526         * constexpr.c (reduced_constant_expression_p): Return false for null
2527         trees.
2529 2018-04-11  Marek Polacek  <polacek@redhat.com>
2531         PR c++/85032
2532         * constexpr.c (potential_constant_expression_1): Consider conversions
2533         from classes to literal types potentially constant.
2535 2018-04-10  Paolo Carlini  <paolo.carlini@oracle.com>
2537         PR c++/70808
2538         * init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
2539         the type like TYPE_PTR_OR_PTRMEM_P.
2541 2018-04-10  Jason Merrill  <jason@redhat.com>
2543         PR debug/65821 - wrong location for main().
2544         * call.c (clear_location_r, convert_default_arg): Revert.
2545         * tree.c (break_out_target_exprs): Add clear_location parm.
2546         (struct bot_data): New.
2547         (bot_manip): Clear location if requested.
2548         * init.c (get_nsdmi): Pass clear_location.
2550 2018-04-10  David Malcolm  <dmalcolm@redhat.com>
2552         PR c++/85110
2553         * call.c (get_fndecl_argument_location): Make non-static.
2554         * cp-tree.h (get_fndecl_argument_location): New decl.
2555         * typeck.c (convert_for_assignment): When complaining due to
2556         conversions for an argument, show the location of the parameter
2557         within the decl.
2559 2018-04-10  Jakub Jelinek  <jakub@redhat.com>
2561         PR c++/85312 - P0962 cleanup
2562         * parser.c (cp_parser_perform_range_for_lookup): Remove unreachable
2563         diagnostics.
2565 2018-04-10  Jason Merrill  <jason@redhat.com>
2567         PR debug/65821 - wrong location for main().
2568         * call.c (clear_location_r): New.
2569         (convert_default_arg): Use it.
2570         * tree.c (bot_manip): Remove builtin_LINE/FILE handling.
2572         PR c++/85285 - ICE with flexible array after substitution.
2573         * pt.c (instantiate_class_template_1): Check for flexible array in
2574         union.
2576 2018-04-09  Paolo Carlini  <paolo.carlini@oracle.com>
2578         PR c++/85227
2579         * decl.c (cp_finish_decomp): In a template, if the type is incomplete
2580         issue a pedwarn and defer trying to do bindings.
2582 2018-04-09  Jason Merrill  <jason@redhat.com>
2584         PR c++/85279 - dump_expr doesn't understand decltype.
2585         * error.c (dump_expr): Handle DECLTYPE_TYPE.
2587         PR c++/85262 - ICE with redundant qualification on constructor.
2588         * call.c (build_new_method_call_1): Move make_args_non_dependent
2589         after A::A() handling.
2591         PR c++/85277 - ICE with invalid offsetof.
2592         * semantics.c (finish_offsetof): Avoid passing non-DECL to %qD.
2593         Adjust -Winvalid-offsetof diagnostic to say conditionally supported.
2595         PR c++/85264 - ICE with excess template-parameter-list.
2596         * parser.c (cp_parser_check_template_parameters): Add template_id_p
2597         parameter.  Don't allow an extra template header if true.
2598         (cp_parser_class_head): Pass template_id_p.
2599         (cp_parser_elaborated_type_specifier): Likewise.
2600         (cp_parser_alias_declaration): Likewise.
2601         (cp_parser_check_declarator_template_parameters): Likewise.
2603 2018-04-09  Jakub Jelinek  <jakub@redhat.com>
2605         PR c++/85194
2606         * parser.c (cp_parser_simple_declaration): For structured bindings,
2607         if *maybe_range_for_decl is NULL after parsing it, set it to
2608         error_mark_node.
2610 2018-04-09  Jason Merrill  <jason@redhat.com>
2612         PR c++/85256 - ICE capturing pointer to VLA.
2613         * lambda.c (add_capture): Distinguish between variable-size and
2614         variably-modified types.
2616 2018-04-06  Jason Merrill  <jason@redhat.com>
2618         PR c++/85214 - ICE with alias, generic lambda, constexpr if.
2619         * pt.c (extract_locals_r): Remember local typedefs.
2621 2018-04-06  David Malcolm  <dmalcolm@redhat.com>
2623         PR c++/84269
2624         * name-lookup.c (struct std_name_hint): Move out of
2625         get_std_name_hint; add field "min_dialect".
2626         (get_std_name_hint): Add min_dialect values to all initializers.
2627         Add <any>, <atomic>, <bitset>, <condition_variable>, <functional>,
2628         <future>, <istream>, <iterator>, <ostream>, <mutex>, <optional>,
2629         <shared_mutex>, <string_view>, <thread>, and <variant>.
2630         Add fstream, ifstream, and ofstream to <fstream>.
2631         Add istringstream, ostringstream, and stringstream to <sstream>.
2632         Add basic_string to <string>.
2633         Add tuple_element and tuple_size to <tuple>.
2634         Add declval to <utility>.
2635         Fix ordering of <queue> and <tuple>.
2636         Return a std_name_hint, rather than a const char *.
2637         (get_cxx_dialect_name): New function.
2638         (maybe_suggest_missing_std_header): Detect names that aren't yet
2639         available in the current dialect, and instead of suggesting a
2640         missing #include, warn about the dialect.
2642 2018-04-06  Jakub Jelinek  <jakub@redhat.com>
2644         PR c++/85210
2645         * pt.c (tsubst_decomp_names): Return error_mark_node and assert
2646         errorcount is set if tsubst doesn't return a VAR_DECL.
2648 2018-04-06  David Malcolm  <dmalcolm@redhat.com>
2650         PR c++/85021
2651         * name-lookup.c (using_directives_contain_std_p): New function.
2652         (has_using_namespace_std_directive_p): New function.
2653         (suggest_alternatives_for): Simplify if/else logic using early
2654         returns.  If no candidates were found, and there's a
2655         "using namespace std;" directive, call
2656         maybe_suggest_missing_std_header.
2657         (maybe_suggest_missing_header): Split later part of the function
2658         into..
2659         (maybe_suggest_missing_std_header): New.
2661 2018-04-06  Jason Merrill  <jason@redhat.com>
2663         PR c++/85242 - ICE with class definition in template parm.
2664         * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): False if
2665         processing_template_parmlist.
2667         PR c++/85240 - LTO ICE with using of undeduced auto fn.
2668         * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto.
2670 2018-04-05  Jakub Jelinek  <jakub@redhat.com>
2672         PR c++/85209
2673         * pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
2674         is not prev, if prev == decl.
2676         PR c++/85208
2677         * decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
2678         maybe_apply_pragma_weak here...
2679         (cp_maybe_mangle_decomp): ... but call it here instead.
2681 2018-04-05  Jason Merrill  <jason@redhat.com>
2683         PR c++/85136 - ICE with designated init in template.
2684         * decl.c (maybe_deduce_size_from_array_init): Handle dependent
2685         designated initializer.
2686         (check_array_designated_initializer): Update ce->index with the
2687         constant value.
2689         PR c++/83808 - ICE with VLA initialization.
2690         * typeck2.c (process_init_constructor_array): Don't require a VLA
2691         initializer to have VLA type.
2693 2018-04-05  Paolo Carlini  <paolo.carlini@oracle.com>
2695         PR c++/80956
2696         * call.c (convert_like_real): Fail gracefully for a broken
2697         std::initializer_list, missing a definition.
2699         * name-lookup.c (do_pushtag): Tweak message, use %< and %>.
2701 2018-04-05  Paolo Carlini  <paolo.carlini@oracle.com>
2703         PR c++/84792
2704         * decl.c (grokdeclarator): Fix diagnostic about typedef name used
2705         as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
2707 2018-04-05  Jason Merrill  <jason@redhat.com>
2709         PR c++/82152 - ICE with class deduction and inherited ctor.
2710         * pt.c (do_class_deduction): Ignore inherited ctors.
2712         PR c++/84665 - ICE with array of empty class.
2713         * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
2715         PR c++/85228 - ICE with lambda in enumerator in template.
2716         * pt.c (bt_instantiate_type_proc): Don't assume
2717         CLASSTYPE_TEMPLATE_INFO is non-null.
2719 2018-04-05  Ville Voutilainen  <ville.voutilainen@gmail.com>
2721         Implement P0969
2722         * decl.c (find_decomp_class_base): Check accessibility instead
2723         of declared access, adjust diagnostic.
2725 2018-04-05  Ville Voutilainen  <ville.voutilainen@gmail.com>
2727         Implement P0961
2728         * decl.c (get_tuple_decomp_init): Check the templatedness
2729         of a member get.
2731 2018-04-05  Jason Merrill  <jason@redhat.com>
2733         PR c++/85200 - ICE with constexpr if in generic lambda.
2734         * pt.c (extract_locals_r): Don't record the local specs of variables
2735         declared within the pattern.
2737 2018-04-05  Alexandre Oliva <aoliva@redhat.com>
2739         PR c++/84979
2740         * pt.c (check_auto_in_tmpl_args): New.
2741         (tsubst_qualified_id): Use it to reject template args
2742         referencing auto for non-type templates.
2743         * parser.c (cp_parser_template_id): Likewise.
2744         * cp-tree.h (check_auto_in_tmpl_args): Declare.
2745         * typeck2.c (build_functional_cast): Report correct location
2746         for invalid use of auto.
2748 2018-04-04  Jason Merrill  <jason@redhat.com>
2750         PR c++/85215 - ICE with copy-init from conversion.
2751         * call.c (merge_conversion_sequences): Fix type of direct binding
2752         sequence.
2754         PR c++/84938 - ICE with division by ~-1.
2755         * call.c (set_up_extended_ref_temp): Call cp_fully_fold.
2757         PR c++/84936 - ICE with unexpanded pack in mem-initializer.
2758         * parser.c (cp_parser_mem_initializer_list): Call
2759         check_for_bare_parameter_packs.
2761 2018-04-04  Jakub Jelinek  <jakub@redhat.com>
2763         PR inline-asm/85172
2764         * constexpr.c (cxx_eval_builtin_function_call): For calls to
2765         builtin_valid_in_constant_expr_p functions, don't call
2766         cxx_eval_constant_expression if argument is not
2767         potential_constant_expression.
2769         PR c++/85146
2770         * cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
2771         argument.
2772         * semantics.c (calculate_bases): Add complain argument.  Use
2773         complete_type_or_maybe_complain instead of just complete_type and
2774         return an empty vector if it fails.  Move make_tree_vector () call
2775         after early return.  Formatting fixes.
2776         (calculate_direct_bases): Likewise.  Call release_tree_vector at the
2777         end.
2778         (dfs_calculate_bases_post, calculate_bases_helper): Formatting fixes.
2779         * pt.c (tsubst_pack_expansion): Adjust calculate_bases and
2780         calculate_direct_bases callers, formatting fixes.
2782 2018-04-04  Jason Merrill  <jason@redhat.com>
2784         PR c++/85006 - -fconcepts ICE with A<auto...> return type
2785         * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
2787         PR c++/85200 - ICE with constexpr if in generic lambda.
2788         * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
2790         PR c++/84221 - bogus -Wunused with attribute and template.
2791         * decl2.c (is_late_template_attribute): Handle unused and used
2792         normally on non-TYPE_DECL.
2794         PR c++/85135 - ICE with omitted template arguments.
2795         * decl.c (grokdeclarator): Catch deduced class type in trailing
2796         return type.
2798         PR c++/85133 - ICE with missing concept initializer.
2799         * decl.c (cp_finish_decl): If a concept initializer is missing, use
2800         true.
2802         PR c++/85118 - wrong error with generic lambda and std::bind.
2803         * call.c (add_template_conv_candidate): Disable if there are any
2804         call operators.
2806         PR c++/85141 - ICE with compound assignment and static member fn.
2807         * typeck.c (cp_build_modify_expr): Call decay_conversion for RHS of
2808         compound assignment.
2810         PR c++/85148 - ICE with 'this' in array NSDMI.
2811         * tree.c (replace_placeholders_r): Use handled_component_p.
2813 2018-04-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
2815         PR c++/65923
2816         * decl.c (grokfndecl): Handle standard UDL diagnostics here..
2817         * parser.c (cp_parser_unqualified_id): ..not here.
2819 2018-04-04  Alexandre Oliva <aoliva@redhat.com>
2821         PR c++/84943
2822         * typeck.c (cp_build_addr_expr_1): Mark FUNCTION_DECL as
2823         used.
2824         * decl2.c (mark_used): Return without effects if tf_conv.
2826 2018-04-03  Jason Merrill  <jason@redhat.com>
2828         PR c++/85092 - C++17 ICE with unused list constructor.
2829         * call.c (conv_binds_ref_to_prvalue): Also count ck_identity
2830         from a TARGET_EXPR.
2832         PR c++/85113 - ICE with constexpr and __builtin_constant_p.
2833         * constexpr.c (cxx_eval_builtin_function_call): Only defer
2834         __builtin_constant_p if ctx->quiet.
2836 2018-04-03  Paolo Carlini  <paolo.carlini@oracle.com>
2838         PR c++/84768
2839         * pt.c (rewrite_template_parm): If the first argument is
2840         error_mark_node return it immediately.
2841         (build_deduction_guide): Check the return value of the
2842         latter for error_mark_node.
2843         (do_class_deduction): Check the return value of the latter.
2845 2018-04-03  Jason Merrill  <jason@redhat.com>
2847         * semantics.c (finish_if_stmt_cond): Use
2848         instantiation_dependent_expression_p.
2850         PR c++/85149 - generic lambda and constexpr if.
2851         * pt.c (build_extra_args, add_extra_args): Split from
2852         tsubst_pack_expansion.
2853         (tsubst_expr) [IF_STMT]: Use them.
2854         * cp-tree.h (IF_STMT_EXTRA_ARGS): New.
2856         * typeck.c (merge_types): Limit matching attribute shortcut to
2857         the default case.
2859 2018-04-03  Jakub Jelinek  <jakub@redhat.com>
2861         PR c++/85147
2862         * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
2864         PR c++/85140
2865         * name-lookup.c (handle_namespace_attrs): Return early if attributes
2866         is error_mark_node.
2868         PR c++/85134
2869         * decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
2870         fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
2871         instead for static data members clear init and set DECL_EXTERNAL.
2873 2018-04-02  Jason Merrill  <jason@redhat.com>
2875         PR c++/64095 - auto... parameter pack.
2876         * parser.c (cp_parser_parameter_declaration): Handle turning autos
2877         into packs here.
2878         (cp_parser_parameter_declaration_list): Not here.
2880 2018-03-31  Alexandre Oliva <aoliva@redhat.com>
2882         PR c++/85027
2883         * class.c (instantiate_type): Peel off SAVE_EXPR before
2884         BASELINK.
2886 2018-03-30  Jason Merrill  <jason@redhat.com>
2888         * typeck2.c (process_init_constructor_record): Use
2889         init_list_type_node for the CONSTRUCTOR around an anonymous union
2890         designated initializer.
2892 2018-03-30  Jakub Jelinek  <jakub@redhat.com>
2894         PR c++/84791
2895         * semantics.c (finish_omp_reduction_clause): If
2896         OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
2897         even if processing_template_decl.
2899 2018-03-29  David Malcolm  <dmalcolm@redhat.com>
2901         PR c++/84269
2902         * name-lookup.c (get_std_name_hint): Add names from <memory>,
2903         <tuple>, and <utility>.
2905 2018-03-29  Jason Merrill  <jason@redhat.com>
2907         PR c++/85093 - too many template args with pack expansion.
2908         * pt.c (coerce_template_parms): Keep pack expansion args that will
2909         need to be empty.
2911 2018-03-29  Jason Merrill  <jason@redhat.com>
2913         * pt.c (build_non_dependent_expr): Propagate expr location.
2915 2018-03-27  Jason Merrill  <jason@redhat.com>
2917         PR c++/85060 - wrong-code with call to base member in template.
2918         * search.c (any_dependent_bases_p): Check uses_template_parms
2919         rather than processing_template_decl.
2921 2018-03-29  David Malcolm  <dmalcolm@redhat.com>
2923         PR c++/85110
2924         * typeck.c (convert_for_assignment): When complaining due to
2925         conversions for an argument, attempt to use the location of the
2926         argument.
2928 2018-03-28  Paolo Carlini  <paolo.carlini@oracle.com>
2930         PR c++/85028
2931         * pt.c (tsubst_default_argument): Early return if the type of the
2932         parameter is erroneous.
2934 2018-03-28  Alexandre Oliva <aoliva@redhat.com>
2936         PR c++/84973
2937         * decl2.c (note_vague_linkage_fn): Don't defer uninstantiated
2938         templates.
2940         PR c++/84968
2941         * tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.
2943 2018-03-27  Paolo Carlini  <paolo.carlini@oracle.com>
2945         PR c++/85067
2946         * method.c (defaulted_late_check): Partially revert r253321 changes,
2947         do not early return upon error.
2949 2018-03-27  Jakub Jelinek  <jakub@redhat.com>
2951         PR c++/85077
2952         * cp-gimplify.c (cp_fold) <case CONSTRUCTOR>: For ctors with vector
2953         type call fold to generate VECTOR_CSTs when possible.
2955         PR c++/85076
2956         * tree.c (cp_build_reference_type): If to_type is error_mark_node,
2957         return it right away.
2959 2018-03-27  Volker Reichelt  <v.reichelt@netcologne.de>
2961         * search.c (check_final_overrider): Use inform instead of error
2962         for the diagnostics of the overridden functions.  Tweak wording.
2964 2018-03-27  Jakub Jelinek  <jakub@redhat.com>
2966         PR c++/85068
2967         * class.c (update_vtable_entry_for_fn): Don't ICE if base_binfo
2968         is NULL.  Assert if thunk_binfo is NULL then errorcount is non-zero.
2970 2018-03-27  Paolo Carlini  <paolo.carlini@oracle.com>
2971             Jason Merrill  <jason@redhat.com>
2973         PR c++/84632
2974         * init.c (build_aggr_init): When initializing from array,
2975         reject anything but CONSTRUCTORs and TARGET_EXPRs.
2976         (build_vec_init): Handle separately ARRAY_TYPEs.
2978 2018-03-26  Jason Merrill  <jason@redhat.com>
2980         PR c++/85062 - ICE with alignas in wrong place.
2981         * decl.c (grokdeclarator): Ignore attributes on type-specifiers
2982         here.
2984         PR c++/85049 - ICE with __integer_pack.
2985         * pt.c (unify_pack_expansion): Don't try to deduce generated packs.
2986         * cp-tree.h (TEMPLATE_PARM_P): New.
2988 2018-03-23  Jason Merrill  <jason@redhat.com>
2990         PR c++/78489 - wrong SFINAE behavior.
2992         PR c++/84489
2993         * pt.c (type_unification_real): Don't defer substitution failure.
2995 2018-03-23  Jakub Jelinek  <jakub@redhat.com>
2997         PR c++/85015
2998         * decl.c (compute_array_index_type): Set osize to mark_rvalue_use
2999         result.
3001         PR c++/84942
3002         * pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
3003         cp_build_unary_op call with gcc_unreachable ().
3005 2018-03-23  Marek Polacek  <polacek@redhat.com>
3007         PR c++/85045
3008         * cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
3009         Handle EXACT_DIV_EXPR and RDIV_EXPR.  Tweak condition.
3010         (cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.
3012 2018-03-23  Ville Voutilainen  <ville.voutilainen@gmail.com>
3014         Implement P0962
3015         * parser.c (cp_parser_perform_range_for_lookup): Change
3016         the condition for deciding whether to use members.
3018 2018-03-23  Marek Polacek  <polacek@redhat.com>
3020         PR c++/85033
3021         * semantics.c (finish_offsetof): Don't allow CONST_DECLs.
3023 2018-03-23  Alexandre Oliva <aoliva@redhat.com>
3025         PR c++/71251
3026         * parser.c (cp_parser_alias_declaration): Call
3027         parser_check_template_parameters.
3029         PR c++/84789
3030         * pt.c (resolve_typename_type): Drop assert that stopped
3031         simplification to template-independent types.  Add assert to
3032         verify the initial scope is template dependent.
3033         * parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
3034         Reparse the id expression as a type-name, not a declarator.
3036         PR c++/84729
3037         * init.c (build_vec_init): Error at parenthesized array init.
3039         PR c++/84610
3040         PR c++/84642
3041         PR c++/84942
3042         * cp-tree.h (temp_override): New template class, generalizing
3043         a cleanup that was only used...
3044         * parser.c (cp_parser_parameter_declaration_clause):
3045         ... here for auto_is_implicit_function_template_parm_p.
3046         (cp_parser_gnu_attributes_opt): Use it here as well.
3047         (cp_parser_std_attribute): Likewise.
3049 2018-03-22  Marek Polacek  <polacek@redhat.com>
3051         PR c++/84854
3052         * semantics.c (finish_if_stmt_cond): Check if the type of the condition
3053         is boolean.
3055 2018-03-21  Jason Merrill  <jason@redhat.com>
3057         PR c++/81311 - wrong C++17 overload resolution.
3058         * call.c (build_user_type_conversion_1): Remove C++17 code.
3059         (conv_binds_ref_to_prvalue): New.
3060         (build_over_call): Handle C++17 copy elision.
3061         (build_special_member_call): Only do C++17 copy elision here if the
3062         argument is already the right type.
3064 2018-03-21  Alexandre Oliva <aoliva@redhat.com>
3066         PR c++/71965
3067         * init.c (build_vec_init): Silence error, former sorry,
3068         without tf_error.
3070         PR c++/84610
3071         PR c++/84642
3072         * parser.c (abort_fully_implicit_template_p): New.
3073         (cp_parser_skip_to_end_of_statement): Use it.
3074         (cp_parser_skip_to_end_of_block_or_statement): Likewise.
3075         (finish_fully_implicit_template_p): Clear
3076         implicit_template_parms and implicit_template_scope.
3078 2018-03-21  Paolo Carlini  <paolo.carlini@oracle.com>
3080         PR c++/84972
3081         * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to
3082         error_mark_node when check_array_designated_initializer fails.
3084 2018-03-21  Jakub Jelinek  <jakub@redhat.com>
3086         PR c++/84961
3087         * cp-tree.h (genericize_compound_lvalue): Declare.
3088         * typeck.c (genericize_compound_lvalue): New function.
3089         (unary_complex_lvalue, cp_build_modify_expr): Use it.
3090         * semantics.c (finish_asm_stmt): Replace MODIFY_EXPR, PREINCREMENT_EXPR
3091         and PREDECREMENT_EXPR in output and "m" constrained input operands with
3092         COMPOUND_EXPR.  Call cxx_mark_addressable on the rightmost
3093         COMPOUND_EXPR operand.
3095 2018-03-21  Nathan Sidwell  <nathan@acm.org>
3097         PR c++/85008
3098         * tree.c (decl_linkage): Use DECL_CLONED_FUNCTION_P.
3099         * decl2.c (vague_linkage_p): Likewise.
3101 2018-03-21  David Malcolm  <dmalcolm@redhat.com>
3103         PR c++/84994
3104         * constexpr.c (constexpr_fn_retval): Make non-"static".
3105         * cp-tree.h (constexpr_fn_retval): New decl.
3106         * search.c (direct_accessor_p): Update leading comment.
3107         (reference_accessor_p): Likewise.
3108         (field_accessor_p): Replace check that function body is a
3109         RETURN_EXPR with a call to constexpr_fn_retval.  Fix
3110         indentation of "field_type" decl.
3112 2018-03-21  Nathan Sidwell  <nathan@acm.org>
3114         PR c++/84804
3115         * name-lookup.c (do_pushtag): Permit lambdas to be pushed into
3116         complete classes.
3118 2018-03-21  Martin Sebor  <msebor@redhat.com>
3120         PR c++/84850
3121         * call.c (first_non_public_field): New template and function.
3122         (first_non_trivial_field): New function.
3123         (maybe_warn_class_memaccess): Call them.
3125 2018-03-21  David Malcolm  <dmalcolm@redhat.com>
3127         PR c++/84892
3128         * search.c (field_accessor_p): Use class_of_this_parm rather than
3129         type_of_this_parm, to check that "this" is a "const T *", rather
3130         than a "T *const".
3132 2018-03-21  Nathan Sidwell  <nathan@acm.org>
3134         * class.c (finish_struct_anon_r): Refactor, deprecate anything
3135         other than public non-static data members.
3136         * parser.c (cp_parser_init_declarator): Deprecate attributes after
3137         parenthesized initializer.
3139         PR c++/84836
3140         * name-lookup.c (update_binding): Correct logic for local binding
3141         update.
3143 2018-03-21  Marek Polacek  <polacek@redhat.com>
3145         PR c++/71638, ICE with NSDMI and reference.
3146         * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
3147         even when we replace an element.
3149 2018-03-20  Marek Polacek  <polacek@redhat.com>
3151         PR c++/84978, ICE with NRVO.
3152         * constexpr.c (cxx_eval_constant_expression): Handle the case when
3153         a RESULT_DECL isn't in the hash map.
3155 2018-03-20  Jason Merrill  <jason@redhat.com>
3157         PR c++/84978, ICE with NRVO.
3158         * cvt.c (cp_get_fndecl_from_callee): Add fold parameter.
3159         (cp_get_callee_fndecl_nofold): New.
3160         * cp-gimplify.c (cp_genericize_r): Use it instead.
3161         * call.c (check_self_delegation): Likewise.
3163 2018-03-20  Nathan Sidwell  <nathan@acm.org>
3165         PR c++/84962
3166         * name-lookup.c (pushdecl_class_level): Push anon-struct's
3167         member_vec, if there is one.
3169         PR c++/84970
3170         * cp-tree.h (lookup_list_keep): Declare.
3171         * tree.c (lookup_list_keep): New, broken out of ...
3172         (build_min): ... here.  Call it.
3173         * decl.c (cp_finish_decl): Call lookup_list_keep.
3175 2018-03-19  Jason Merrill  <jason@redhat.com>
3177         PR c++/84937 - ICE with class deduction and auto.
3178         * pt.c (rewrite_template_parm): Fix auto handling.
3180 2018-03-19  Marek Polacek  <polacek@redhat.com>
3182         PR c++/84925
3183         * pt.c (enclosing_instantiation_of): Check if fn is null.
3185         PR c++/84927
3186         * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
3187         as we evaluate the elements.
3188         (cxx_eval_constant_expression): Verify constructor's flags
3189         unconditionally.
3191 2018-03-19  Jason Merrill  <jason@redhat.com>
3193         PR c++/71834 - template-id with too few arguments.
3194         * pt.c (coerce_template_parms): Check fixed_parameter_pack_p.
3196 2018-03-19  Nathan Sidwell  <nathan@acm.org>
3198         PR c++/84835
3199         * lambda.c (maybe_add_lambda_conv_op): Force C++ linkage.
3200         * pt.c (build_template_decl): Propagate language linkage.
3202         PR c++/84812
3203         * name-lookup.c (set_local_extern_decl_linkage): Defend against
3204         ambiguous lookups.
3206 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
3208         PR c/84910
3209         * parser.c (cp_parser_lambda_introducer): Remove trailing space from
3210         diagnostics.
3211         * method.c (synthesize_method): Likewise.
3212         * pt.c (convert_nontype_argument): Likewise.
3214 2018-03-16  Jason Merrill  <jason@redhat.com>
3216         PR c++/84720 - ICE with rvalue ref non-type argument.
3217         * pt.c (invalid_nontype_parm_type_p): Prohibit rvalue reference.
3218         (convert_nontype_argument): Revert earlier change.
3220         PR c++/80227 - SFINAE and negative array size.
3221         * decl.c (compute_array_index_type): Use
3222         build_converted_constant_expr and valid_constant_size_p.
3224         PR c++/84906 - silent wrong code with ambiguous conversion.
3225         * call.c (build_user_type_conversion_1): Set need_temporary_p on
3226         ambiguous conversion.
3227         (convert_like_real): Check it.
3229         PR c++/83937 - wrong C++17 handling of init-list ctor argument.
3230         * call.c (build_special_member_call): Don't convert an init-list
3231         argument directly to the class type.
3233 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
3235         PR c++/79937
3236         PR c++/82410
3237         * cp-tree.h (CONSTRUCTOR_PLACEHOLDER_BOUNDARY): Define.
3238         (find_placeholder): Declare.
3239         * tree.c (struct replace_placeholders_t): Add exp member.
3240         (replace_placeholders_r): Don't walk into ctors with
3241         CONSTRUCTOR_PLACEHOLDER_BOUNDARY flag set, unless they are equal to
3242         d->exp.  Replace PLACEHOLDER_EXPR with unshare_expr (x) rather than x.
3243         (replace_placeholders): Initialize data.exp.
3244         (find_placeholders_r, find_placeholders): New functions.
3245         * typeck2.c (process_init_constructor_record,
3246         process_init_constructor_union): Set CONSTRUCTOR_PLACEHOLDER_BOUNDARY
3247         if adding NSDMI on which find_placeholder returns true.
3248         * call.c (build_over_call): Don't call replace_placeholders here.
3249         * cp-gimplify.c (cp_genericize_r): Set TARGET_EXPR_NO_ELIDE on
3250         TARGET_EXPRs with CONSTRUCTOR_PLACEHOLDER_BOUNDARY set on
3251         TARGET_EXPR_INITIAL.
3252         (cp_fold): Copy over CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit to new
3253         ctor.
3255 2018-03-16  Jason Merrill  <jason@redhat.com>
3257         PR c++/83911 - ICE with multiversioned constructor.
3258         * cp-gimplify.c (cp_genericize_r): Replace versioned function with
3259         dispatchere here.
3260         * call.c (build_over_call): Not here.
3262 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
3264         PR c++/84874
3265         * decl.c (reshape_init_class): Don't assert d->cur->index == field
3266         if d->cur->index is a FIELD_DECL, instead set field to d->cur->index.
3268 2018-03-15  Jakub Jelinek  <jakub@redhat.com>
3270         PR c++/84222
3271         * cp-tree.h (cp_warn_deprecated_use): Declare.
3272         * tree.c (cp_warn_deprecated_use): New function.
3273         * typeck2.c (build_functional_cast): Use it.
3274         * decl.c (grokparms): Likewise.
3275         (grokdeclarator): Likewise.  Temporarily push nested class scope
3276         around grokparms call for out of class member definitions.
3278 2018-03-14  Jason Merrill  <jason@redhat.com>
3280         PR c++/84820 - no error for invalid qualified-id.
3281         * parser.c (cp_parser_make_indirect_declarator): Don't wrap
3282         cp_error_declarator.
3284         PR c++/84801 - ICE with unexpanded pack in lambda.
3285         * pt.c (check_for_bare_parameter_packs): Don't return early for a
3286         lambda in non-template context.
3288         PR c++/81236 - auto variable and auto function
3289         * pt.c (tsubst_baselink): Update the type of the BASELINK after
3290         mark_used.
3292 2018-03-14  Jason Merrill  <jason@redhat.com>
3294         PR c++/83916 - ICE with template template parameters.
3295         * pt.c (convert_template_argument): Don't substitute into type of
3296         non-type parameter if we don't have enough arg levels.
3297         (unify): Likewise.
3299 2018-03-14  Marek Polacek  <polacek@redhat.com>
3301         PR c++/84596
3302         * semantics.c (finish_static_assert): Check
3303         instantiation_dependent_expression_p instead of
3304         {type,value}_dependent_expression_p.
3306 2018-03-13  Paolo Carlini  <paolo.carlini@oracle.com>
3307             Jason Merrill  <jason@redhat.com>
3309         PR c++/82336 - link error with list-init default argument.
3310         * decl.c (check_default_argument): Unshare an initializer list.
3312 2018-03-13  Jakub Jelinek  <jakub@redhat.com>
3314         PR c++/84843
3315         * decl.c (duplicate_decls): For redefinition of built-in, use error
3316         and return error_mark_node.  For redeclaration, return error_mark_node
3317         rather than olddecl if !flag_permissive.
3319 2018-03-13  Jason Merrill  <jason@redhat.com>
3321         PR c++/82565 - ICE with concepts and generic lambda.
3322         * pt.c (instantiate_decl): Clear fn_context for lambdas.
3324 2018-03-13  Jason Merrill  <jason@redhat.com>
3326         PR c++/84720 - ICE with rvalue ref non-type argument.
3327         * pt.c (convert_nontype_argument): Handle rvalue references.
3329         PR c++/84839 - ICE with decltype of parameter pack.
3330         * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
3331         instantiating dummy parms.
3333         * parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
3334         parameter even without -Wpedantic.
3336         PR c++/84798 - ICE with auto in abstract function declarator.
3337         * parser.c (cp_parser_parameter_declaration_clause): Check
3338         parser->default_arg_ok_p.
3340 2018-03-13  Jakub Jelinek  <jakub@redhat.com>
3342         PR c++/84808
3343         * constexpr.c (find_array_ctor_elt): Don't use elt reference after
3344         first potential CONSTRUCTOR_ELTS reallocation.  Convert dindex to
3345         sizetype.  Formatting fixes.
3347 2018-03-12  Jason Merrill  <jason@redhat.com>
3349         PR c++/84355 - ICE with deduction for member class template.
3350         * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into
3351         CLASS_PLACEHOLDER_TEMPLATE.
3353         PR c++/84802 - ICE capturing uninstantiated class.
3354         * lambda.c (build_capture_proxy): Call complete_type.
3356 2018-03-09  Jason Merrill  <jason@redhat.com>
3358         PR c++/84770 - ICE with typedef and parameter pack.
3359         * pt.c (verify_unstripped_args_1): Split out from
3360         verify_unstripped_args.
3362         PR c++/84785 - ICE with alias template and default targs.
3363         * pt.c (type_unification_real): Set processing_template_decl if
3364         saw_undeduced == 1.
3366         PR c++/84752 - ICE with capture of constexpr array.
3367         * call.c (standard_conversion): Set rvaluedness_matches_p on the
3368         identity conversion under ck_lvalue.
3370 2018-03-09  Jason Merrill  <jason@redhat.com>
3371             Paolo Carlini  <paolo.carlini@oracle.com>
3373         PR c++/71169
3374         PR c++/71832
3375         * pt.c (any_erroneous_template_args_p): New.
3376         * cp-tree.h (any_erroneous_template_args_p): Declare it.
3377         * parser.c (cp_parser_class_specifier_1): Use it.
3379 2018-03-09  Jason Merrill  <jason@redhat.com>
3381         PR c++/84726 - unnecessary capture of constant vars.
3382         * cp-tree.h (LAMBDA_CAPTURE_EXPLICIT_P)
3383         (LAMBDA_EXPR_CAPTURE_OPTIMIZED): New.
3384         * expr.c (mark_use): Set LAMBDA_EXPR_CAPTURE_OPTIMIZED.
3385         * lambda.c (is_constant_capture_proxy)
3386         (current_lambda_expr, var_to_maybe_prune, mark_const_cap_r)
3387         (prune_lambda_captures): New.
3388         (finish_lambda_function): Call prune_lambda_captures.
3390 2018-03-09  Jason Merrill  <jason@redhat.com>
3391             Jakub Jelinek  <jakub@redhat.com>
3393         PR c++/84076
3394         * call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
3395         build ADDR_EXPR with REFERENCE_TYPE.
3396         (build_over_call): For purposes of check_function_arguments, if
3397         argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
3398         its operand rather than the argument itself.
3400 2018-03-09  Jakub Jelinek  <jakub@redhat.com>
3402         PR c++/84724
3403         * decl.c (duplicate_decls): Don't override __* prefixed builtins
3404         except for __[^b]*_chk, instead issue permerror and for -fpermissive
3405         also a note and return olddecl.
3407 2018-03-09  Nathan Sidwell  <nathan@acm.org>
3409         PR c++/84733
3410         * name-lookup.c (do_pushdecl_with_scope): Only clear
3411         current_function_decl when pushing a non-class (i.e. namespace)
3412         scope.
3414 2018-03-08  Jason Merrill  <jason@redhat.com>
3415             Jakub Jelinek  <jakub@redhat.com>
3417         PR c++/80598
3418         * call.c (build_over_call): In templates set TREE_USED (first_fn) when
3419         not calling mark_used for the benefit of -Wunused-function warning.
3421 2018-03-06  Jason Merrill  <jason@redhat.com>
3423         * lambda.c (is_capture_proxy_with_ref): Remove.
3424         * constexpr.c, expr.c, cp-tree.h, semantics.c: Adjust.
3426 2018-03-06  Marek Polacek  <polacek@redhat.com>
3428         PR c++/84684
3429         * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
3430         arguments.
3432 2018-03-06  Alexandre Oliva <aoliva@redhat.com>
3434         PR c++/84231
3435         * tree.c (lvalue_kind): Use presence/absence of REFERENCE_TYPE
3436         only while processing template decls.
3437         * typeck.c (build_x_conditional_expr): Move wrapping of
3438         reference type around type...
3439         * call.c (build_conditional_expr_1): ... here.  Rename
3440         is_lvalue to is_glvalue.
3441         * parser.c (cp_parser_fold_expression): Catch REFERENCE_REF_P
3442         INDIRECT_REF of COND_EXPR too.
3444         PR c++/84593
3445         * init.c (build_zero_init_1): Zero-initialize references.
3447         PR c++/84492
3448         * semantics.c (finish_stmt_expr_expr): Reject unresolved
3449         overloads used as stmt expr values.
3451 2018-03-05  Jason Merrill  <jason@redhat.com>
3453         PR c++/84708 - ICE with lambda in local class NSDMI.
3454         * lambda.c (lambda_expr_this_capture): Handle local class NSDMI
3455         context.
3457 2018-03-05  Jakub Jelinek  <jakub@redhat.com>
3459         PR c++/84684
3460         * constexpr.c (constexpr_call_hasher::equal): Return false if
3461         lhs->hash != rhs->hash.  Change return 1 to return true and
3462         return 0 to return false.
3464 2018-03-05  Nathan Sidwell  <nathan@acm.org>
3466         PR c++/84702
3467         * pt.c (process_template_arg): Mark lookup_keep on a default arg.
3469 2018-03-05  Marek Polacek  <polacek@redhat.com>
3471         PR c++/84707
3472         * decl.c (duplicate_decls): Check DECL_NAME before accessing
3473         UDLIT_OPER_P.
3475 2018-03-05  Nathan Sidwell  <nathan@acm.org>
3477         PR c++/84694
3478         * friend.c (do_friend): Restore check for identifier_p inside
3479         TEMPLATE_ID_EXPR.
3481 2018-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
3483         PR c++/84618
3484         * parser.c (cp_parser_lambda_introducer): Reject any capture not
3485         involving a VAR_DECL or a PARM_DECL.
3487 2018-03-05  Pádraig Brady  <P@draigBrady.com>
3488             Jason  Merrill  <jason@redhat.com>
3489             Nathan Sidwell  <nathan@acm.org>
3491         PR c++/84497
3492         * decl2.c (get_tls_init_fn): Check TYPE_HAS_TRIVIAL_DFLT too.
3494 2018-03-03  Jason Merrill  <jason@redhat.com>
3496         PR c++/84686 - missing volatile loads.
3497         * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
3499 2018-03-03  Paolo Carlini  <paolo.carlini@oracle.com>
3501         PR c++/71464
3502         * optimize.c (maybe_thunk_body): Bail out immediately if either
3503         fns[0] or fns[1] is null.
3505 2018-03-02  Marek Polacek  <polacek@redhat.com>
3507         PR c++/84578
3508         * constexpr.c (get_array_or_vector_nelts): New.
3509         (cxx_eval_array_reference): Use it.
3510         (cxx_eval_vec_init_1): Likewise.
3511         (cxx_eval_store_expression): Likewise.
3513 2018-03-02  Jason Merrill  <jason@redhat.com>
3515         * semantics.c (force_paren_expr): Remove redundant test.
3517 2018-03-02  Marek Polacek  <polacek@redhat.com>
3519         PR c++/84663
3520         * decl.c (cp_complete_array_type): Check error_mark_node.
3522         PR c++/84664
3523         * typeck.c (cp_perform_integral_promotions): Check the result of
3524         mark_rvalue_use.
3526 2018-03-02  Jakub Jelinek  <jakub@redhat.com>
3528         PR c++/84662
3529         * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
3530         RETURN instead of return.
3531         <case POINTER_PLUS_EXPR>: Likewise.
3532         <case CONVERT_EXPR>: If op0 is error_mark_node, just return
3533         it instead of wrapping it into CONVERT_EXPR.
3535 2018-03-02  Jason Merrill  <jason@redhat.com>
3537         Fix MIPS16 ICE.
3538         * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC.
3540 2018-03-02  Marek Polacek  <polacek@redhat.com>
3542         PR c++/84590
3543         * cp-gimplify.c (cp_fully_fold): Unwrap TARGET_EXPR or a CONSTRUCTOR
3544         wrapped in VIEW_CONVERT_EXPR.
3546 2018-03-01  Martin Sebor  <msebor@redhat.com>
3548         PR c++/84294
3549         * decl.c (check_redeclaration_no_default_args): Merge attributes
3550         specified on redeclarations of the same function template.
3551         Remove dead code.
3553 2018-03-01  Marek Polacek  <polacek@redhat.com>
3554             Jason Merrill  <jason@redhat.com>
3556         PR c++/84582
3557         * semantics.c (force_paren_expr): Create a PAREN_EXPR when in
3558         a template.
3559         (maybe_undo_parenthesized_ref): Unwrap PAREN_EXPR.
3560         * typeck2.c (store_init_value): Call fold_non_dependent_expr instead
3561         of instantiate_non_dependent_expr.
3562         * tree.c (lvalue_kind): Handle PAREN_EXPR like NON_DEPENDENT_EXPR.
3564 2018-03-01  Nathan Sidwell  <nathan@acm.org>
3566         PR c++/84434
3567         * name-lookup.c (member_vec_dedup): Remove manually peeled
3568         iteration.  Ignore dependent ctor inheritance.
3570 2018-03-01  Jason Merrill  <jason@redhat.com>
3572         PR c++/71569 - decltype of template.
3573         * parser.c (cp_parser_decltype_expr): Handle missing template args.
3575 2018-03-01  Marek Polacek  <polacek@redhat.com>
3577         PR c++/84596
3578         * constexpr.c (require_rvalue_constant_expression): New function.
3579         * cp-tree.h: Declare it.
3580         * semantics.c (finish_static_assert): Use it instead of
3581         require_potential_rvalue_constant_expression.
3583 2018-03-01  Jason Merrill  <jason@redhat.com>
3584             Alexandre Oliva <aoliva@redhat.com>
3586         PR c++/71569 - ICE with redundant args on member variable template.
3587         * decl.c (start_decl): Handle partial specialization of member
3588         variable template.
3589         * pt.c (determine_specialization): Allow partial specialization
3590         of member variable template without specializing enclosing class.
3591         (process_partial_specialization): Improve error message.
3593 2018-02-28  Jason Merrill  <jason@redhat.com>
3595         PR c++/71784 - ICE with ref-qualifier and explicit specialization.
3596         * pt.c (determine_specialization): Check ref-qualifier.
3598 2018-02-28  Jakub Jelinek  <jakub@redhat.com>
3600         PR c++/84609
3601         * parser.c (cp_parser_attributes_opt): Formatting fix.
3602         (cp_parser_skip_balanced_tokens, cp_parser_skip_gnu_attributes_opt,
3603         cp_parser_skip_std_attribute_spec_seq, cp_parser_skip_attributes_opt):
3604         New functions.
3605         (cp_parser_member_declaration): Use cp_parser_skip_attributes_opt
3606         instead of tentative parse to peek over optional attribute tokens
3607         to check for CPP_COLON after them.
3609         PR c++/83871
3610         PR c++/83503
3611         * pt.c (INCLUDE_STRING): Remove define.
3612         (warn_spec_missing_attributes): Use pretty_printer instead of
3613         std::string.  Fix up inform call so that the list of attributes
3614         is in %s argument.
3616 2018-02-28  Martin Sebor  <msebor@redhat.com>
3618         PR testsuite/84617
3619         * decl.c (duplicate_decls): Fully merge attributes const, pure,
3620         and malloc.
3622 2018-02-28  Nathan Sidwell  <nathan@acm.org>
3624         PR c++/84602
3625         * name-lookup.h (search_anon_aggr): Add defaulted WANT_TYPE arg.
3626         * name-lookup.c (fields_linear_search): Look in an anon-aggr
3627         regardless of want_type.
3628         (search_anon_aggr): Just use get_class_binding_direct.
3630 2018-02-28  Jakub Jelinek  <jakub@redhat.com>
3632         * decl.c (cp_finish_decomp): Don't adjust eltscnt when calling
3633         inform_n.
3635 2018-02-27  Martin Sebor  <msebor@redhat.com>
3637         * pt.c: Avoid including <string> directly.
3639 2018-02-27  Martin Sebor  <msebor@redhat.com>
3641         PR c++/83871
3642         PR c++/83503
3643         * cp-tree.h (warn_spec_missing_attributes): New function.
3644         ((check_explicit_specialization): Add an argument.  Call the above
3645         function.
3646         * decl.c (duplicate_decls): Avoid applying primary function template's
3647         attributes to its explicit specializations.
3648         cp/pt.c (warn_spec_missing_attributes): Define.
3650 2018-02-27  HÃ¥kon Sandsmark  <hsandsmark@gmail.com>
3652         PR c++/71546 - lambda init-capture with qualified-id.
3653         * parser.c (cp_parser_lambda_introducer): Clear scope after
3654         each lambda capture.
3656 2018-02-27  Nathan Sidwell  <nathan@acm.org>
3658         PR c++/84426
3659         * name-lookup.h (get_member_slot): Rename ...
3660         (find_member_slot): ... here.
3661         (add_member_slot): New.
3662         * name-lookup.c (member_vec_linear_search): No need to check for
3663         NULL slot.
3664         (get_member_slot): Rename ...
3665         (find_member_slot): ... here.  Don't add slot for incomplete class.
3666         (add_member_slot): New.
3667         * class.c (add_method): Adjust get_member_slot rename.  Bail out
3668         if push_class_level_binding fails.  Create slot and grok
3669         properties once we're committed to insertion.
3671 2018-02-27  Jason Merrill  <jason@redhat.com>
3673         PR c++/84489 - dependent default template argument
3674         * pt.c (type_unification_real): Handle early substitution failure.
3676 2018-02-26  Jason Merrill  <jason@redhat.com>
3678         PR c++/84560 - ICE capturing multi-dimensional VLA.
3679         * tree.c (array_of_runtime_bound_p): False if the element is
3680         variably-modified.
3682         PR c++/84441 - ICE with base initialized from ?:
3683         * call.c (unsafe_copy_elision_p): Handle COND_EXPR.
3685         PR c++/84520 - ICE with generic lambda in NSDMI.
3686         * lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
3687         'this' in a generic lambda instantiation.
3689         PR c++/84559 - ICE with constexpr VLA.
3690         * constexpr.c (ensure_literal_type_for_constexpr_object): Check
3691         for constexpr variable with VLA type.
3693 2018-02-26  Jakub Jelinek  <jakub@redhat.com>
3695         PR c++/84558
3696         * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like
3697         a valid constant initializer.  Formatting fixes.
3699 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
3701         PR c++/84540
3702         * pt.c (tsubst_attributes): Handle correctly tsubst_attribute
3703         returning NULL_TREE.
3704         (apply_late_template_attributes): Likewise.
3706 2018-02-26  Jakub Jelinek  <jakub@redhat.com>
3708         PR c++/84557
3709         * parser.c (cp_parser_omp_var_list_no_open): Only call
3710         cp_parser_lookup_name_simple on names satisfying identifier_p.
3711         (cp_parser_oacc_routine): Likewise.
3713 2018-02-26  Jason Merrill  <jason@redhat.com>
3715         PR c++/84551 - ICE with concepts and -g.
3716         * parser.c (add_debug_begin_stmt): Do nothing in a concept.
3718 2018-02-26  Marek Polacek  <polacek@redhat.com>
3720         PR c++/84325
3721         * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
3722         non-types.
3724 2018-02-26  Jason Merrill  <jason@redhat.com>
3726         PR c++/84447 - ICE with deleted inherited ctor with default arg.
3727         * call.c (build_over_call): Handle deleted functions in one place.
3729 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
3731         PR c++/84533
3732         * decl.c (redeclaration_error_message): Don't try to use
3733         DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.
3735 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
3737         * lambda.c (build_capture_proxy): Define static.
3738         * cp-tree.h (build_capture_proxy): Remove.
3740 2018-02-26  Marek Polacek  <polacek@redhat.com>
3742         PR c++/84537
3743         * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
3744         if name is error node.
3746 2018-02-25  Jason Merrill  <jason@redhat.com>
3748         PR c++/84015 - ICE with class deduction and auto template parm.
3749         * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
3751 2018-02-24  Marek Polacek  <polacek@redhat.com>
3753         PR c++/83692
3754         * constexpr.c (maybe_constant_init_1): New function.
3755         (maybe_constant_init): Make it a wrapper around maybe_constant_init_1.
3756         (cxx_constant_init): New function.
3757         * cp-tree.h (cxx_constant_init): Declare.
3758         * typeck2.c (store_init_value): Call cxx_constant_init instead of
3759         cxx_constant_value.  Move the maybe_constant_init call under an 'else'.
3761 2018-02-22  Jason Merrill  <jason@redhat.com>
3763         PR c++/70468 - ICE with constructor delegation via typedef.
3764         * pt.c (tsubst_initializer_list): Check for other mem-initializers
3765         with constructor delegation.
3767 2018-02-22  Jason Merrill  <jason@redhat.com>
3769         PR c++/84424 - ICE with constexpr and __builtin_shuffle.
3770         * constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
3771         VECTOR_TYPE.
3773 2018-02-22  Marek Polacek  <polacek@redhat.com>
3775         PR c++/84493
3776         * parser.c (cp_parser_braced_list): Use require_open instead of
3777         consume_open.
3779 2018-02-21  Jason Merrill  <jason@redhat.com>
3781         PR c++/84454 - ICE with pack expansion in signature.
3782         * error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.
3784 2018-02-20  Siddhesh Poyarekar  <siddhesh@sourceware.org>
3786         * cp-objcp-common.c (cxx_block_may_fallthru): Add case for
3787         IF_STMT.
3789 2018-02-20  Paolo Carlini  <paolo.carlini@oracle.com>
3791         PR c++/84446
3792         * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope
3793         on error_mark_node.
3795 2018-02-20  Jakub Jelinek  <jakub@redhat.com>
3797         PR c++/84445
3798         * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test
3799         TREE_HAS_CONSTRUCTOR if instance is not an internal function call.
3801         PR c++/84449
3802         * tree.c (bot_manip): If build_cplus_new or break_out_target_exprs
3803         returns error_mark_node, return it immediately.
3804         (break_out_target_exprs): If cp_walk_tree with bot_manip returns
3805         error_mark_node, return error_mark_node.
3807         PR c++/84455
3808         * pt.c (tsubst_lambda_expr): If not nested, increment temporarily
3809         function_depth to avoid GC during finish_lambda_function.
3811 2018-02-19  Jason Merrill  <jason@redhat.com>
3813         PR c++/84429 - ICE capturing VLA.
3814         * lambda.c (build_capture_proxy): Handle reference refs.
3816 2018-02-19  Jakub Jelinek  <jakub@redhat.com>
3818         PR c++/84448
3819         * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
3820         either operand is error_mark_node, set current.lhs to that instead of
3821         creating a binary op with error_mark_node operands.
3823         PR c++/84430
3824         * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
3826 2018-02-19  Paolo Carlini  <paolo.carlini@oracle.com>
3828         PR c++/84348
3829         * decl.c (grokdeclarator): Early return error_mark_node upon
3830         ill-formed friend declaration.
3832 2018-02-16  Marek Polacek  <polacek@redhat.com>
3833             Jakub Jelinek  <jakub@redhat.com>
3835         PR c++/84192
3836         * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
3837         set *jump_target to anything if jump_target is NULL.
3839 2018-02-16  Jason Merrill  <jason@redhat.com>
3841         PR c++/84151 - unnecessary volatile load with static member.
3842         * call.c (build_new_method_call_1): Avoid loading from a volatile
3843         lvalue used as the object argument for a static member function.
3845         PR c++/81853 - using-directive and constexpr.
3846         * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT.
3848         PR c++/84420 - ICE with structured binding in lambda.
3849         * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P.
3851         PR c++/83835 - C++17 error with constructor ctors.
3852         * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P.
3854         PR c++/82664 - ICE with reference to function template parm.
3855         * pt.c (convert_nontype_argument_function): Avoid obfuscationg
3856         NOP_EXPRs.
3858         PR c++/82764 - C++17 ICE with empty base
3859         * class.c (build_base_field_1): Set DECL_SIZE to zero for empty base.
3861 2018-02-16  Jason Merrill  <jason@redhat.com>
3863         PR c++/84421 - type-dependent if constexpr
3864         * semantics.c (finish_if_stmt_cond): Check type_dependent_expression_p.
3866 2018-02-16  Nathan Sidwell  <nathan@acm.org>
3868         Deprecate -ffriend-injection.
3869         * decl.c (cxx_init_decl_processing): Emit warning on option.
3870         * name-lookup.c (do_pushdecl): Emit warning if we push a visible
3871         friend.
3873 2018-02-16  Paolo Carlini  <paolo.carlini@oracle.com>
3875         PR c++/82468
3876         * decl.c (check_special_function_return_type): Reject template
3877         template parameter in deduction guide.
3879 2018-02-16  Nathan Sidwell  <nathan@acm.org>
3881         PR c++/84375
3882         * name-lookup.c (do_pushdecl): Bail out on bad local friend injection.
3884 2018-02-15  Jason Merrill  <jason@redhat.com>
3886         PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
3887         * call.c (convert_like_real): Don't use the copy-list-initialization
3888         shortcut for ck_base.
3890         PR c++/84045 - ICE with typedef and noexcept.
3891         * except.c (build_noexcept_spec): Use strip_typedefs_expr.
3893         PR c++/84376 - ICE with omitted template arguments.
3894         * pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
3896         PR c++/84368 - wrong error with local variable in variadic lambda.
3897         * pt.c (tsubst_pack_expansion): Fix handling of non-packs in
3898         local_specializations.
3900 2018-02-15  Paolo Carlini  <paolo.carlini@oracle.com>
3902         PR c++/84330
3903         * constraint.cc (tsubst_constraint_info): Handle an error_mark_node
3904         as first argument.
3906 2018-02-14  Paolo Carlini  <paolo.carlini@oracle.com>
3908         PR c++/84350
3909         * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null
3910         init, early return.
3912 2018-02-14  Nathan Sidwell  <nathan@acm.org>
3914         * decl2.c (mark_vtable_entries): Set input_location to decl's.
3915         (c_parse_final_cleanups): Restore input_location after emitting
3916         vtables.
3918 2018-02-14  Paolo Carlini  <paolo.carlini@oracle.com>
3920         * cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove.
3921         (do_auto_deduction (tree, tree, tree, tsubst_flags_t,
3922         auto_deduction_context, tree, int): Add defaults.
3923         * pt.c (do_auto_deduction (tree, tree, tree)): Remove definition.
3924         (tsubst_omp_for_iterator): Adjust do_auto_deduction call, forward
3925         tsubst_flags_t argument.
3926         * init.c (build_new): Likewise.
3928 2018-02-13  Jakub Jelinek  <jakub@redhat.com>
3930         PR c++/84364
3931         * typeck.c (check_return_expr): Don't emit -Weffc++ warning
3932         about return other than *this in assignment operators if
3933         retval is type dependent expression.
3935 2018-02-13  Paolo Carlini  <paolo.carlini@oracle.com>
3937         PR c++/84333
3938         * call.c (build_conditional_expr_1): Use cp_save_expr instead of
3939         save_expr for the G++ extension.
3941 2018-02-13  Jason Merrill  <jason@redhat.com>
3943         PR c++/84080 - ICE with return type deduction and specialization.
3944         * pt.c (determine_specialization): Check uses_template_parms.
3946         Fix more variadic capture issues.
3947         * pt.c (find_parameter_packs_r): Also look at explicit captures.
3948         (check_for_bare_parameter_packs): Check current_class_type for
3949         lambda context.
3950         (extract_locals_r): Handle seeing a full instantiation of a pack.
3951         (tsubst_pack_expansion): Likewise.  Force lambda capture.
3952         * parser.c (cp_parser_lambda_introducer): Don't
3953         check_for_bare_parameter_packs.
3955         PR c++/84338 - wrong variadic sizeof.
3956         * pt.c (argument_pack_select_arg): Like the macro, but look through
3957         a pack expansion.
3958         (tsubst, tsubst_copy, dependent_template_arg_p): Use it.
3959         (extract_fnparm_pack): Do make_pack_expansion.
3960         (extract_locals_r): Do strip a pack expansion.
3961         * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove.
3963 2018-02-12  Jakub Jelinek  <jakub@redhat.com>
3965         PR c++/84341
3966         * parser.c (cp_parser_binary_expression): Use build_min instead of
3967         build2_loc to build the no_toplevel_fold_p toplevel binary expression.
3969 2018-02-12  Nathan Sidwell  <nathan@acm.org>
3971         PR c++/84263
3972         * parser.c (cp_parser_decltype): Push and pop
3973         deferring_access_checks.  Reorganize to avoid goto.
3975 2018-02-12  Richard Biener  <rguenther@suse.de>
3977         PR c++/84281
3978         * constexpr.c (cxx_eval_vec_init_1): Use a RANGE_EXPR to compact
3979         uniform constructors and delay allocating them fully.
3981 2018-02-09  Jason Merrill  <jason@redhat.com>
3983         PR c++/84036 - ICE with variadic capture.
3984         Handle variadic capture proxies more like non-variadic.
3985         * lambda.c (build_capture_proxy): Remove workaround.
3986         * pt.c (find_parameter_packs_r): The proxy is a pack.
3987         (instantiate_class_template_1): Remove dead lambda code.
3988         (extract_fnparm_pack): Don't make_pack_expansion.
3989         (extract_locals_r): Don't strip a pack expansion.
3990         (tsubst_pack_expansion): Handle proxy packs.  Use
3991         PACK_EXPANSION_EXTRA_ARGS less.
3992         (tsubst_decl) [FIELD_DECL]: Don't register_specialization.
3993         (tsubst_copy) [FIELD_DECL]: Don't retrieve*_specialization.
3994         [VAR_DECL]: Handle ARGUMENT_PACK_SELECT.
3995         (tsubst_expr) [DECL_EXPR]: Handle proxy packs.
3996         (tsubst_copy_and_build) [VAR_DECL]: Handle proxy packs normally.
3998 2018-02-10  Jakub Jelinek  <jakub@redhat.com>
4000         PR sanitizer/83987
4001         * tree.c (cp_free_lang_data): Revert 2018-01-23 change.
4003 2018-02-09  Jason Merrill  <jason@redhat.com>
4005         PR c++/81917 - ICE with void_t and partial specialization.
4006         * pt.c (instantiate_class_template_1): Set TYPE_BEING_DEFINED before
4007         calling most_specialized_partial_spec.
4009 2018-02-09  Nathan Sidwell  <nathan@acm.org>
4011         PR c/84293
4012         * typeck.c (cp_build_indirect_ref_1, build_reinterpret_cast_1):
4013         Pass expr location to strict_aliasing_warning.
4015 2018-02-09  Jason Merrill  <jason@redhat.com>
4017         PR c++/84296 - ICE with qualified-id in template.
4018         PR c++/83714
4019         * pt.c (unknown_base_ref_p): New.
4020         (instantiation_dependent_scope_ref_p): Use it instead of
4021         any_dependent_bases_p.
4023 2018-02-09  Marek Polacek  <polacek@redhat.com>
4024             Jakub Jelinek  <jakub@redhat.com>
4026         PR c++/83659
4027         * constexpr.c (cxx_fold_indirect_ref): Sync some changes from
4028         fold_indirect_ref_1, including poly_*int64.  Verify first that
4029         tree_fits_poly_int64_p (op01).  Formatting fixes.
4031 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
4033         * constexpr.c (cxx_eval_component_reference): Use INDIRECT_REF_P.
4034         * lambda.c (build_capture_proxy): Likewise.
4035         * search.c (field_access_p): Likewise.
4036         * semantics.c (omp_clause_decl, omp_privatize_field,
4037         finish_omp_clauses): Likewise.
4039 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
4041         PR c++/83806
4042         * typeck.c (decay_conversion): Use mark_rvalue_use for the special
4043         case of nullptr too.
4045 2018-02-08  Nathan Sidwell  <nathan@acm.org>
4047         * class.c (finish_struct): Fix std:initializer_list diagnostic
4048         formatting.
4050 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
4052         PR c++/83204
4053         * pt.c (tsubst_copy_and_build): Use force_paren_expr for INDIRECT_REF.
4055 2018-02-07  Jakub Jelinek  <jakub@redhat.com>
4057         PR c++/84082
4058         * parser.c (cp_parser_dot_deref_incomplete): New function.
4059         (cp_parser_postfix_dot_deref_expression): Use it.
4061 2018-02-07  David Malcolm  <dmalcolm@redhat.com>
4063         PR c++/81610
4064         PR c++/80567
4065         * name-lookup.c (suggest_rid_p): New function.
4066         (lookup_name_fuzzy): Replace enum-rid-filtering logic with call to
4067         suggest_rid_p.
4069 2018-02-07  Jason Merrill  <jason@redhat.com>
4071         PR c++/84182 - ICE with captured lambda
4072         PR c++/84181
4073         * pt.c (extract_locals_r, extract_local_specs): New.
4074         (tsubst_pack_expansion): Use them.
4076 2018-02-07  Martin Liska  <mliska@suse.cz>
4078         PR c++/84059.
4079         * class.c (add_method): Append argument value.
4080         * cp-tree.h (maybe_version_functions): Add new argument.
4081         * decl.c (decls_match): Call it if a declaration does not
4082         have DECL_FUNCTION_VERSIONED.
4083         (maybe_version_functions): record argument is added.
4085 2018-02-05  Marek Polacek  <polacek@redhat.com>
4087         * class.c: Remove unused global variables.
4088         (build_primary_vtable): Don't gather statistics.
4089         (print_class_statistics): Remove.
4090         * cp-tree.h (print_class_statistics): Remove.
4091         * tree.c (cxx_print_statistics): Don't call print_class_statistics.
4093 2018-02-02  Paolo Carlini  <paolo.carlini@oracle.com>
4095         * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD.
4096         * constexpr.c (cx_check_missing_mem_inits): Likewise.
4097         * decl.c (next_initializable_field, find_decomp_class_base,
4098         cp_finish_decomp): Likewise.
4099         * typeck2.c (process_init_constructor_record): Likewise.
4101 2018-02-02  Jason Merrill  <jason@redhat.com>
4103         PR c++/84181 - ICE with lambda parm in template argument.
4104         * tree.c (strip_typedefs_expr): Use cp_tree_operand_length.
4106 2018-02-01  Jason Merrill  <jason@redhat.com>
4108         PR c++/84160 - ICE with nested variadic capture.
4109         * lambda.c (is_capture_proxy_with_ref): New.
4110         (insert_capture_proxy): Don't set DECL_CAPTURED_VARIABLE from a
4111         COMPONENT_REF.
4112         * expr.c (mark_use): Use is_capture_proxy_with_ref.
4113         * constexpr.c (potential_constant_expression_1): Likewise.
4114         * semantics.c (process_outer_var_ref): Likewise.
4116 2018-02-01  Marek Polacek  <polacek@redhat.com>
4118         PR c++/84125
4119         * typeck.c (build_address): Relax the assert when
4120         processing_template_decl.
4122 2018-02-01  Jason Merrill  <jason@redhat.com>
4124         PR c++/84126 - ICE with variadic generic lambda
4125         PR c++/84036
4126         PR c++/82249
4127         * pt.c (tsubst_pack_expansion): Handle function parameter_packs in
4128         PACK_EXPANSION_EXTRA_ARGS.
4130 2018-02-01  Paolo Carlini  <paolo.carlini@oracle.com>
4132         PR c++/83796
4133         * call.c (convert_like_real): If w're initializing from {} explicitly
4134         call abstract_virtuals_error_sfinae.
4136 2018-01-31  Jason Merrill  <jason@redhat.com>
4137             Jakub Jelinek  <jakub@redhat.com>
4139         PR c++/83993
4140         * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
4141         around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
4142         on ADDR_EXPR.
4144 2018-01-31  Jakub Jelinek  <jakub@redhat.com>
4146         PR c++/83993
4147         * constexpr.c (diag_array_subscript): Emit different diagnostics
4148         if TYPE_DOMAIN (arraytype) is NULL.
4149         (cxx_eval_array_reference, cxx_eval_store_expression): For arrays
4150         with NULL TYPE_DOMAIN use size_zero_node as nelts.
4152 2018-01-31  Paolo Carlini  <paolo.carlini@oracle.com>
4154         PR c++/84092
4155         * semantics.c (finish_qualified_id_expr): When handling an
4156         UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
4158 2018-01-31  Marek Polacek  <polacek@redhat.com>
4160         PR c++/84138
4161         * cp-gimplify.c (cp_fold): Check if X is an error node before
4162         calling useless_type_conversion_p.
4164 2018-01-30  Jason Merrill  <jason@redhat.com>
4166         PR c++/84091 - ICE with local class in lambda in template.
4167         * decl2.c (determine_visibility): Look for outer containing template
4168         instantiation.
4170         PR c++/84098 - ICE with lambda in template NSDMI.
4171         * pt.c (instantiate_class_template_1): Ignore more lambdas.
4173 2018-01-29  Jason Merrill  <jason@redhat.com>
4175         PR c++/68810 - wrong location for reinterpret_cast error.
4176         * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
4177         !dofold.
4179 2018-01-29  Marek Polacek  <polacek@redhat.com>
4181         PR c++/83996
4182         * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
4183         => fooarray[1] in offset_int.
4185 2018-01-29  Jason Merrill  <jason@redhat.com>
4187         PR c++/83942 - wrong unused warning with static_cast.
4188         * cvt.c (ocp_convert): Call mark_rvalue_use.
4190 2018-01-26  Jason Merrill  <jason@redhat.com>
4192         PR c++/83956 - wrong dtor error with anonymous union
4193         * method.c (walk_field_subobs): Variant members only affect
4194         deletedness.
4195         (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
4197         PR c++/84036 - ICE with variadic capture.
4198         PR c++/82249
4199         * pt.c (tsubst_pack_expansion): When optimizing a simple
4200         substitution, pull a single pack expansion out of its pack.
4202         PR c++/82514 - ICE with local class in generic lambda.
4203         * pt.c (regenerated_lambda_fn_p): Remove.
4204         (enclosing_instantiation_of): Don't use it.
4205         (tsubst_function_decl): Call enclosing_instantiation_of.
4207         * pt.c (lookup_template_class_1): Add sanity check.
4208         * name-lookup.c (do_pushtag): Don't add closures to local_classes.
4210 2018-01-25  Jakub Jelinek  <jakub@redhat.com>
4212         PR c++/84031
4213         * decl.c (find_decomp_class_base): Ignore unnamed bitfields.  Ignore
4214         recursive calls that return ret.
4215         (cp_finish_decomp): Ignore unnamed bitfields.
4217 2018-01-23  Jason Merrill  <jason@redhat.com>
4219         PR c++/82249 - wrong mismatched pack length error.
4220         * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
4221         unsubstituted function parameter pack.
4223 2018-01-23  Paolo Carlini  <paolo.carlini@oracle.com>
4225         PR c++/83921
4226         * decl.c (check_for_uninitialized_const_var): Not static; add
4227         bool and tsubst_flags_t parameters; adjust to be used both in
4228         constexpr context and not.
4229         * constexpr.c (potential_constant_expression_1): Use the above.
4230         * cp-tree.h (check_for_uninitialized_const_var): Declare.
4232 2018-01-23  Jason Merrill  <jason@redhat.com>
4234         PR c++/83947 - ICE with auto declarations.
4235         * pt.c (do_auto_deduction): Don't deduce from an auto decl.
4236         * decl.c (undeduced_auto_decl): Limit to vars and fns.
4238 2018-01-23  David Malcolm  <dmalcolm@redhat.com>
4240         PR c++/83974
4241         * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
4242         for pointer to member function types.
4244 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
4246         PR sanitizer/83987
4247         * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
4248         DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
4250 2018-01-23  Nathan Sidwell  <nathan@acm.org>
4252         PR c++/83988
4253         * pt.c (tsubst_baselink): Remove optype assert.
4254         * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
4256 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
4258         PR c++/83958
4259         * decl.c (cp_finish_decomp): Diagnose if reference structure binding
4260         refers to incomplete type.
4262 2018-01-23  Nathan Sidwell  <nathan@acm.org>
4264         Deprecate ARM-era for scope handling
4265         * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
4266         (cxx_init_decl_processing): Deprecate flag_new_for_scope being
4267         cleared.
4268         * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
4269         cleanup handling.
4270         * semantics.c (begin_for_scope): Flag_new_for_scope is
4271         boolean-like.
4272         (finish_for_stmt, begin_range_for_stmt): Likewise.
4274 2018-01-22  Jason Merrill  <jason@redhat.com>
4276         PR c++/83720
4277         * decl2.c (determine_visibility): Fix template_decl handling
4278         instead of blocking it.
4280         PR c++/83720 - ICE with lambda and LTO.
4281         * decl2.c (determine_visibility): Clear template_decl for
4282         function-scope decls.  Propagate anonymous linkage from containing
4283         function.
4285 2018-01-22  Marek Polacek  <polacek@redhat.com>
4287         PR c++/81933
4288         * typeck2.c (split_nonconstant_init_1): Return false if we didn't
4289         split out anything.
4291 2018-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>
4293         PR c++/83895
4294         * decl.c (grokdeclarator): Don't diagnose extra parens
4295         on typedefs.
4297 2018-01-19  Jakub Jelinek  <jakub@redhat.com>
4299         PR c++/81167
4300         * call.c (joust): Use TREE_TYPE (source) if source is
4301         a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
4303         PR c++/83919
4304         * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
4305         for direct enum init.
4306         * decl.c (reshape_init): Likewise.
4308 2018-01-19  Marek Polacek  <polacek@redhat.com>
4310         * constexpr.c (fold_simple): Simplify.
4312 2018-01-18  Jason Merrill  <jason@redhat.com>
4314         PR c++/83714
4315         * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
4316         * pt.c (instantiation_dependent_scope_ref_p): True if
4317         any_dependent_bases_p.
4319 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
4321         * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
4322         vs DECL_NONTRIVIALLY_INITIALIZED_P).
4324 2018-01-18  Jason Merrill  <jason@redhat.com>
4326         PR c++/82461 - constexpr list-initialized member
4327         * constexpr.c (potential_constant_expression_1): Check
4328         TARGET_EXPR_DIRECT_INIT_P.
4330 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
4332         PR c++/81013
4333         * decl.c (xref_basetypes): Early return upon error about derived
4334         union.
4336 2018-01-18  Nathan Sidwell  <nathan@acm.org>
4338         PR c++/83160
4339         * cp-tree.h (mark_use): Declare.
4340         * expr.c (mark_use): Make extern.
4341         * call.c (direct_reference_binding): Set inner conv's
4342         rvaluedness_matches_p, if it is an identity.
4343         (convert_like_real): Mark lvalue or rvalue use for identity as
4344         rvaledness_matches_p demands.
4346 2018-01-18  Jakub Jelinek  <jakub@redhat.com>
4348         PR c++/83824
4349         * parser.c (attr_chainon): New function.
4350         (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
4351         cp_parser_namespace_definition, cp_parser_init_declarator,
4352         cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
4353         cp_parser_gnu_attributes_opt): Use it.
4354         (cp_parser_member_declaration, cp_parser_objc_class_ivars,
4355         cp_parser_objc_struct_declaration): Likewise.  Don't reset
4356         prefix_attributes if attributes is error_mark_node.
4358 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
4360         PR c++/78344
4361         * decl.c (grokdeclarator): Do not append the error_mark_node
4362         due to an erroneous optional attribute-specifier-seq.
4364 2018-01-17  Jakub Jelinek  <jakub@redhat.com>
4366         PR c++/83897
4367         * cp-gimplify.c (cp_maybe_instrument_return): Handle
4368         CLEANUP_POINT_EXPR.
4370 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
4372         PR c++/81054
4373         * constexpr.c (ensure_literal_type_for_constexpr_object): Return
4374         error_mark_node when we give an error.
4375         * decl.c (cp_finish_decl): Use the latter.
4377 2018-01-17  Nathan Sidwell  <nathan@acm.org>
4379         PR c++/83287
4380         * init.c (build_raw_new_expr): Scan list for lookups to keep.
4382 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
4384         PR c++/83814
4385         * expr.c (fold_for_warn): Move from c-common.c, reducing to just
4386         the C++ part.  If processing a template, call
4387         fold_non_dependent_expr rather than fully folding.
4389 2018-01-17  Jason Merrill  <jason@redhat.com>
4391         PR c++/81067 - redundant NULL warning.
4392         * call.c (convert_like_real): Restore null_node handling.
4394 2018-01-17  Jason Merrill  <jason@redhat.com>
4396         PR c++/81843 - ICE with variadic member template.
4397         PR c++/72801
4398         * pt.c (unify_pack_expansion): Don't try to deduce enclosing
4399         template args.
4401 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
4403         PR c++/83799
4404         * pt.c (type_dependent_expression_p): Strip any location wrapper
4405         before testing tree codes.
4406         (selftest::test_type_dependent_expression_p): New function.
4407         (selftest::cp_pt_c_tests): Call it.
4409 2018-01-17  Nathan Sidwell  <nathan@acm.org>
4411         PR c++/83739
4412         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
4413         this not a final instantiation.
4415 2018-01-16  Jason Merrill  <jason@redhat.com>
4417         PR c++/83714 - ICE checking return in template.
4418         * typeck.c (check_return_expr): Call build_non_dependent_expr.
4420 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
4422         PR c++/83817
4423         * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
4424         is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
4425         instead of CALL_FROM_THUNK_P.
4427         PR c++/83825
4428         * name-lookup.c (member_vec_dedup): Return early if len is 0.
4429         (resort_type_member_vec, set_class_bindings,
4430         insert_late_enum_def_bindings): Use vec qsort method instead of
4431         calling qsort directly.
4433 2018-01-15  Martin Sebor  <msebor@redhat.com>
4435         PR c++/83588
4436         * class.c (find_flexarrays): Make a record of multiple flexible array
4437         members.
4439 2018-01-12  Jason Merrill  <jason@redhat.com>
4441         PR c++/83186 - ICE with static_cast of list-initialized temporary.
4442         * typeck.c (build_static_cast): Use build_non_dependent_expr.
4444 2018-01-12  Nathan Sidwell  <nathan@acm.org>
4446         * cp-tree.h (mark_rvalue_use): Add parm name.
4447         * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
4448         mark_rvalue_use.
4449         * call.c (convert_like_real): Fix formatting.
4451 2018-01-11  Jason Merrill  <jason@redhat.com>
4453         PR c++/82728 - wrong -Wunused-but-set-variable
4454         PR c++/82799
4455         PR c++/83690
4456         * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
4457         * decl.c (case_conversion): Likewise.
4458         * semantics.c (finish_static_assert): Call
4459         perform_implicit_conversion_flags.
4461 2018-01-11  Nathan Sidwell  <nathan@acm.org>
4463         * method.c (enum mangling_flags): Delete long-dead enum.
4465 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
4467         * parser.c (cp_parser_std_attribute_spec): When
4468         token_pair::require_open / require_close return false simply
4469         return error_mark_node, avoid duplicate cp_parser_error about
4470         expected '(' / ')', respectively.
4472 2018-01-10  David Malcolm  <dmalcolm@redhat.com>
4474         PR c++/43486
4475         * call.c (null_ptr_cst_p): Strip location wrappers when
4476         converting from '0' to a pointer type in C++11 onwards.
4477         (conversion_null_warnings): Replace comparison with null_node with
4478         call to null_node_p.
4479         (build_over_call): Likewise.
4480         * cp-gimplify.c (cp_fold): Remove the early bailout when
4481         processing_template_decl.
4482         * cp-lang.c (selftest::run_cp_tests): Call
4483         selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
4484         * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
4485         (selftest::run_cp_tests): Move decl to bottom of file.
4486         (null_node_p): New inline function.
4487         (selftest::cp_pt_c_tests): New decl.
4488         (selftest::cp_tree_c_tests): New decl.
4489         * cvt.c (build_expr_type_conversion): Replace comparison with
4490         null_node with call to null_node_p.
4491         * error.c (args_to_string): Likewise.
4492         * except.c (build_throw): Likewise.
4493         * mangle.c (write_expression): Skip location wrapper nodes.
4494         * parser.c (literal_integer_zerop): New function.
4495         (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
4496         the result for RID_TYPEID. Pass true for new "wrap_locations_p"
4497         param of cp_parser_parenthesized_expression_list.  When calling
4498         warn_for_memset, replace integer_zerop calls with
4499         literal_integer_zerop, eliminating the double logical negation
4500         cast to bool.  Eliminate the special-casing for CONST_DECL in
4501         favor of the fold_for_warn within warn_for_memset.
4502         (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
4503         param, defaulting to false.  Convert "expr" to a cp_expr, and call
4504         maybe_add_location_wrapper on it when wrap_locations_p is true.
4505         (cp_parser_unary_expression): Call maybe_add_location_wrapper on
4506         the result for RID_ALIGNOF and RID_SIZEOF.
4507         (cp_parser_builtin_offsetof): Likewise.
4508         * pt.c: Include "selftest.h".
4509         (tsubst_copy): Handle location wrappers.
4510         (tsubst_copy_and_build): Likewise.
4511         (build_non_dependent_expr): Likewise.
4512         (selftest::test_build_non_dependent_expr): New function.
4513         (selftest::cp_pt_c_tests): New function.
4514         * tree.c: Include "selftest.h".
4515         (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
4516         (selftest::test_lvalue_kind): New function.
4517         (selftest::cp_tree_c_tests): New function.
4518         * typeck.c (string_conv_p): Strip any location wrapper from "exp".
4519         (cp_build_binary_op): Replace comparison with null_node with call
4520         to null_node_p.
4521         (build_address): Use location of operand when building address
4522         expression.
4524 2018-01-10  Marek Polacek  <polacek@redhat.com>
4526         PR c++/82541
4527         * call.c (build_conditional_expr_1): Check complain before warning.
4528         * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
4529         -Wduplicated-branches.
4531 2018-01-10  Jakub Jelinek  <jakub@redhat.com>
4533         PR c++/81327
4534         * call.c (maybe_warn_class_memaccess): Add forward declaration.
4535         Change last argument from tree * to const vec<tree, va_gc> *, adjust
4536         args uses and check number of operands too.  Don't strip away any
4537         nops.  Use maybe_constant_value when looking for INTEGER_CST args.
4538         Deal with src argument not having pointer type.  Check
4539         tree_fits_uhwi_p before calling tree_to_uhwi.  Remove useless
4540         test.
4541         (build_over_call): Call maybe_warn_class_memaccess here on the
4542         original arguments.
4543         (build_cxx_call): Rather than here on converted arguments.
4545 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
4547         PR c++/81055
4548         * init.c (build_vec_init): Avoid building an INIT_EXPR with
4549         error_mark_node as second argument.
4551 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
4553         PR c++/83734
4554         * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
4555         in STATEMENT_LIST.  Remove unneeded assert.
4557 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4558             Alan Hayward  <alan.hayward@arm.com>
4559             David Sherwood  <david.sherwood@arm.com>
4561         * constexpr.c (cxx_eval_array_reference): Handle polynomial
4562         VECTOR_CST_NELTS.
4563         (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
4564         * call.c (build_conditional_expr_1): Likewise.
4565         * decl.c (cp_finish_decomp): Likewise.
4566         * mangle.c (write_type): Likewise.
4567         * typeck.c (structural_comptypes): Likewise.
4568         (cp_build_binary_op): Likewise.
4569         * typeck2.c (process_init_constructor_array): Likewise.
4571 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
4573         PR c++/83555
4574         * typeck.c (build_static_cast_1): For static casts to reference types,
4575         call build_base_path with flag_delete_null_pointer_checks as nonnull
4576         instead of always false.  When -fsanitize=null, call
4577         ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
4578         * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
4579         call if the first argument is INTEGER_CST with REFERENCE_TYPE.
4581 2018-01-03  Nathan Sidwell  <nathan@acm.org>
4583         PR c++/83667
4584         * method.c (make_alias_for): Copy DECL_CONTEXT.
4586 2018-01-03  Marek Polacek  <polacek@redhat.com>
4588         PR c++/83592
4589         * decl.c (grokdeclarator): Don't warn about MVP in typename context.
4591 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
4593         PR preprocessor/83602
4594         * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
4595         for builtin macros.
4597         PR c++/83634
4598         * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
4599         error_mark_node, return error_mark_node.
4601         Update copyright years.
4603 2018-01-02  Jakub Jelinek  <jakub@redhat.com>
4605         PR c++/83556
4606         * tree.c (replace_placeholders_r): Pass NULL as last argument to
4607         cp_walk_tree instead of d->pset.  If non-TREE_CONSTANT and
4608         non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
4609         to false and return.
4610         (replace_placeholders): Pass NULL instead of &pset as last argument
4611         to cp_walk_tree.
4613 2018-01-02  Nathan Sidwell  <nathan@acm.org>
4615         * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
4616         lval var.
4618 Copyright (C) 2018 Free Software Foundation, Inc.
4620 Copying and distribution of this file, with or without modification,
4621 are permitted in any medium without royalty provided the copyright
4622 notice and this notice are preserved.