1 2019-10-17 Jason Merrill <jason@redhat.com>
3 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
4 (gimplify_to_rvalue): Remove default NULL argument.
6 2019-10-17 Nathan Sidwell <nathan@acm.org>
8 * decl.c (builtin_function_1): Merge into ...
9 (cxx_builtin_function): ... here. Nadger the decl before maybe
10 copying it. Set the context.
11 (cxx_builtin_function_ext_scope): Push to top level, then call
14 2019-10-16 Luis Machado <luis.machado@linaro.org>
16 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
18 2019-10-16 Jakub Jelinek <jakub@redhat.com>
20 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
21 if cleanup is a nop, clear location of its operand too.
23 2019-10-15 Nathan Sidwell <nathan@acm.org>
25 * class.c (build_clones): Break out of clone_function_decl. Just
27 (clone_function_decl): Call build_clones, then maybe add them to
30 * class.c (build_clone): Refactor to clarify recursiveness.
32 2019-10-14 Jason Merrill <jason@redhat.com>
34 PR c++/91930 - ICE with constrained inherited default ctor.
35 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
36 for inherited constructor.
38 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
40 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
42 2019-10-14 Jakub Jelinek <jakub@redhat.com>
45 * semantics.c (handle_omp_array_sections_1): Temporarily disable
46 -fstrong-eval-order also for in_reduction and task_reduction clauses.
48 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
49 into int NESTED, if it is 2, diagnose missing commas in between
51 (cp_parser_omp_context_selector): Pass 2 as last argument to
52 cp_parser_omp_all_clauses.
54 2019-10-12 Jakub Jelinek <jakub@redhat.com>
56 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
57 For simd properties, put them directly into TREE_VALUE.
58 (cp_finish_omp_declare_variant): Add "omp declare variant base"
59 attribute rather than "omp declare variant".
61 2019-10-11 Marek Polacek <polacek@redhat.com>
63 PR c++/92049 - extra error with -fchecking=2.
64 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
67 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
69 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
71 * constexpr.c (cxx_eval_constant_expression): Likewise.
72 (potential_constant_expression_1): Likewise.
73 * pt.c (tsubst_copy): Likewise.
75 2019-10-11 Jason Merrill <jason@redhat.com>
77 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
78 explicitly defaulted functions.
79 * method.c (synthesize_method): Likewise.
81 2019-10-11 Jakub Jelinek <jakub@redhat.com>
84 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
85 operands have been swapped and at least one operand has side-effects,
86 revert the swapping before calling build_array_ref.
87 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
88 side-effects on the index operand, if -fstrong-eval-order use
89 save_expr around the array operand.
90 (cp_build_binary_op): For shifts with side-effects in the second
91 operand, wrap first operand into SAVE_EXPR and evaluate it before
93 * semantics.c (handle_omp_array_sections_1): Temporarily disable
94 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
96 * cp-gimplify.c (gimplify_to_rvalue): New function.
97 (cp_gimplify_expr): Use it.
99 2019-10-10 Marek Polacek <polacek@redhat.com>
101 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
102 Use false instead of 0.
104 2019-10-10 Jakub Jelinek <jakub@redhat.com>
106 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
107 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
109 (cp_parser_oacc_all_clauses): Formatting fix.
110 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
111 processing on closing paren and don't skip to end of pragma line.
112 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
114 (omp_construct_selectors, omp_device_selectors,
115 omp_implementation_selectors, omp_user_selectors): New variables.
116 (cp_parser_omp_context_selector,
117 cp_parser_omp_context_selector_specification,
118 cp_finish_omp_declare_variant): New functions.
119 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
120 (cp_parser_omp_declare): Handle declare variant.
122 2019-10-09 Jason Merrill <jason@redhat.com>
124 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
126 2019-10-09 Marek Polacek <polacek@redhat.com>
128 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
129 PR c++/69531 - DR 1307: Differently bounded array parameters.
130 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
131 * call.c (build_array_conv): Build ck_identity at the beginning
133 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
134 (maybe_warn_array_conv): New.
135 (convert_like_real): Call it. Add an error message about converting
136 from arrays of unknown bounds.
137 (conv_get_original_expr): New.
138 (nelts_initialized_by_list_init): New.
139 (conv_binds_to_array_of_unknown_bound): New.
140 (compare_ics): Implement list-initialization ranking based on
141 array sizes, as specified in DR 1307 and P0388R.
142 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
143 (compare_bounds_t): New enum.
144 * typeck.c (comp_array_types): New bool and compare_bounds_t
145 parameters. Use them.
146 (structural_comptypes): Adjust the call to comp_array_types.
147 (similar_type_p): Handle ARRAY_TYPE.
148 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
149 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
150 comp_array_types to compare array types. Look through arrays as per
152 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
153 Look through arrays as per DR 330.
155 2019-10-09 Marek Polacek <polacek@redhat.com>
157 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
158 * call.c (standard_conversion): When converting an enumeration with
159 a fixed underlying type to the underlying type, give it the cr_promotion
161 (compare_ics): Implement a tiebreaker as per CWG 1601.
163 2019-10-08 Andrew Sutton <asutton@lock3software.com>
164 Jason Merrill <jason@redhat.com>
166 Update the concepts implementation to conform to the C++20
167 specification, improve compile times, and generally clean up
169 * call.c (build_new_function_call): Don't evaluate concepts here.
170 (constraint_failure): Don't record the template.
171 (print_z_candidate): Don't extract the template.
172 * class.c (add_method): When overloading, hide ineligible special
174 (check_methods): Set TYPE_HAS_COMPLEX_* here.
175 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
176 (maybe_initialize_fundef_copies_table): Remove.
177 (get_fundef_copy): Use hash_map_safe_get_or_insert.
178 (clear_cv_and_fold_caches): Clear the satisfaction cache.
179 * constraint.cc (known_non_bool_p): New.
180 (parsing_constraint_expression_sentinel): Renamed from
181 expanding_constraint_sentinel.
182 (check_constraint_operands): New.
183 (check_constraint_atom): New.
184 (finish_constraint_binary_op): New.
185 (finish_constraint_or_expr): Likewise.
186 (finish_constraint_and_expr): Likewise.
187 (finish_constraint_primary_expr): Likewise.
188 (combine_constraint_expressions): New.
189 (finish_requires_expr): Add location parm.
190 (get_concept_definition): Return the initializer of concept definitions.
191 (get_template_head_requirements): New.
192 (get_trailing_function_requirements): New.
193 (deduce_constrained_parameter): Check if the identifier or template-id
194 is a concept definition.
195 (resolve_concept_definition_check): Removed.
196 (resolve_variable_concept_check): Removed.
197 (resolve_concept_check): New.
198 (resolve_constraint_check): Handle concept definitions.
199 converting arguments.
200 (function_concept_check_p): Removed.
201 (variable_concept_check_p): Removed.
202 (unpack_concept_check): New.
203 (get_concept_check_template): New.
204 (build_call_check): Moved and renamed to build_function_check.
205 (build_concept_check_arguments): make static.
206 (build_function_check): Always do overload resolution
207 in order to force conversion of template arguments (i.e., actually
208 check that the use of a concept is valid).
209 (build_standard_check): Renamed from build_real_concept_check.
210 (build_real_concept_check): Build checks for C++2a concepts by
211 (build_wildcard_concept_check): New.
212 (build_concept_check): Use build_real_concept_check. New overload.
213 (build_constraints): Save expressions, not normalized constraints.
214 (build_concept_id): New. Pass tf_warning_or_error.
215 (build_type_constraint): New.
216 (finish_type_constraints): New.
217 (associate_classtype_constraints): Also add constraints to union
218 types. Note the original declaration in errors. Don't return
219 error_mark_node in order to avoid an assertion later.
220 (push_down_pack_expansion): Remove.
221 (finish_shorthand_constraint): Make fold expressions, not naked
222 parameter packs. Always apply the constraint to each template argument.
223 (check_introduction_list): New. Fail if not enough
224 names are introduced.
225 (finish_template_introduction): Don't normalize constraints. Pass
226 tsubst flags. Check for insufficient introductions.
227 (placeholder_extract_concept_and_args): Handle the template-id case.
228 Unpack function concept checks correctly.
229 (tsubst_simple_requirement): Return errors if they occur. Don't
230 process as a template.
231 (tsubst_type_requirement): Likewise.
232 (type_deducible_p): New. Wrap the input expression in parens for the
233 purpose of deduction.
234 (expression_convertible_t): New.
235 (tsubst_compound_requirement): Use new deduction, conversion predicates.
236 (tsubst_nested_requirement): Return errors if they occur. Don't
237 process as a template. Instantiate and evaluate the nested requirement.
238 (tsubst_valid_expression_requirement): New.
239 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
240 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
241 (check_constaint_variables): New.
242 (tsubst_constraint_variables): Check that type substitutions are valid.
243 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
244 template substitution. Copy the previous local specialization stack,
245 so references to non-local parameters can be found. Use cp_unevaluated.
246 (tsubst_constraint): New. Don't evaluate concept checks.
248 (norm_info): New. Used to build a normalization tree for concept check
250 (debug_parameter_mapping): New.
251 (debug_argument_list): New.
252 (expand_concept): Removed.
253 (normalize_logical_operation): Pass subst_info through call.
254 (normalize_pack_expansion): Remove.
255 (normalize_simple_requirement): Removed
256 (normalize_type_requirement): Removed
257 (normalize_compound_requirement): Removed
258 (normalize_nested_requirement): Removed
259 (normalize_requirement): Removed
260 (normalize_requirements): Removed
261 (normalize_requires_expression): Removed
262 (normalize_variable_concept_check): Removed.
263 (normalize_function_concept_check): Removed.
264 (normalize_concept_check): Merged all normalize_*_check here.
265 Substitute through written template arguments before normalizing the
266 definition. Only substitute the innermost template arguments.
267 (check_for_logical_overloads): Delete.
268 (map_arguments): New. Associate template parameters with arguments.
269 (build_parameter_mapping): New. Extract used parameters.
270 (normalize_expression): Rewrite.
271 (normalize_conjunction): Removed
272 (normalize_disjunction): Removed
273 (normalize_predicate_constraint): Removed
274 (normalize_parameterized_constraint): Removed
275 (normalized_map): New variable.
276 (get_normalized_constraints): New entry point for normalization.
278 (get_normalized_constraints_from_info): New.
279 (get_normalized_constraints_from_decl): New. Turn on template processing
280 prior to normalization. Handle inheriting ctors. Build the
281 normalization arguments from the full set of template parameters of the
282 most general template. This guarantees that we have no concrete arguments
283 in the parameter mapping (e.g., from template members of class
284 templates). Cache normalizations.
285 (normalize_concept_definition): New. Cache normalizations.
286 (normalize_template_requirements): New.
287 (normalize_nontemplate_requirements): New.
288 (normalize_constraint_expression): New.
289 (tsubst_parameter_mapping): New.
290 (get_mapped_args): New.
291 (parameter_mapping_equivalent_p): New. Use template_args_equal.
292 (atomic_constraints_identical_p): New.
293 (hash_atomic_constraint): New.
294 (satisfying_constraint_p): New. Guard against recursive evaluation of
295 constraints during satisfaction.
296 (satisfy_conjunction): New.
297 (satisfy_disjunction): New.
298 (sat_entry): New class for hashing satisfaction results.
299 (sat_hasher): New hash traits.
301 (get_satisfaction): New. Returns cached satisfaction result.
302 (save_satisfaction): New. Caches a satisfaction result.
303 (clear_satisfaction_cache): New.
304 (satisfaction_cache): New. Helps manage satisfaction cache requests.
305 (decl_satisfied_cache): New.
307 (satisfy_constraint_r): New.
308 (satisfy_constraint): Use new satisfaction algorithm.
309 (evaluate_concept_check): New.
310 (evaluate_concept): Removed.
311 (evaluate_function_concept): Removed.
312 (evaluate_variable_concept): Removed.
313 (satisfy_constraint_expression): New.
314 (constraint_expression_satisfied_p): New.
315 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
316 push_/pop_access_scope.
317 (more_constrained): Normalize before calling out to subsumption. Allow
318 classes as arguments.
319 (strictly_subsumes): Allow non-templates as arguments. Accept a new
321 (weakly_subsumes): New.
322 (at_least_as_constrained): Removed.
323 (diagnose_other_expression): Removed.
324 (diagnose_predicate_constraint): Removed.
325 (diagnose_pack_expansion): Removed.
326 (diagnose_check_constraint): Removed.
327 (diagnose_logical_constraint): Removed.
328 (diagnose_expression_constraint): Removed.
329 (diagnose_type_constraint): Removed.
330 (diagnose_implicit_conversion_constraint): Removed.
331 (diagnose_argument_deduction_constraint): Removed.
332 (diagnose_exception_constraint): Removed.
333 (diagnose_parameterized_constraint): Removed.
334 (diagnose_argument_deduction_constraint): Removed.
335 (diagnose_argument_deduction_constraint): Removed.
336 (diagnose_argument_deduction_constraint): Removed.
337 (diagnose_trait_expr): New.
338 (diagnose_requires_expr): New.
339 (diagnose_atomic_constraint): New.
340 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
341 Don't substitute as if in template decls. This causes substitution
342 to generate expressions that aren't suitable for use with the noexcept
344 (diagnose_valid_type) Likewise.
345 (diagnose_compound_requirement) Actually emit diagnostics for
346 the causes of errors.Call force_paren_expr_uneval.
347 (diagnose_declaration_constraints): Turn on template processing to
348 suppress certain analyses.
349 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
350 (cp_get_debug_type): Use hash_map_safe_*.
351 * cp-tree.h: New function declarations for semantic actions, other
352 facilities. Remove declaration no longer used or needed. Remove
353 unused _CONSTR macros.
354 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
355 (template_info_decl_check): Factor macro check into an inline function.
356 (DECL_TEMPLATE_INFO): Use new check facility.
357 (finish_concept_definition): New. Don't invalid concept declarations
358 with invalid initializers.
359 (find_template_parameters): New.
360 (concept_definition_p): New.
361 (concept_check_p): New.
362 (variable_concept_check_p): New.
363 (force_paren_expr_uneval): New.
364 (ovl_iterator::using_p): A USING_DECL by itself was also
365 introduced by a using-declaration.
366 (struct tree_template_info): Use tree_base instead of
367 tree_common. Add tmpl and args fields.
368 (TI_TEMPLATE, TI_ARGS): Adjust.
369 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
370 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
371 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
372 (struct tree_trait_expr): Add locus field.
373 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
374 context when diagnosing constraint failure.
375 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
378 * cxx-pretty-print.c: Remove constraint printing code.
379 (pp_cxx_concept_definition): New.
380 (pp_cxx_template_declaration): Print concept definitions.
381 (pp_cxx_check_constraint): Update printing for concept definitions.
382 (pp_cxx_nested_name_specifier): Fix a weird
383 case where we're printing '::::' for concepts.
384 (simple_type_specifier): Print requirements for placeholder types.
385 (pp_cxx_constrained_type_spec): Print the associated requirements of
387 (pp_cxx_compound_requirement): Add space before the '->'.
388 (pp_cxx_parameter_mapping): Print the parameter mapping.
389 (pp_cxx_atomic_constraint): Use the function above.
390 * decl.c (redeclaration_error_message): New error for concepts.
391 (grokdeclarator): Check for and disallow decltype(auto) in parameter
393 (grokfndecl): Don't normalize constraints. Add check for constraints
395 (grokvardecl): Don't normalize constraints.
396 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
397 (function_requirements_equivalent_p): New. Compare trailing
398 requires clauses. Compare combined constraints in pre-C++20 mode.
399 (decls_match): Compare trailing requires clauses. Compare template
400 heads for function templates. Remove old constraint comparison.
401 Simplify comparison of functions, function templates.
402 (duplicate_function_template_decls): New. Refactor a nasty if
403 condition into a single predicate.
404 (require_deduced_type): Don't complain if we already complained about
406 (finish_function): Perform auto deduction to ensure that constraints
407 are checked even when functions contain no return statements. Only do
408 auto deduction if we haven't previously seen any return statements.
409 This prevents multiple diagnostics of the same error.
410 (store_decomp_type): Remove.
411 (cp_finish_decomp): Use hash_map_safe_put.
412 * error.c: Remove constraint printing code.
413 (dump_decl): Dump concept definitions. Handle wildcard declarations.
414 (dump_template_decl): Likewise.
415 (dump_type): Print associated requirements for placeholder
417 (rebuild_concept_check): New.
418 (maybe_print_single_constraint_context): New.
419 (maybe_print_constraint_context): Recursively print nested contexts.
420 * init.c (get_nsdmi): Use hash_map_safe_*.
421 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
422 (add_capture): Copy parameter packs from init.
423 (lambda_capture_field_type): Always use auto for init-capture.
424 * logic.cc: Completely rewrite.
425 (constraint_hash): New.
426 (clause/ctor): Save atoms in the hash table.
427 (replace): Save atoms during replacement.
428 (insert): Save atoms during insertion.
429 (contains): Only search the hash table for containment.
430 (clause): Keep a hash of atomic constraints.
431 (clause::clause): Explicitly copy the hash table when copying.
432 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
433 (diagnose_constraint_size): New.
434 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
435 to determine the cheapest decomposition.
436 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
438 (matching_fn_p): Check constraints.
439 (push_class_level_binding_1): Move overloaded functions case down,
440 accept FUNCTION_DECL as target_decl.
441 * parser.c (enum required_token): New required token for auto.
442 (make_location): Add overload taking lexer as last parm.
443 (cp_parser_required_error): Diagnose missing auto.
444 (cp_parser_diagnose_ungrouped_constraint_plain): New.
445 (cp_parser_diagnose_ungrouped_constraint_plain): New.
446 (cp_parser_constraint_primary_expression): New. Tentatively parse the
447 primary expression. If that fails tentatively parse a lower
448 precedence expression in order to diagnose the error.
449 (cp_parser_check_non_logical_constraint): New. Performs a trial
450 parse of the right-hand-side of non-logical operators in order to
451 generate good diagnostics.
452 (cp_parser_constraint_logical_and_expression): New.
453 (cp_parser_constraint_logical_or_expression): New.
454 (cp_parser_requires_clause_expression): New.
455 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
456 (cp_parser_requires_clause_opt): Parse the requires-clause differently
457 in -fconcepts and -std=c++2a modes.
458 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
459 Rewrite so that semicolons are parsed
460 along with requirements, not the sequence.
461 (cp_parser_simple_requirement): Expect a semicolon at end.
462 (cp_parser_compound_requirement): Expect a semicolon at end. Only
463 allow trailing-return-type with -fconcepts-ts.
464 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
465 constraint-expressions.
466 (cp_parser_concept_definition): New. Don't fail parsing the concept
467 definition if the initializer is ill-formed. Don't declare the concept
468 before parsing the initializer.
469 (cp_parser_constraint_expression): Declare earlier.
470 (cp_parser_type_requirement): Current scope is not valid.
471 (cp_parser_requires_expression): Commit to the tentative parse.
472 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
474 (cp_parser_template_declaration_after_parameters): Parse concept
476 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
477 (cp_parser_template_id_expr): Resolve it as a concept check.
478 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
479 (cp_parser_type_parameter): Combine expressions not
481 (cp_parser_explicit_template_declaration): Combine expressions not
483 (cp_parser_maybe_concept_name): Removed.
484 (cp_parser_simple_type_specifier): Handle an error condition of
485 a bad constrained type specifier. Expect auto or decltype after
486 a concept name. Also handle the case where we have a template-id
488 (cp_parser_template_introduction): Diagnose errors on invalid
489 introductions. Give up if it doesn't start with a concept name.
490 Pedwarn if not -fconcepts-ts.
491 (synthesize_implicit_template_parm): Don't do consistent binding.
492 Use a new flag for constrained parameters. Combine expressions,
493 not constraints. Fail if we get a placeholder in block scope.
494 Placeholders that do not constrain types are not allowed in parameter
495 declarations, so don't handle them.
496 (cp_parser_placeholder_type_specifier): New. Implement parsing of
497 placeholder type specifiers following a concept name or partial
498 concept check. Disallow decltype(auto) parameters.
499 (cp_parser_nested_name_specifier_opt): If the token is already
500 CPP_NESTED_NAME_SPECIFIER, leave it alone.
501 (cp_parser_id_expression, cp_parser_unqualified_id): Call
502 cp_parser_template_id_expr.
503 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
504 expect a WILDCARD_DECL.
505 (cp_parser_trait_expr): Pass trait_loc down.
506 (cp_parser_postfix_expression): Do set location of dependent member
508 * pt.c (finish_concept_definition): New.
509 (push_template_decl_real): Handle concept definitions.
510 (start_concept_definition): Let push_template_decl_real handle the
511 creation of the template.
512 (get_constraints): Return null if the table hasn't been initialized.
513 (tsubst_copy_and_build): Build template-id expressions for concept
515 [TRAIT_EXPR]: Pass trait_loc down.
516 (lookup_template_class_1): Add the template name to the constraint
518 (lookup_and_finish_template_variable): Build concept checks
519 with the correct arguments.
520 (tsubst_function_decl): Don't substitute through constraints.
521 Always associate constraints with functions.
522 (template_parm_level_and_index): Make non-static.
523 (for_each_template_parm_r): Handle requires expressions.
524 (keep_template_parm): New.
525 (find_template_parameters): New.
526 (more_specialized_fn): Change how winners and losers are chosen.
527 (make_constrained_auto): Don't normalize constraints.
528 (template_parameters_equivalent_p): New. Compare template
529 parameters. Add a comparison for implicitly vs. explicitly declared
531 (template_parameter_lists_equivalent_p): New. Compare template
533 (template_requirements_equivalent_p): New.
534 (template_heads_equivalent_p): New. Compare template heads.
535 (template_parameter_constraints_equivalent_p): New.
536 (is_compatible_template_arg): Use weakly_subsumes.
537 (maybe_new_partial_specialization): Use new constraint comparison
538 for finding specializations.
539 (process_partial_specialization): Pass main template as argument.
540 (more_specialized_partial_spec): Don't immediately return when
542 (make_constrained_auto): Handle concept definitions.
543 (do_auto_deduction): Update auto deduction for new concept model.
544 Extract the function concept correctly; rename constr to check to
545 reflect the kind of node.
546 (tsubst): Adjust wildcard argument during substitution.
547 [DECLTYPE_TYPE]: Remove init-capture handling.
548 (tsubst_copy_and_build): Build concept checks, not template ids.
549 Defer checks of function concepts. Handle concepts before variable
550 templates. Handle calls to function concepts explicitly.
551 (coerce_template_parms): Use concept_definition_p. Handle a deduction
552 error where a potentially empty pack can be supplied after the last
553 parameter of a concept.
554 (finish_template_variable): Don't process concepts here.
555 (instantiation_dependent_r): Use concept_check_p.
556 (tsubst_template_args): Make non-static.
557 (make_constrained_placeholder_type): New. Refactored from
558 make_constrained_auto.
559 (make_constrained_auto) Use make_constrained_placeholder_type.
560 (make_constrained_decltype_auto) New.
561 (tsubst_function_parms): New.
562 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
563 concept_definition_p.
564 (push_access_scope, pop_access_scope): No longer static.
565 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
566 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
567 (get_underlying_template) Use generic_targs_for.
568 (uses_parameter_packs): Return tree.
569 (gen_elem_of_pack_expansion_instantiation): Don't push
570 local_specialization_stack.
571 (prepend_one_capture): New.
572 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
573 local_specializations.
574 (template_parms_level_to_args): No longer static.
575 (add_outermost_template_args): Likewise.
576 (find_template_parameter_info): New. Provide context for finding
578 (keep_template_parm): Don't keep parameters declared at depth levels
579 greater than those of the template parameters of the source declaration.
580 Don't propagate cv-qualified types. Return 0, so we find all template
581 parameters, not the just first.
582 (any_template_parm_r): New. Handle cases that are mishandled by
583 for_each_template_parm_r.
584 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
585 (tsubst_argument_pack): Factor out of tsubst_template_args.
586 (constraint_sat_entry): Removed.
587 (constraint_sat_hasher): Removed.
588 (concept_spec_entry): Removed.
589 (concept_spec_hasher): Removed.
590 (constraint_memos): Removed.
591 (concept_memos): Removed.
592 (lookup_constraint_satisfaction): Removed.
593 (memoize_constraint_satisfaction): Removed.
594 (lookup_concept_satisfaction): Removed.
595 (memoize_concept_satisfaction): Removed.
596 (concept_expansions): Removed.
597 (get_concept_expansion): Removed.
598 (save_concept_expansion): Removed.
599 (init_constraint_processing): Remove initialization of non-existing
601 (find_template_requirement): New. Search for the sub-requirement
602 within the associated constraints.
603 (convert_generic_types_to_packs): Also transform the associated
604 constraint and update the current template requirements.
605 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
606 (add_defaults_to_ttp): Use hash_map_safe_*.
607 * semantics.c (finish_call_expr): Diagnose calls to concepts.
608 Handle concept checks explicitly.
609 (finish_id_expression): Evaluate variable concepts as part of
610 id-expression processing. Don't treat variable concepts as variables,
611 and don't process function concepts as plain id-expressions.
612 (force_paren_expr): Add even_uneval parm.
613 (finish_trait_expr): Add location parm.
614 * tree.c (special_memfn_p): New.
615 (cp_expr_location): Handle TRAIT_EXPR.
616 * typeck.c (check_return_expr): Actually use the diagnostic kind
617 when performing return-type deduction.
618 * typeck2.c (build_functional_cast): Don't rely on the location of
621 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
623 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
624 * typeck.c (cp_build_binary_op): Use the op_location_t argument
625 in many error messages.
627 2019-10-08 Martin Sebor <msebor@redhat.com>
630 * call.c (maybe_warn_class_memaccess): Handle arrays.
632 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
634 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
635 * decl.c (grokdeclarator): Use id_loc in one place.
636 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
637 * parser.c (cp_parser_delete_expression): Fix the location of the
639 (cp_parser_throw_expression): Likewise.
640 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
642 2019-10-05 Jakub Jelinek <jakub@redhat.com>
644 PR c++/91369 - Implement P0784R7: constexpr new
645 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
646 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
647 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
649 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
650 cxx_constant_dtor): Declare.
651 * class.c (type_maybe_constexpr_default_constructor): Make static.
652 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
654 (finalize_literal_type_property): For c++2a, don't clear
655 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
656 have non-constexpr destructors.
657 (explain_non_literal_class): For c++2a, complain about non-constexpr
658 destructors rather than about non-trivial destructors.
659 * constexpr.c: Include stor-layout.h.
660 (struct constexpr_global_ctx): New type.
661 (struct constexpr_ctx): Add global field, remove values and
663 (cxx_replaceable_global_alloc_fn): New inline function.
664 (cxx_eval_call_expression): For c++2a allow calls to replaceable
665 global allocation functions, for new return address of a heap uninit
666 var, for delete record its deletion. Change ctx->values->{get,put} to
667 ctx->global->values.{get,put}.
668 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
669 special diagnostics for heap variables.
670 (cxx_eval_store_expression): Change ctx->values->{get,put} to
671 ctx->global->values.{get,put}.
672 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
673 new_ctx.values->remove to ctx->global->values.remove.
674 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
675 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
676 ctx->global->values.{get,put}.
677 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
678 allocation function to some pointer type, adjust the type of
679 the heap variable and change name from heap_uninit_identifier
681 (find_heap_var_refs): New function.
682 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
683 handle evaluation of constexpr dtors and add tracking of heap
684 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
685 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
686 (cxx_constant_dtor): New function.
687 (maybe_constant_value, fold_non_dependent_expr_template,
688 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
690 (potential_constant_expression_1): Ignore clobbers. Allow
691 COND_EXPR_IS_VEC_DELETE for c++2a.
692 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
693 (decl_maybe_constant_destruction): New function.
694 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
695 with non-trivial, but constexpr destructors.
696 (register_dtor_fn): For constexpr variables with constexpr non-trivial
697 destructors call cxx_maybe_build_cleanup instead of adding destructor
699 (expand_static_init): For constexpr variables with constexpr
700 non-trivial destructors call cxx_maybe_build_cleanup.
701 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
703 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
704 non-trivial destructors call cxx_constant_dtor instead of adding
705 destructor calls at runtime.
706 * init.c: Include stor-layout.h.
707 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
709 (build_new_1): For c++2a and new[], add cast around the alloc call
710 to help constexpr evaluation figure out the type of the heap storage.
711 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
712 for it instead of initializing an uninitialized variable.
713 * method.c: Include intl.h.
714 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
716 (process_subob_fn): Add sfk argument, adjust non-constexpr call
717 diagnostics based on it.
718 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
719 (synthesized_method_base_walk): Likewise.
720 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
721 Fix up DR number in comment.
722 (implicitly_declare_fn): Formatting fix.
723 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
724 initializers of automatic non-constexpr variables in constexpr
727 2019-10-04 Jakub Jelinek <jakub@redhat.com>
730 * constexpr.c (cxx_fold_indirect_ref_1): New function.
731 (cxx_fold_indirect_ref): Use it.
734 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
735 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
736 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
737 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
739 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
741 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
742 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
743 (push_class_level_binding_1): Likewise.
744 (set_decl_namespace): Likewise.
746 2019-10-03 Jakub Jelinek <jakub@redhat.com>
748 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
749 not skipping upon entry to body, run cleanup with the same *jump_target
750 as it started to run the cleanup even if the body returns, breaks or
752 (potential_constant_expression_1): Allow CLEANUP_STMT.
754 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
755 const_object_being_modified with array type.
757 2019-10-02 Jason Merrill <jason@redhat.com>
759 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
762 2019-09-30 Jason Merrill <jason@redhat.com>
764 Use hash_map_safe_* functions.
765 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
766 (get_fundef_copy): Use hash_map_safe_get_or_insert.
767 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
768 * decl.c (store_decomp_type): Remove.
769 (cp_finish_decomp): Use hash_map_safe_put.
770 * init.c (get_nsdmi): Use hash_map_safe_*.
771 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
772 (add_defaults_to_ttp): Use hash_map_safe_*.
774 2019-10-02 Richard Biener <rguenther@suse.de>
777 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
778 fat pointer structure members as DECL_NONADDRESSABLE_P.
780 2019-09-28 Marek Polacek <polacek@redhat.com>
782 PR c++/91889 - follow-up fix for DR 2352.
783 * call.c (involves_qualification_conversion_p): New function.
784 (direct_reference_binding): Build a ck_qual if the conversion
785 would involve a qualification conversion.
786 (convert_like_real): Strip the conversion created by the ck_qual
787 in direct_reference_binding.
789 PR c++/91921 - stray warning with -Woverloaded-virtual.
790 * class.c (warn_hidden): Only emit the second part of
791 -Woverloaded-virtual if the first part was issued. Use inform instead
794 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
795 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
798 2019-09-27 Jakub Jelinek <jakub@redhat.com>
801 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
803 * semantics.c (finish_omp_clauses): Allow predefined variables in
804 shared and firstprivate clauses, even when they are predetermined
806 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
807 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
809 2019-09-27 Jason Merrill <jason@redhat.com>
811 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
812 (cxx_eval_indirect_ref): Likewise. Improve error location.
814 * cp-tree.h (class iloc_sentinel): New.
815 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
816 * mangle.c (mangle_decl_string): Use it.
817 * pt.c (perform_typedefs_access_check): Use it.
819 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
821 * cp-tree.h (build_cxx_call): Take the original function decl
822 as an optional final parameter.
823 (cp_build_function_call_vec): Likewise.
824 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
825 check_builtin_function_arguments.
826 * typeck.c (build_function_call_vec): Take the original function
827 decl as an optional final parameter and pass it to
828 cp_build_function_call_vec.
829 (cp_build_function_call_vec): Take the original function
830 decl as an optional final parameter and pass it to build_cxx_call.
832 2019-09-25 Marek Polacek <polacek@redhat.com>
834 PR c++/91877 - ICE with converting member of packed struct.
835 * call.c (convert_like_real): Use similar_type_p in an assert.
837 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
839 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
840 (check_local_shadow): Use it in three additional places.
842 2019-09-24 Jason Merrill <jason@redhat.com>
844 * parser.c (cp_parser_postfix_expression): Do set location of
845 dependent member call.
847 2019-09-24 Marek Polacek <polacek@redhat.com>
849 PR c++/91868 - improve -Wshadow location.
850 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
851 instead of input_location.
853 PR c++/91845 - ICE with invalid pointer-to-member.
854 * expr.c (mark_use): Use error_operand_p.
855 * typeck2.c (build_m_component_ref): Check error_operand_p after
856 calling mark_[lr]value_use.
858 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
860 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
861 (process_partial_specialization): Likewise.
862 (convert_nontype_argument_function): Likewise.
863 (invalid_tparm_referent_p): Likewise.
864 (convert_template_argument): Likewise.
865 (check_valid_ptrmem_cst_expr): Tidy.
867 2019-09-23 Jason Merrill <jason@redhat.com>
869 PR c++/91809 - bit-field and ellipsis.
870 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
871 arithmetic arguments.
873 2019-09-23 Marek Polacek <polacek@redhat.com>
875 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
876 * call.c (reference_related_p): Use similar_type_p instead of
878 (reference_compatible_p): Update implementation to match CWG 2352.
879 * cp-tree.h (similar_type_p): Declare.
880 * typeck.c (similar_type_p): New.
882 2019-09-22 Marek Polacek <polacek@redhat.com>
884 PR c++/91819 - ICE with operator++ and enum.
885 * call.c (build_new_op_1): Set arg2_type.
887 2019-09-17 Jason Merrill <jason@redhat.com>
889 * parser.c (cp_parser_statement): Handle [[likely]] on
892 2019-09-19 Jason Merrill <jason@redhat.com>
895 * call.c (build_new_op_1): Don't apply any standard conversions to
896 the operands of a built-in operator. Don't suppress conversions in
898 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
900 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
902 * decl.c (grokdeclarator): Use declspecs->locations and
903 declarator->id_loc in a few error messages.
904 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
905 (push_template_decl_real): Likewise.
907 2019-09-15 Jason Merrill <jason@redhat.com>
909 PR c++/30277 - int-width bit-field promotion.
910 PR c++/33819 - long bit-field promotion.
911 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
912 properly. Handle 32-bit non-int bit-fields properly.
913 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
915 PR c++/82165 - enum bitfields and operator overloading.
916 * call.c (build_new_op_1): Use unlowered_expr_type.
918 * call.c (build_new_op_1): Don't apply any standard conversions to
919 the operands of a built-in operator. Don't suppress conversions in
921 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
923 2019-09-15 Marek Polacek <polacek@redhat.com>
925 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
926 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
929 2019-09-15 Nathan Sidwell <nathan@acm.org>
931 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
932 IDENTIFIER_CDTOR_P, correct documentation.
933 (DECL_CLONED_FUNCTION): Directly access field.
934 (decl_cloned_function_p): Delete.
935 * class.c (decl_cloned_function_p): Delete.
936 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
938 2019-09-11 Nathan Sidwell <nathan@acm.org>
940 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
941 correctly mark all C++ nodes.
942 * decl.c (cp_tree_node_structure): Alphabetize.
944 2019-09-10 Marek Polacek <polacek@redhat.com>
946 PR c++/91673 - ICE with noexcept in alias-declaration.
947 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
948 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
949 cp_parser_exception_specification_opt.
950 (cp_parser_direct_declarator): Adjust a call to
951 cp_parser_exception_specification_opt.
952 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
953 to cp_parser_declarator if not processing a friend or typedef
955 (cp_parser_late_noexcept_specifier): Adjust a call to
956 cp_parser_noexcept_specification_opt.
957 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
958 drop the FRIEND_P parameter. Use the new parameter.
959 (cp_parser_exception_specification_opt): Likewise.
960 (cp_parser_transaction): Adjust a call to
961 cp_parser_noexcept_specification_opt.
962 (cp_parser_transaction_expression): Likewise.
964 2019-09-10 Marek Polacek <polacek@redhat.com>
966 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
967 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
970 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
972 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
974 (build_enumerator): Likewise.
975 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
976 (grokdeclarator): Use id_loc in two error_at; change errror
977 message about constinit together constexpr to use two ranges.
979 2019-09-09 Marek Polacek <polacek@redhat.com>
981 PR c++/84374 - diagnose invalid uses of decltype(auto).
982 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
983 a function declaration.
985 2019-09-06 Nathan Sidwell <nathan@acm.org>
988 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
989 (struct lang_decl_base): Remove repo_available_p.
990 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
992 (Reserve TREE_LANG_FLAG_3 for modules.
993 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
994 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
995 * class.c (build_ctor_vtbl_group): Don't set
996 DECL_CONSTRUCTION_VTABLE_P.
997 * decl2.c (determine_visibility_from_class): Don't check
998 DECL_CONSTRUCTION_VTABLE_P anymore.
1000 2019-09-06 Martin Liska <mliska@suse.cz>
1003 * Make-lang.in: Remove repo.o.
1004 * config-lang.in: Likewise.
1005 * cp-tree.h (init_repo): Remove declarations
1006 of repo-related functions.
1007 (repo_emit_p): Likewise.
1008 (repo_export_class_p): Likewise.
1009 (finish_repo): Likewise.
1010 * decl2.c (import_export_class): Always
1012 (mark_needed): Remove -frepo from comment.
1013 (import_export_decl): Similarly here.
1014 (c_parse_final_cleanups): Remove call of finish_repo.
1015 * lex.c (cxx_init): Remove call to init_repo.
1016 * optimize.c (can_alias_cdtor): Remove dead condition.
1017 * pt.c (push_template_decl_real): Update comment.
1018 (instantiate_decl): Remove dead code used for -frepo.
1021 2019-09-05 Marek Polacek <polacek@redhat.com>
1023 PR c++/91644 - ICE with constinit in function template.
1024 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
1025 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
1026 constinit variables.
1028 2019-09-05 Nathan Sidwell <nathan@acm.org>
1030 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
1032 2019-09-04 Marek Polacek <polacek@redhat.com>
1034 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
1035 * pt.c (unify): Likewise.
1037 2019-09-01 Marek Polacek <polacek@redhat.com>
1039 PR c++/91129 - wrong error with binary op in template argument.
1040 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
1041 fold_non_dependent_expr.
1042 (cp_build_binary_op): Likewise.
1044 2019-08-30 Jason Merrill <jason@redhat.com>
1046 Add source location to TRAIT_EXPR.
1047 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
1048 (struct tree_trait_expr): Add locus field.
1049 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
1050 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
1051 * semantics.c (finish_trait_expr): Add location parm.
1052 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
1054 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
1056 * decl.c (check_var_type): Add location_t parameter and use it.
1057 (grokdeclarator): Adjust call.
1058 * pt.c (tsubst_decl): Likewise.
1059 * cp-tree.h: Adjust declaration.
1061 2019-08-28 Marek Polacek <polacek@redhat.com>
1063 Implement P1152R4: Deprecating some uses of volatile.
1065 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
1066 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
1067 binding and return type.
1068 (grokparms): Warn about a volatile-qualified function parameter.
1069 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
1070 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
1071 post ++/-- on a volatile operand.
1072 (genericize_compound_lvalue): Use a better location. Don't lose
1074 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
1075 assignment whose LHS is volatile-qualified. Build the assignment with
1076 a more precise location.
1078 2019-08-28 Marek Polacek <polacek@redhat.com>
1080 PR c++/91360 - Implement C++20 P1143R2: constinit.
1081 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
1082 (LOOKUP_CONSTINIT): Define.
1083 (enum cp_decl_spec): Add ds_constinit.
1084 * decl.c (check_tag_decl): Give an error for constinit in type
1086 (check_initializer): Also check LOOKUP_CONSTINIT.
1087 (cp_finish_decl): Add checking for a constinit declaration. Set
1088 TINFO_VAR_DECLARED_CONSTINIT.
1089 (grokdeclarator): Add checking for a declaration with the constinit
1091 * lex.c (init_reswords): Handle D_CXX20.
1092 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
1093 to warning_at. Warn about C++20 keywords.
1094 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
1095 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
1096 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
1098 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
1099 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
1101 (set_and_check_decl_spec_loc): Add "constinit".
1102 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
1103 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
1104 * typeck2.c (store_init_value): If a constinit variable wasn't
1105 initialized using a constant initializer, give an error.
1107 2019-08-28 Nathan Sidwell <nathan@acm.org>
1110 * name-lookup.c (cp_emit_debug_info): Check for builtins during
1113 2019-08-27 Marek Polacek <polacek@redhat.com>
1115 PR c++/81676 - bogus -Wunused warnings in constexpr if.
1116 * semantics.c (maybe_mark_exp_read_r): New function.
1117 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
1119 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
1120 * cp-tree.h (decl_in_std_namespace_p): Declare.
1121 * semantics.c (is_std_constant_evaluated_p): New.
1122 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
1124 * typeck.c (decl_in_std_namespace_p): No longer static.
1126 2019-08-26 Jason Merrill <jason@redhat.com>
1128 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
1130 2019-08-26 Marek Polacek <polacek@redhat.com>
1132 PR c++/91545 - ICE in constexpr store evaluation.
1133 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
1136 2019-08-24 Nathan Sidwell <nathan@acm.org>
1138 * class.c (check_for_overrides): Conversion operators need
1141 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
1143 * semantics.c (finish_switch_cond): Improve error message location.
1145 2019-08-23 Jason Merrill <jason@redhat.com>
1147 * decl2.c (decl_dependent_p): New.
1148 (mark_used): Check it instead of just processing_template_decl.
1150 2019-08-23 Jason Merrill <jason@redhat.com>
1152 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
1155 2019-08-23 Marek Polacek <polacek@redhat.com>
1157 PR c++/91521 - wrong error with operator->.
1158 * decl.c (grokdeclarator): Return error_mark_node for an invalid
1159 trailing return type.
1161 PR c++/79817 - attribute deprecated on namespace.
1162 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
1163 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
1164 (type_is_deprecated): Likewise.
1165 * decl2.c (cp_warn_deprecated_use_scopes): New function.
1166 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
1167 * parser.c (cp_parser_namespace_alias_definition): Call
1168 cp_warn_deprecated_use_scopes.
1169 (cp_parser_using_declaration): Likewise.
1170 (cp_parser_using_directive): Likewise.
1171 * semantics.c (finish_id_expression_1): Likewise.
1173 2019-08-23 Nathan Sidwell <nathan@acm.org>
1175 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
1176 sufficient, reorder DECL_OVERRIDE_P check.
1178 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
1181 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
1182 after determining that the first token is not
1183 PRAGMA_GCC_PCH_PREPROCESS.
1185 2019-08-22 Marek Polacek <polacek@redhat.com>
1187 PR c++/91304 - prefix attributes ignored in condition.
1188 * parser.c (cp_parser_condition): Handle prefix attributes.
1190 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
1193 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
1194 the BUILT_IN_NORMAL block rather than afterward.
1196 2019-08-19 Marek Polacek <polacek@redhat.com>
1198 PR c++/91264 - detect modifying const objects in constexpr.
1199 * constexpr.c (modifying_const_object_error): New function.
1200 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
1201 a const-qualified object after it's been fully constructed.
1202 (modifying_const_object_p): New function.
1203 (cxx_eval_store_expression): Detect modifying a const object
1204 during constant expression evaluation.
1205 (cxx_eval_increment_expression): Use a better location when building
1207 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
1208 object's constructor TREE_READONLY.
1210 2019-08-15 Jason Merrill <jason@redhat.com>
1212 PR c++/90393 - ICE with thow in ?:
1214 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
1215 * tree.c (lvalue_kind): Handle throw in one arm.
1216 * typeck.c (rationalize_conditional_expr): Likewise.
1217 (cp_build_modify_expr): Likewise.
1219 2019-08-14 Jason Merrill <jason@redhat.com>
1221 Implement P0848R3, Conditionally Trivial Special Member Functions.
1222 * tree.c (special_memfn_p): New.
1223 * class.c (add_method): When overloading, hide ineligible special
1225 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1226 * decl.c (grok_special_member_properties): Not here.
1227 * name-lookup.c (push_class_level_binding_1): Move overloaded
1228 functions case down, accept FUNCTION_DECL as target_decl.
1230 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1233 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
1234 complex_literals and make_unique entries.
1236 2019-08-14 Jakub Jelinek <jakub@redhat.com>
1237 Marek Polacek <polacek@redhat.com>
1239 PR c++/91391 - bogus -Wcomma-subscript warning.
1240 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
1241 a deprecated comma here. Pass warn_comma_subscript down to
1242 cp_parser_expression.
1243 (cp_parser_expression): New bool parameter. Warn about uses of a comma
1244 operator within a subscripting expression.
1245 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
1246 (cp_parser_skip_to_closing_square_bracket_1): Remove.
1248 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1250 * name-lookup.c (get_std_name_hint): Add more entries.
1252 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1254 * decl2.c (grok_array_decl): Use the location of the open square
1255 bracket in error message about invalid types.
1257 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1259 * decl.c (grokdeclarator): Check here for typedef a function
1260 definition or a member function definition.
1261 (start_function): Adjust.
1262 (grokmethod): Likewise.
1264 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
1267 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
1268 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
1270 2019-08-13 Marek Polacek <polacek@redhat.com>
1272 PR c++/90473 - wrong code with nullptr in default argument.
1273 * call.c (null_ptr_cst_p): Update quote from the standard.
1274 * decl.c (check_default_argument): Don't return nullptr when the arg
1277 2019-08-13 Marek Polacek <polacek@redhat.com>
1279 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
1281 2019-08-10 Jakub Jelinek <jakub@redhat.com>
1283 * parser.c (cp_parser_omp_clause_name): Parse device_type.
1284 (cp_parser_omp_clause_device_type): New function.
1285 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1286 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1287 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
1288 diagnostics for declare target with clauses nested in clause-less
1289 declare target declaration-definition-seq.
1290 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
1292 2019-08-09 Jakub Jelinek <jakub@redhat.com>
1294 * parser.c (check_no_duplicate_clause): Simplify using
1296 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
1297 directive name modifiers.
1300 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
1301 check_no_duplicate_clause call, instead emit a warning for duplicate
1302 dist_schedule clauses.
1304 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
1306 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
1307 a few error messages.
1309 2019-08-08 Marek Polacek <polacek@redhat.com>
1311 PR c++/87519 - bogus warning with -Wsign-conversion.
1312 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
1315 * constexpr.c (inline_asm_in_constexpr_error): New.
1316 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
1317 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
1319 2019-08-08 Jakub Jelinek <jakub@redhat.com>
1321 * semantics.c (finish_omp_clauses): For C_ORT_OMP
1322 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
1323 instead of generic_head to track duplicates.
1325 2019-08-07 Marek Polacek <polacek@redhat.com>
1327 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
1328 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
1329 when a parameter declaration begins with [[attribute]].
1331 2019-08-07 Marek Polacek <polacek@redhat.com>
1333 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
1334 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
1335 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
1336 * cp-tree.h (finish_asm_stmt): Adjust.
1337 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
1338 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
1340 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
1341 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
1343 2019-08-07 Jakub Jelinek <jakub@redhat.com>
1345 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
1346 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
1347 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
1348 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
1349 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
1350 map or use_device_* clauses.
1351 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
1352 in OpenMP, require pointer or reference to pointer type rather than
1353 pointer or array or reference to pointer or array type. Handle
1354 OMP_CLAUSE_USE_DEVICE_ADDR.
1355 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
1357 2019-08-06 Jason Merrill <jason@redhat.com>
1359 PR c++/91378 - ICE with noexcept and auto return type.
1360 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
1362 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
1364 * decl.c (check_array_designated_initializer): Use
1365 cp_expr_loc_or_input_loc in one place.
1367 2019-08-06 Jakub Jelinek <jakub@redhat.com>
1369 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
1370 clauses and predetermine iterator as lastprivate.
1371 * semantics.c (handle_omp_for_class_iterator): Use
1372 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
1373 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
1374 on OMP_LOOP construct. If a clause is missing for class iterator
1375 on OMP_LOOP, add firstprivate clause, and if there is private
1376 clause, turn it into firstprivate too.
1377 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
1378 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
1379 uses copy ctor instead of default ctor.
1380 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
1382 (cp_fold_r): Likewise.
1383 (cp_genericize_r): Likewise.
1384 (cxx_omp_finish_clause): Also finish lastprivate clause with
1385 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
1386 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
1387 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
1388 clauses and predetermine iterator as lastprivate.
1389 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
1390 like OMP_DISTRIBUTE etc.
1392 2019-08-05 Marek Polacek <polacek@redhat.com>
1394 DR 2413 - typename in conversion-function-ids.
1395 * parser.c (cp_parser_conversion_type_id): Call
1396 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
1397 instead of CP_PARSER_FLAGS_NONE.
1399 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
1401 * cp-tree.h (cp_expr_loc_or_input_loc): New.
1402 (cxx_incomplete_type_diagnostic): Use it.
1403 * call.c (build_converted_constant_expr_internal, convert_like_real,
1404 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
1405 build_cxx_call, perform_implicit_conversion_flags,
1406 initialize_reference): Likewise.
1407 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
1408 eval_and_check_array_index, cxx_eval_store_expression,
1409 cxx_eval_statement_list, cxx_eval_loop_expr,
1410 cxx_eval_constant_expression, potential_constant_expression_1):
1412 * constraint.cc (check_for_logical_overloads,
1413 satisfy_predicate_constraint): Likewise.
1414 * cp-gimplify.c (cp_gimplify_expr): Likewise.
1415 * cvt.c (cp_convert_to_pointer, convert_to_reference,
1416 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
1417 * decl.c (pop_switch): Likewise.
1418 * decl2.c (delete_sanity): Likewise.
1419 * error.c (location_of): Likewise.
1420 * init.c (maybe_warn_list_ctor, build_aggr_init,
1421 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
1422 * lex.c (unqualified_name_lookup_error): Likewise.
1423 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
1425 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
1426 unify_arg_conversion, convert_nontype_argument,
1427 tsubst_copy_and_build, resolve_typename_type): Likewise.
1428 * semantics.c (maybe_convert_cond, finish_call_expr,
1429 cp_build_vec_convert): Likewise.
1430 * typeck.c (decay_conversion, rationalize_conditional_expr,
1431 cp_build_unary_op, build_x_compound_expr_from_list,
1432 maybe_warn_about_returning_address_of_local,
1433 maybe_warn_pessimizing_move): Likewise.
1434 * typeck2.c (check_narrowing, digest_init_r,
1435 process_init_constructor_array): Likewise.
1437 2019-08-05 Tom Honermann <tom@honermann.net>
1439 * parser.c (cp_parser_template_declaration_after_parameters): Enable
1440 class template argument deduction for non-type template parameters
1441 in literal operator templates.
1443 2019-08-05 Marek Polacek <polacek@redhat.com>
1445 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
1446 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
1447 of a comma operator within a subscripting expression.
1448 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
1450 (cp_parser_skip_to_closing_square_bracket): ...this.
1452 2019-08-05 Jason Merrill <jason@redhat.com>
1454 * semantics.c (force_paren_expr): Preserve location.
1456 2019-08-02 Marek Polacek <polacek@redhat.com>
1458 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
1459 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
1460 inside a template function value-dependent.
1462 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
1464 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
1465 applied to a constructor.
1467 2019-08-02 Martin Liska <mliska@suse.cz>
1469 * decl.c (grok_op_properties):
1470 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
1472 2019-08-01 Martin Sebor <msebor@redhat.com>
1475 * decl.c (reshape_init_array_1): Avoid truncating initializer
1476 lists containing string literals.
1478 2019-08-01 Marek Polacek <polacek@redhat.com>
1480 PR c++/90805 - detect narrowing in case values.
1481 * decl.c (case_conversion): Detect narrowing in case values.
1483 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
1485 * decl2.c (delete_sanity): Improve diagnostic locations, use
1486 cp_expr_loc_or_loc in four places.
1488 2019-07-31 Jason Merrill <jason@redhat.com>
1490 PR c++/90538 - multiple expansions of capture packs
1491 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1492 * lambda.c (add_capture): Copy parameter packs from init.
1493 (lambda_capture_field_type): Always use auto for init-capture.
1494 * pt.c (uses_parameter_packs): Return tree.
1495 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
1496 (gen_elem_of_pack_expansion_instantiation): Don't push
1497 local_specialization_stack.
1498 (prepend_one_capture): New.
1499 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
1500 (do_auto_deduction): Avoid redundant error.
1502 Fix copy_node of TEMPLATE_INFO.
1503 * cp-tree.h (struct tree_template_info): Use tree_base instead of
1504 tree_common. Add tmpl and args fields.
1505 (TI_TEMPLATE, TI_ARGS): Adjust.
1507 2019-07-30 Martin Liska <mliska@suse.cz>
1509 PR tree-optimization/91270
1510 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
1511 of delete operator as needed.
1513 2019-07-25 Martin Liska <mliska@suse.cz>
1514 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
1517 * decl.c (cxx_init_decl_processing): Mark delete operators
1518 with DECL_SET_IS_OPERATOR_DELETE.
1520 2019-07-25 Martin Liska <mliska@suse.cz>
1522 * decl.c (duplicate_decls): Use new macros
1523 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
1524 (cxx_init_decl_processing): Likewise.
1525 (grok_op_properties): Likewise.
1526 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
1528 2019-07-24 Martin Sebor <msebor@redhat.com>
1531 * decl.c (finish_function): Use lang_mask.
1533 2019-07-20 Jason Merrill <jason@redhat.com>
1535 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
1536 introduced by a using-declaration.
1538 2019-07-20 Jason Merrill <jason@redhat.com>
1540 Reduce memory consumption for push/pop_access_scope.
1541 * name-lookup.c (leave_scope): Do add class levels other than
1542 previous_class_level to free_binding_level.
1543 (invalidate_class_lookup_cache): Move from class.c, add to
1545 * pt.c (saved_access_scope): Change from list to vec.
1547 2019-07-20 Jakub Jelinek <jakub@redhat.com>
1549 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
1550 instead of OMP_LOOP_CHECK.
1551 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
1552 (cp_parser_omp_clause_bind): New function.
1553 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
1554 (OMP_LOOP_CLAUSE_MASK): Define.
1555 (cp_parser_omp_loop): New function.
1556 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
1557 loop combined with parallel or teams.
1558 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
1559 (cp_parser_pragma): Likewise.
1560 * pt.c (tsubst_expr): Handle OMP_LOOP.
1561 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
1563 2019-07-19 Jason Merrill <jason@redhat.com>
1565 PR c++/90101 - dependent class non-type parameter.
1566 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
1568 2019-07-18 Jason Merrill <jason@redhat.com>
1570 PR c++/90098 - partial specialization and class non-type parms.
1573 * call.c (build_converted_constant_expr_internal): Don't copy.
1574 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
1575 around class non-type parameter.
1576 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
1578 2019-07-16 Jason Merrill <jason@redhat.com>
1580 * parser.c (make_location): Add overload taking cp_lexer* as last
1583 * parser.c (cp_parser_simple_type_specifier): Separate tentative
1584 parses for optional type-spec and CTAD.
1586 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
1587 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
1589 2019-07-12 Jakub Jelinek <jakub@redhat.com>
1591 * parser.c (cp_parser_omp_clause_name): Handle order clause.
1592 (cp_parser_omp_clause_order): New function.
1593 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
1594 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
1595 PRAGMA_OMP_CLAUSE_ORDER.
1596 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
1597 * pt.c (tsubst_omp_clauses): Likewise.
1599 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
1601 * decl.c (get_type_quals,
1602 smallest_type_location (const cp_decl_specifier_seq*)): New.
1603 (check_tag_decl): Use smallest_type_location in error_at about
1604 multiple types in one declaration.
1605 (grokdeclarator): Use locations[ds_complex] in error_at about
1606 complex invalid; use locations[ds_storage_class] in error_at
1607 about static cdtor; use id_loc in error_at about flexible
1608 array member in union; use get_type_quals.
1610 2019-07-09 Martin Sebor <msebor@redhat.com>
1613 * cp-tree.h: Change class-key of PODs to struct and others to class.
1615 * semantics.c (finalize_nrv_r): Same.
1617 2019-07-09 Martin Sebor <msebor@redhat.com>
1620 * constexpr.c (cxx_eval_call_expression): Change class-key from class
1621 to struct and vice versa to match convention and avoid -Wclass-is-pod
1622 and -Wstruct-no-pod.
1623 * constraint.cc (get_concept_definition): Same.
1625 * cxx-pretty-print.h: Same.
1627 * logic.cc (term_list::replace): Same.
1628 * name-lookup.c (find_local_binding): Same.
1629 * pt.c (tsubst_binary_right_fold): Same.
1630 * search.c (field_accessor_p): Same.
1631 * semantics.c (expand_or_defer_fn): Same.
1633 2019-07-08 Jakub Jelinek <jakub@redhat.com>
1636 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
1637 error_mark_node type.
1639 2019-07-05 Jakub Jelinek <jakub@redhat.com>
1643 * call.c (build_new_method_call_1): Remove set but not used variable
1646 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
1648 PR c++/67184 (again)
1650 * call.c (build_over_call): Devirtualize user-defined operators
1651 coming from a base too.
1652 (build_new_method_call_1): Do not devirtualize here.
1654 2019-07-04 Marek Polacek <polacek@redhat.com>
1657 PR c++/83374 - __is_standard_layout wrong for a class with repeated
1659 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
1660 CLASSTYPE_REPEATED_BASE_P is true.
1662 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
1664 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
1665 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
1666 * decl2.c (cp_omp_mappable_type): Move contents to ...
1667 (cp_omp_mappable_type_1): ... here and add note output.
1668 (cp_omp_emit_unmappable_type_notes): New function.
1669 * semantics.c (finish_omp_clauses): Call
1670 cp_omp_emit_unmappable_type_notes in four places.
1672 2019-07-03 Martin Liska <mliska@suse.cz>
1674 * call.c (build_new_op_1): Remove dead assignemts.
1675 * typeck.c (cp_build_binary_op): Likewise.
1677 2019-06-27 Jason Merrill <jason@redhat.com>
1679 PR c++/55442 - memory-hog with highly recursive constexpr.
1680 * constexpr.c (push_cx_call_context): Return depth.
1681 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
1683 2019-06-27 Jan Hubicka <jh@suse.cz>
1685 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
1688 2019-06-27 Martin Liska <mliska@suse.cz>
1690 * class.c (adjust_clone_args): Remove obviously
1692 (dump_class_hierarchy_r): Likewise.
1693 * decl.c (check_initializer): Likewise.
1694 * parser.c (cp_parser_lambda_expression): Likewise.
1695 * pt.c (unify_bound_ttp_args): Likewise.
1696 (convert_template_argument): Likewise.
1697 * rtti.c (build_headof): Likewise.
1698 * typeck.c (convert_for_initialization): Likewise.
1700 2019-06-25 Jason Merrill <jason@redhat.com>
1702 PR c++/70462 - unnecessary base ctor variant with final.
1703 * optimize.c (populate_clone_array): Skip base variant if
1705 (maybe_clone_body): We don't need an alias if we are only defining
1708 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
1710 2019-06-25 Jakub Jelinek <jakub@redhat.com>
1713 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
1714 vector type if lval.
1716 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
1718 * lex.c (init_reswords): Create keyword for "__intN__" type.
1719 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
1720 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
1721 C incompatibility if alternate "__intN__" form is used.
1722 * parser.c (cp_parser_simple_type_specifier): Set
1723 decl_specs->int_n_alt if "__intN__" form is used.
1725 2019-06-24 Jan Hubicka <jh@suse.cz>
1727 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
1729 2019-06-24 Jason Merrill <jason@redhat.com>
1731 * class.c (layout_class_type): Don't use a separate
1732 CLASSTYPE_AS_BASE if it's the same size.
1734 2019-06-23 Marek Polacek <polacek@redhat.com>
1736 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
1738 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
1739 instead of tree_default_arg.
1740 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
1741 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
1742 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
1743 tree_default_arg to tree_deferred_parse.
1744 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1745 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
1746 TS_CP_DEFERRED_PARSE.
1747 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
1748 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
1749 of TS_CP_DEFAULT_ARG.
1750 (defarg_location): Remove declaration.
1751 (defparse_location): Add declaration.
1752 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1753 Call defparse_location instead of defarg_location.
1754 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1755 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
1756 of TS_CP_DEFAULT_ARG.
1757 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1758 * error.c (dump_expr): Likewise.
1759 (location_of): Likewise.
1760 * init.c (get_nsdmi): Likewise.
1761 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
1762 instead of DEFARG_TOKENS.
1763 (cp_parser_late_noexcept_specifier): Likewise.
1764 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
1766 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
1767 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
1768 DEFARG_INSTANTIATIONS.
1769 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1770 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
1771 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
1772 (defparse_location): Renamed from defarg_location.
1773 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
1775 (tsubst_arg_types): Likewise.
1776 (dependent_type_p_r): Likewise.
1777 * tree.c (cp_tree_equal): Likewise.
1778 (cp_walk_subtrees): Likewise.
1779 * typeck.c (convert_arguments): Likewise.
1781 2019-06-22 Marek Polacek <polacek@redhat.com>
1783 PR c++/86476 - noexcept-specifier is a complete-class context.
1785 * cp-tree.def (DEFAULT_ARG): Update commentary.
1786 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
1787 (tree_default_arg): Use tree_base instead of tree_common.
1788 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
1789 * decl.c (do_push_parm_decls): New function, broken out of...
1790 (store_parm_decls): ...here. Call it.
1791 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
1792 * parser.c (cp_parser_noexcept_specification_opt,
1793 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
1795 (unparsed_noexcepts): New macro.
1796 (push_unparsed_function_queues): Update initializer.
1797 (cp_parser_direct_declarator): Pass FRIEND_P to
1798 cp_parser_exception_specification_opt.
1799 (inject_parm_decls): New.
1800 (pop_injected_parms): New.
1801 (cp_parser_class_specifier_1): Implement delayed parsing of
1802 noexcept-specifiers.
1803 (cp_parser_save_noexcept): New.
1804 (cp_parser_late_noexcept_specifier): New.
1805 (noexcept_override_late_checks): New.
1806 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
1807 cp_parser_save_noexcept instead of the normal processing if needed.
1808 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
1809 pass it to cp_parser_noexcept_specification_opt.
1810 (cp_parser_save_member_function_body): Fix comment.
1811 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
1813 (cp_parser_transaction): Update call to
1814 cp_parser_noexcept_specification_opt.
1815 (cp_parser_transaction_expression): Likewise.
1816 * parser.h (cp_unparsed_functions_entry): Add new field to carry
1817 a noexcept-specifier.
1818 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
1819 * search.c (maybe_check_overriding_exception_spec): New function, broken
1821 (check_final_overrider): ...here. Call
1822 maybe_check_overriding_exception_spec.
1823 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
1824 (cp_tree_equal): Handle DEFAULT_ARG.
1826 PR c++/90881 - bogus -Wunused-value in unevaluated context.
1827 * cvt.c (convert_to_void): Don't emit unused warnings in
1828 an unevaluated context.
1830 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
1832 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
1833 locations[ds_storage_class] in a few additional places.
1835 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
1839 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
1843 * call.c (build_over_call): Devirtualize when the final overrider
1844 comes from the base.
1846 2019-06-21 Marek Polacek <polacek@redhat.com>
1848 PR c++/61490 - qualified-id in friend function definition.
1849 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
1850 definition. Improve location for diagnostics of friend functions.
1852 PR c++/60223 - ICE with T{} in non-deduced context.
1853 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
1855 PR c++/64235 - missing syntax error with invalid alignas.
1856 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
1857 if there's a missing close paren.
1859 PR c++/90490 - fix decltype issues in noexcept-specifier.
1860 * except.c (build_noexcept_spec): Call
1861 instantiate_non_dependent_expr_sfinae before
1862 build_converted_constant_expr instead of calling
1863 instantiate_non_dependent_expr after it. Add
1864 processing_template_decl_sentinel.
1866 2019-06-21 Jakub Jelinek <jakub@redhat.com>
1869 * semantics.c (finish_omp_clauses): Don't reject references to
1870 incomplete types if processing_template_decl.
1872 2019-06-19 Marek Polacek <polacek@redhat.com>
1874 PR c++/60364 - noreturn after first decl not diagnosed.
1875 * decl.c (duplicate_decls): Give an error when a function is
1876 declared [[noreturn]] after its first declaration.
1877 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
1878 attribute as equivalent to GNU's.
1879 * tree.c (std_attribute_table): Add noreturn.
1881 2019-06-19 Jakub Jelinek <jakub@redhat.com>
1883 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
1884 like OMP_CLAUSE_SHARED.
1886 2019-06-18 Jason Merrill <jason@redhat.com>
1888 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
1890 2019-06-18 Jason Merrill <jason@redhat.com>
1892 * constexpr.c (eval_and_check_array_index): Split out from...
1893 (cxx_eval_array_reference): ...here.
1894 (cxx_eval_store_expression): Use it here, too.
1895 (diag_array_subscript): Take location. Strip location wrapper.
1897 2019-06-18 Jason Merrill <jason@redhat.com>
1899 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
1900 and then to the same type.
1902 2019-06-18 Jason Merrill <jason@redhat.com>
1904 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
1906 2019-06-17 Jakub Jelinek <jakub@redhat.com>
1908 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
1909 set need_copy_assignment.
1911 2019-06-17 Marek Polacek <polacek@redhat.com>
1913 PR c++/83820 - excessive attribute arguments not detected.
1914 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
1916 2019-06-17 Nathan Sidwell <nathan@acm.org>
1919 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
1922 2019-06-14 Marek Polacek <polacek@redhat.com>
1924 PR c++/90884 - stray note with -Wctor-dtor-privacy.
1925 * class.c (maybe_warn_about_overly_private_class): Guard the call to
1928 2019-06-12 Jason Merrill <jason@redhat.com>
1930 PR c++/85552 - wrong instantiation of dtor for DMI.
1931 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
1933 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
1935 * decl.c (grokdeclarator): Use id_loc in five additional places
1936 in the last part of the function.
1938 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
1940 * decl.c (grokdeclarator): Move further up the declaration of
1941 id_loc, use it immediately, update its value after the loop
1942 over declarator, use it again in the final part of function;
1943 improve locations of error messages about multiple data types
1944 and conflicting specifiers.
1946 2019-06-13 Richard Biener <rguenther@suse.de>
1949 * typeck2.c (split_nonconstant_init_1): Properly count
1950 num_split_elts, optimize single constructor elt removal.
1952 2019-06-12 Marek Polacek <polacek@redhat.com>
1954 PR c++/66999 - 'this' captured by reference.
1955 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
1956 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
1958 PR c++/90825 - endless recursion when evaluating sizeof.
1959 PR c++/90832 - endless recursion when evaluating sizeof.
1960 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
1961 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
1962 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
1963 is instantiation-dependent.
1965 PR c++/90736 - bogus error with alignof.
1966 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
1968 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
1970 PR c++/90449 - add -Winaccessible-base option.
1971 * class.c (warn_about_ambiguous_bases): Changed name to:
1972 maybe_warn_about_inaccessible_bases.
1973 (maybe_warn_about_inaccessible_bases): Implemented new
1974 Winaccessible-base warning option for both direct and virtual
1976 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
1979 2019-06-11 Richard Biener <rguenther@suse.de>
1982 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
1983 from CONSTRUCTOR by marking to remove elements and doing all
1984 of them in a O(n) scan.
1986 2019-06-11 Jakub Jelinek <jakub@redhat.com>
1989 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
1990 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
1992 2019-06-11 Martin Liska <mliska@suse.cz>
1995 * pt.c (init_template_processing): Disable hash table
1996 sanitization for decl_specializations and type_specializations.
1998 2019-06-10 Jason Merrill <jason@redhat.com>
2000 * constexpr.c (free_constructor): New.
2001 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
2003 * constexpr.c (unshare_constructor): Only unshare if T is itself a
2005 (cxx_eval_call_expression): Don't call it on the result here.
2007 Reduce constexpr_call memory consumption.
2008 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
2010 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
2011 (cxx_eval_call_expression): Adjust.
2013 2019-06-10 Jakub Jelinek <jakub@redhat.com>
2015 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
2017 (cp_parser_omp_scan_loop_body): New function.
2018 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
2019 are inscan reduction clauses.
2020 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
2021 * semantics.c (finish_omp_clauses): Reject mixing inscan with
2022 non-inscan reductions on the same construct, or inscan reductions with
2023 ordered or schedule clauses, or inscan array reductions.
2024 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
2025 (tsubst_expr): Handle OMP_SCAN.
2027 2019-06-07 Jason Merrill <jason@redhat.com>
2029 * constexpr.c (cxx_eval_constant_expression): Call
2030 STRIP_ANY_LOCATION_WRAPPER early.
2031 [CONVERT_EXPR]: Don't build anything for conversion to void.
2032 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
2034 2019-06-05 Martin Sebor <msebor@redhat.com>
2037 * typeck.c (maybe_warn_about_returning_address_of_local): Only
2038 consider functions returning pointers as candidates for
2039 -Wreturn-local-addr.
2041 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2043 * decl.c (smallest_type_location): New.
2044 (check_special_function_return_type): Use it.
2045 (grokdeclarator): Lkewise.
2047 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2049 * decl.c (grokdeclarator): Use locations[ds_friend]
2052 2019-06-05 Martin Sebor <msebor@redhat.com>
2054 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
2055 (convert_like_real): Same.
2056 (convert_arg_to_ellipsis): Same.
2057 * constexpr.c (diag_array_subscript): Same.
2058 * constraint.cc (diagnose_trait_expression): Same.
2059 * cvt.c (ocp_convert): Same.
2060 * decl.c (start_decl): Same.
2061 (check_for_uninitialized_const_var): Same.
2063 (check_special_function_return_type): Same.
2064 (finish_enum_value_list): Same.
2065 (start_preparsed_function): Same.
2066 * parser.c (cp_parser_decl_specifier_seq): Same.
2067 * typeck.c (cp_build_binary_op): Same.
2068 (build_static_cast_1): Same.
2070 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
2072 PR c++/63149 - Wrong auto deduction from braced-init-list.
2073 * pt.c (listify_autos): use non cv qualified auto_node in
2074 std::initializer_list<auto>.
2076 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
2078 * decl.c (grokdeclarator): Use declarator->id_loc in two
2081 2019-06-04 Nathan Sidwell <nathan@acm.org>
2083 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
2084 and namespace scopes separately.
2086 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
2088 PR c++/60531 - Wrong error about unresolved overloaded function
2089 * typeck.c (cp_build_binary_op): See if overload can be resolved.
2090 (cp_build_unary_op): Ditto.
2092 2019-06-04 Jason Merrill <jason@redhat.com>
2094 Reduce accumulated garbage in constexpr evaluation.
2095 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
2097 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
2100 2019-06-04 Jakub Jelinek <jakub@redhat.com>
2102 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
2103 instead of only up to linear.
2105 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
2107 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
2110 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2113 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
2115 2019-05-31 Nathan Sidwell <nathan@acm.org>
2117 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
2119 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
2120 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
2121 (make_lambda_name): Don't declare.
2122 * error.c (dump_aggr_type): Check for lambdas before other
2124 * lambda.c (begin_lambda_type): Use make_anon_name.
2125 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
2126 * mangle.c (write_local_name): Likewise.
2127 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
2129 2019-05-30 Marek Polacek <polacek@redhat.com>
2131 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
2133 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
2135 * decl.c (grokdeclarator): Use declarator->id_loc in five
2138 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2141 * tree.c (lvalue_kind): Return clk_none for expressions with
2144 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
2147 * parser.c (cp_parser_sizeof_operand): When the type-id production
2148 did not work out commit to the tentative parse.
2150 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2152 P1091R3 - Extending structured bindings to be more like var decls
2153 P1381R1 - Reference capture of structured bindings
2154 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
2156 (cp_finish_decomp): Copy over various decl properties from decl to
2157 v[i] in the tuple case.
2158 (grokdeclarator): Allow static, thread_local and __thread for C++2a
2159 and use pedwarn instead of error for older standard revisions.
2160 Make other structured binding diagnostic messages more i18n friendly.
2162 2019-05-28 Nathan Sidwell <nathan@acm.org>
2164 * decl.c (duplicate_decls): Assert a template newdecl has no
2167 2019-05-28 Marek Polacek <polacek@redhat.com>
2169 PR c++/90548 - ICE with generic lambda and empty pack.
2170 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
2172 2019-05-28 Nathan Sidwell <nathan@acm.org>
2174 * cp-tree.h (make_anon_name): Drop declaration.
2175 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
2176 * cp-lang.c (cxx_dwarf_name): Likewise.
2177 * class.c (find_flexarrays): Likewise.
2178 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
2179 * error.c (dump_aggr_type): Likewise.
2180 * pt.c (push_template_decl_real): Likewise.
2181 * name-lookup.c (consider_binding_level): Likewise.
2182 (anon_cnt, make_anon_name): Delete.
2184 2019-05-25 Marek Polacek <polacek@redhat.com>
2186 PR c++/90572 - wrong disambiguation in friend declaration.
2187 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
2188 typename for friend declarations.
2190 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
2192 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
2194 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
2195 was resolved by r254694.
2197 2019-05-22 Jason Merrill <jason@redhat.com>
2199 PR c++/20408 - unnecessary code for empty struct.
2200 * call.c (build_call_a): Use simple_empty_class_p.
2202 PR c++/86485 - -Wmaybe-unused with empty class ?:
2203 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
2205 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2207 * parser.c (cp_parser_template_declaration_after_parameters): Use
2208 DECL_SOURCE_LOCATION in literal operator template errors.
2210 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2214 * call.c (build_over_call): Devirtualize when the final overrider
2215 comes from the base.
2217 2019-05-21 Nathan Sidwell <nathan@acm.org>
2219 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
2220 parameter. Document.
2221 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
2222 calls. Remove stray FIXME comment.
2224 * name-lookup.h (struct cp_binding_level): Drop usings field.
2225 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
2226 (finish_nonmember_using_decl): ... this.
2227 * name-lookup.c (push_using_decl_1, push_using_decl):
2228 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
2229 (validate_nonmember_using_decl, finish_namespace_using_decl)
2230 (finish_local_using_decl): Replace with ...
2231 (finish_nonmember_using_decl): ... this. Drop DECL parm.
2232 * parser.c (cp_parser_using_declaration): Don't do lookup here.
2233 * pt.c (tsubst_expr): Do not do using decl lookup here.
2235 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
2237 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
2239 2019-05-20 Marek Polacek <polacek@redhat.com>
2241 CWG 2094 - volatile scalars are trivially copyable.
2243 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
2246 2019-05-20 Marek Polacek <polacek@redhat.com>
2248 * pt.c (convert_template_argument): Add a diagnostic for the
2249 [temp.arg]/2 ambiguity case.
2251 * name-lookup.c (finish_using_directive): Don't issue inform() if the
2252 warning didn't trigger. Add quoting. Tweak the inform message.
2254 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
2256 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
2258 2019-05-20 Nathan Sidwell <nathan@acm.org>
2260 * name-lookup.c (finish_namespace_using_directive)
2261 (finish_local_using_directive): Merge to ...
2262 (finish_using_directive): ... here. Handle both contexts.
2263 * name-lookup.h (finish_namespace_using_directive)
2264 (finish_local_using_directive): Replace with ...
2265 (finish_using_directive): ... this.
2266 * parser.c (cp_parser_using_directive): Adjust.
2267 * pt.c (tsubst_expr): Likewise.
2269 * cp-tree.h (struct lang_decl_ns): Remove usings field.
2270 (DECL_NAMESPACE_USING): Delete.
2271 * name-lookup.c (name_lookup::search_usings): Use namespace's
2273 (name_lookup::queue_namespae): Likewise.
2274 (finish_namespace_using_directive, push_namespace): Likewise.
2275 (has_using_namespace_std_directive): Just search the entire
2278 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
2280 PR c++/90532 Ensure __is_constructible(T[]) is false
2281 * method.c (is_xible_helper): Return error_mark_node for construction
2282 of an array of unknown bound.
2284 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
2287 * parser.c (cp_finalize_oacc_routine): Rework checking if already
2288 marked with an OpenACC 'routine' directive.
2291 * parser.c (cp_parser_oacc_routine)
2292 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
2293 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
2296 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
2297 clauses from "omp declare target" attribute.
2299 2019-05-16 Martin Sebor <msebor@redhat.com>
2301 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
2303 (print_z_candidates): Same.
2304 (build_conditional_expr_1): Quote keywords, operators, and types
2306 (build_op_delete_call): Same.
2307 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
2309 (convert_like_real): Same.
2310 (convert_arg_to_ellipsis): Quote keywords, operators, and types
2312 (build_over_call): Same.
2313 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
2315 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
2316 (cxx_eval_constant_expression): Quote keywords, operators, and types
2318 (potential_constant_expression_1): Same.
2319 * cp-gimplify.c (cp_genericize_r): Same.
2320 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
2322 (type_promotes_to): Same.
2323 * decl.c (check_previous_goto_1): Same.
2326 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
2327 (grok_op_properties): Quote keywords, operators, and types
2329 * decl2.c (grokfield): Same.
2330 (coerce_delete_type): Same.
2331 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
2332 * friend.c (do_friend): Quote C++ tokens.
2333 * init.c (build_new_1): Quote keywords, operators, and types
2335 (build_vec_delete_1): Same.
2336 (build_delete): Same.
2337 * lex.c (parse_strconst_pragma): Same.
2338 (handle_pragma_implementation): Same.
2339 (unqualified_fn_lookup_error): Same.
2340 * mangle.c (write_type): Same.
2341 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
2342 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
2343 (pop_everything): Same.
2344 * parser.c (cp_lexer_start_debugging): Quote a macro name.
2346 (cp_lexer_stop_debugging): Same.
2347 (cp_parser_userdef_numeric_literal): Quote a C++ header name
2349 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
2350 and types in diagnostics.
2351 (cp_parser_question_colon_clause): Same.
2352 (cp_parser_asm_definition): Same.
2353 (cp_parser_init_declarator): Same.
2354 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
2355 a sentence in a diagnostic.
2356 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
2358 (cp_parser_transaction): Same.
2359 * pt.c (maybe_process_partial_specialization): Replace second call
2360 to permerror with inform for consistency with other uses.
2361 (expand_integer_pack): Quote keywords, operators, and types
2363 * rtti.c (get_typeid): Quote keywords, operators, and types
2365 (build_dynamic_cast_1): Same.
2366 * semantics.c (finish_asm_stmt): Same.
2367 (finish_label_decl): Same.
2368 (finish_bases): Same.
2369 (finish_offsetof): Same.
2370 (cp_check_omp_declare_reduction): Same.
2371 (finish_decltype_type): Same.
2372 * tree.c (handle_init_priority_attribute): Same. Add detail
2374 (maybe_warn_zero_as_null_pointer_constant): Same.
2375 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
2377 (cp_build_unary_op): Same.
2378 (check_for_casting_away_constness): Same.
2379 (build_static_cast): Same.
2380 (build_const_cast_1): Same.
2381 (maybe_warn_about_returning_address_of_local): Same.
2382 (check_return_expr): Same.
2383 * typeck2.c (abstract_virtuals_error_sfinae): Same.
2384 (digest_init_r): Replace a tab with spaces in a diagnostic.
2385 (build_functional_cast): Quote keywords, operators, and types
2388 2019-05-15 Jakub Jelinek <jakub@redhat.com>
2391 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
2392 before the condition (or if missing or constant non-zero at the end
2393 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
2394 if any. Don't call protected_set_expr_location on incr if it already
2397 2019-05-15 Marek Polacek <polacek@redhat.com>
2399 CWG 2096 - constraints on literal unions.
2400 * class.c (check_field_decls): Initialize booleans directly. A union
2401 is literal if at least one of its non-static data members is of
2402 non-volatile literal type.
2404 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2406 * cp-tree.h (REFERENCE_VLA_OK): Remove.
2407 * lambda.c (build_capture_proxy): Remove use of the above.
2409 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2411 * call.c (perform_overload_resolution, build_new_method_call_1):
2412 Use OVL_P; remove redundant TEMPLATE_DECL checks.
2413 * decl.c (grokfndecl): Likewise.
2414 * mangle.c (write_expression): Likewise.
2415 * parser.c (cp_parser_template_id): Likewise.
2416 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
2418 * search.c (build_baselink): Likewise.
2419 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
2421 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
2423 PR preprocessor/90382
2424 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2427 2019-05-13 Jason Merrill <jason@redhat.com>
2429 Use releasing_vec more broadly.
2430 * cp-tree.h (struct releasing_vec): Replace get_ref method with
2432 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
2433 Forwarding functions for releasing_vec.
2434 (release_tree_vector): Declare but don't define.
2435 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
2436 (perform_direct_initialization_if_possible): Use releasing_vec.
2437 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
2439 * cp-gimplify.c (cp_fold): Likewise.
2440 * cvt.c (force_rvalue, ocp_convert): Likewise.
2441 * decl.c (get_tuple_decomp_init): Likewise.
2442 * except.c (build_throw): Likewise.
2443 * init.c (perform_member_init, expand_default_init): Likewise.
2444 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
2445 * parser.c (cp_parser_userdef_char_literal)
2446 (cp_parser_userdef_numeric_literal)
2447 (cp_parser_userdef_string_literal)
2448 (cp_parser_perform_range_for_lookup)
2449 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
2450 (cp_parser_omp_for_loop_init): Likewise.
2451 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
2452 * semantics.c (calculate_direct_bases, calculate_bases)
2453 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
2454 (finish_omp_taskyield, finish_omp_cancel)
2455 (finish_omp_cancellation_point): Likewise.
2456 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
2457 (build_min_non_dep_op_overload): Likewise.
2458 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
2459 (cp_build_modify_expr): Likewise.
2460 * typeck2.c (build_functional_cast): Likewise.
2462 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
2464 * typeck.c (cp_build_function_call_vec): When mark_used fails
2465 unconditionally return error_mark_node.
2467 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
2469 * decl.c (grokvardecl): Use an accurate location in error message
2470 about main as a global variable.
2472 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
2474 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
2475 * cp-gimplify.c (cp_fold): Likewise.
2476 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
2477 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
2478 * cvt.c (perform_qualification_conversions): Likewise.
2479 * decl.c (grokdeclarator): Likewise.
2480 * decl2.c (build_memfn_type): Likewise.
2481 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
2482 * parser.c (cp_parser_omp_declare_reduction): Likewise.
2483 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
2484 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
2485 * rtti.c (ptr_initializer): Likewise.
2486 * semantics.c (finish_asm_stmt, finish_offsetof,
2487 cp_check_omp_declare_reduction): Likewise.
2488 * tree.c (cp_build_qualified_type_real,
2489 cp_build_type_attribute_variant, cxx_type_hash_eq,
2490 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
2491 * typeck.c (structural_comptypes, convert_arguments,
2492 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
2493 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
2496 2019-05-10 Marek Polacek <polacek@redhat.com>
2498 PR c++/78010 - bogus -Wsuggest-override warning on final function.
2499 * class.c (check_for_override): Don't warn for final functions.
2501 2019-05-10 Jakub Jelinek <jakub@redhat.com>
2504 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
2505 c-family/c-cppbuiltin.c.
2507 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
2511 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2513 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2516 2019-05-08 Nathan Sidwell <nathan@acm.org>
2518 Kill DECL_SAVED_FUNCTION_DATA .
2519 * cp-tree.h (language_function): Remove x_auto_return_pattern.
2520 (current_function_auto_return_pattern): Delete.
2521 (lang_decl_fn): Replace saved_language_function with
2522 saved_auto_return type.
2523 (DECL_SAVED_FUNCTION_DATA): Delete.
2524 (DECL_SAVED_AUTO_RETURN_TYPE): New.
2525 (FNDECL_USED_AUTO): Correct documentation.
2526 * decl.c (duplicate_decls): Adjust AUTO return handling.
2527 (start_preparsed_function): Replace
2528 current_function_auto_return_pattern with
2529 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
2531 (finish_function): Likewise.
2532 (save_function_data): Delete.
2533 (fndecl_declared_return_type): Reimplement.
2534 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
2535 * method.c (make_thunk, make_alias_for): Likewise.
2536 * parser.c (cp_parser_jump_statement): Likewise.
2537 * pt.c (do_auto_deduction): Likewise.
2538 * typeck.c (check_return_expr): Likewise.
2540 2019-05-06 Jason Merrill <jason@redhat.com>
2542 PR c++/90171 - reorganize usual_deallocation_fn_p
2543 * call.c (struct dealloc_info): New.
2544 (usual_deallocation_fn_p): Take a dealloc_info*.
2545 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
2546 (build_op_delete_call): Adjust.
2548 2019-05-07 Jason Merrill <jason@redhat.com>
2550 PR c++/86485 - -Wmaybe-unused with empty class ?:
2551 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
2553 * pt.c (type_dependent_expression_p): A non-type template parm with
2554 a placeholder type is type-dependent.
2556 2019-05-06 Marek Polacek <polacek@redhat.com>
2558 PR c++/90265 - ICE with generic lambda.
2559 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
2560 element in the vector.
2562 2019-05-03 Martin Liska <mliska@suse.cz>
2564 * call.c (build_aggr_conv): Use is_empty instead of
2565 elements () == 0 (and similar usages).
2566 * parser.c (cp_parser_lambda_introducer): Likewise.
2568 2019-05-02 Nathan Sidwell <nathan@acm.org>
2570 * semantics.c (finish_id_expression_1): Remove unreachable code.
2572 2019-05-01 Nathan Sidwell <nathan@acm.org>
2574 * name-lookup.h (get_class_binding_direct): Change final arg to
2576 (get_class_binding): Likewise.
2577 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
2578 arg with WANT_TYPE bool. Simplify.
2579 (get_class_binding): Adjust final arg.
2580 * decl.c (reshape_init_class): Adjust get_class_binding calls.
2582 2019-04-30 Nathan Sidwell <nathan@acm.org>
2584 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
2585 nodes. Call c_common_init_ts.
2587 2019-04-29 Nathan Sidwell <nathan@acm.org>
2589 * decl.c (duplicate_decls): Add whitespace, move comments into
2591 * method.c (explain_implicit_non_constexpr): Refactor.
2592 * pt.c (check_explicit_specialization): Fix indentation.
2593 * semantics.c (process_outer_var_ref): Reformat.
2594 (finish_id_expression_1): Use STRIP_TEMPLATE.
2596 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
2598 PR c++/90243 - orphaned note in uninstantiated constexpr function
2599 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
2602 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2605 * decl.c (grokdeclarator): Set type to error_mark_node
2606 upon error about template placeholder type non followed
2607 by a simple declarator-id.
2609 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2611 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2614 2019-04-24 Jason Merrill <jason@redhat.com>
2616 PR c++/90227 - error with template parameter packs.
2617 * pt.c (coerce_template_parms): Do add empty pack when
2620 2019-04-24 Richard Biener <rguenther@suse.de>
2622 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
2623 (conversion_null_warnings): Likewise.
2624 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
2625 early if type1 == type2.
2627 2019-04-22 Jason Merrill <jason@redhat.com>
2629 PR c++/87366 - wrong error with alias template.
2630 * typeck.c (structural_comptypes): When comparing_specializations,
2631 aliases are unequal.
2632 (comptypes): When comparing_specializations, do structural
2635 2019-04-19 Jason Merrill <jason@redhat.com>
2637 PR c++/90190 - CTAD with list-constructor.
2638 * pt.c (do_class_deduction): Don't try the single element deduction
2639 if the single element is also a braced list.
2641 PR c++/90171 - ICE with destroying delete with size_t parm.
2642 * call.c (sized_deallocation_fn_p): New. Use it instead of
2643 second_parm_is_size_t in most cases.
2644 (second_parm_is_size_t): Don't check for aligned.
2646 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
2649 * pt.c (fn_type_unification): When handling null explicit
2650 arguments do not special case non-parameter packs.
2652 2019-04-19 Jakub Jelinek <jakub@redhat.com>
2655 * pt.c (process_template_parm): Set decl to pushdecl result. If
2656 !is_non_type, also set parm to that.
2659 * decl.c (struct cp_switch): Remove outside_range_p member.
2660 (push_switch): Don't clear it.
2661 (pop_switch): Adjust c_do_switch_warnings caller.
2662 (finish_case_label): Adjust c_add_case_label caller.
2665 * decl.c (duplicate_decls): If remove is main variant and
2666 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
2667 variant that has newdecl as TYPE_NAME if any.
2669 2019-04-18 Jason Merrill <jason@redhat.com>
2671 PR c++/87554 - ICE with extern template and reference member.
2672 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
2674 2019-04-17 Jason Merrill <jason@redhat.com>
2676 PR c++/90047 - ICE with enable_if alias template.
2677 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
2678 hash table when we're in SFINAE context.
2680 2019-04-17 Marek Polacek <polacek@redhat.com>
2682 PR c++/90124 - bogus error with incomplete type in decltype.
2683 * typeck.c (build_class_member_access_expr): Check
2684 cp_unevaluated_operand.
2686 2019-04-12 Jakub Jelinek <jakub@redhat.com>
2689 * decl.c (duplicate_decls): When newdecl's type is its main variant,
2690 don't try to remove it from the variant list, but instead assert
2693 2019-04-12 Martin Sebor <msebor@redhat.com>
2697 * parser.c (cp_parser_has_attribute_expression): Handle assignment
2700 2019-04-12 Jason Merrill <jason@redhat.com>
2702 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
2705 2019-04-12 Marek Polacek <polacek@redhat.com>
2707 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
2708 instead of perform_implicit_conversion_flags.
2710 PR c++/87603 - constexpr functions are no longer noexcept.
2711 * constexpr.c (is_sub_constant_expr): Remove unused function.
2712 * cp-tree.h (is_sub_constant_expr): Remove declaration.
2713 * except.c (check_noexcept_r): Don't consider a call to a constexpr
2716 2019-04-11 Jakub Jelinek <jakub@redhat.com>
2718 PR translation/90035
2719 * parser.h (struct cp_parser): Add
2720 type_definition_forbidden_message_arg member.
2721 * parser.c (cp_debug_parser): Print it.
2722 (cp_parser_check_type_definition): Pass
2723 parser->type_definition_forbidden_message_arg as second argument to
2725 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
2726 parser->type_definition_forbidden_message_arg and use G_() with
2727 %qs for parser->type_definition_forbidden_message instead of
2728 building untranslatable message using concat.
2730 2019-04-09 Jakub Jelinek <jakub@redhat.com>
2732 PR translation/90011
2733 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
2735 2019-04-08 Marek Polacek <polacek@redhat.com>
2737 * typeck2.c (digest_init_r): Don't condition the object slicing warning
2740 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
2743 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
2744 when maybe_instantiate_noexcept fails.
2745 (classtype_has_nothrow_assign_or_copy_p): Likewise.
2746 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
2747 to build_exception_variant.
2749 2019-04-05 Marek Polacek <polacek@redhat.com>
2751 PR c++/87145 - bogus error converting class type in template arg list.
2752 * pt.c (convert_nontype_argument): Don't call
2753 build_converted_constant_expr if it could involve calling a conversion
2754 function with a instantiation-dependent constructor as its argument.
2756 2019-04-05 Martin Sebor <msebor@redhat.com>
2759 * decl.c (reshape_init_array_1): Avoid treating empty strings
2760 as zeros in array initializers.
2761 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
2763 2019-04-04 Jason Merrill <jason@redhat.com>
2765 PR c++/89948 - ICE with break in statement-expr.
2766 * constexpr.c (cxx_eval_statement_list): Jumping out of a
2767 statement-expr is non-constant.
2769 2019-04-04 Jason Merrill <jason@redhat.com>
2771 PR c++/89966 - error with non-type auto tparm.
2772 * pt.c (do_auto_deduction): Clear tf_partial.
2774 2019-04-04 Jason Merrill <jason@redhat.com>
2776 PR c++/86986 - ICE with TTP with parameter pack.
2777 * pt.c (coerce_template_parameter_pack): Only look at the type of a
2778 non-type parameter pack.
2779 (fixed_parameter_pack_p_1): Don't recurse into the type of a
2780 non-type parameter pack.
2781 (coerce_template_template_parms): Call add_outermost_template_args.
2783 2019-04-04 Martin Sebor <msebor@redhat.com>
2789 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
2790 from arrays of trivial type and known size.
2791 * mangle.c (write_expression): Convert braced initializer lists
2793 (write_expression): Trim trailing zero-initializers from arrays
2795 (write_template_arg_literal): Mangle strings the same as braced
2798 2019-04-03 Jason Merrill <jason@redhat.com>
2800 PR c++/81866 - ICE with member template and default targ.
2801 * pt.c (tsubst_template_decl): Handle getting a type from
2802 retrieve_specialization.
2804 PR c++/86586 - -fcompare-debug=-Wsign-compare.
2805 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
2807 PR c++/89331 - ICE with offsetof in incomplete class.
2808 * semantics.c (finish_offsetof): Handle error_mark_node.
2809 * typeck.c (build_class_member_access_expr): Call
2810 complete_type_or_maybe_complain before converting to base.
2812 PR c++/89917 - ICE with lambda in variadic mem-init.
2813 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
2815 2019-04-01 Jason Merrill <jason@redhat.com>
2817 PR c++/86946 - ICE with function call in template argument.
2819 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
2822 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
2825 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
2827 2019-03-31 Marek Polacek <polacek@redhat.com>
2829 PR c++/89852 - ICE with C++11 functional cast with { }.
2830 * constexpr.c (fold_non_dependent_expr_template): New static function
2832 (fold_non_dependent_expr): ...here.
2833 (fold_non_dependent_init): New function.
2834 * cp-tree.h (fold_non_dependent_init): Declare.
2835 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
2836 of fold_non_dependent_expr. Don't call maybe_constant_init.
2838 2019-03-30 Jason Merrill <jason@redhat.com>
2840 PR c++/89744 - ICE with specialization of member class template.
2841 * pt.c (lookup_template_class_1): If the partial instantiation is
2842 explicitly specialized, adjust.
2843 (maybe_process_partial_specialization): Also adjust
2846 2019-03-29 Jakub Jelinek <jakub@redhat.com>
2849 * typeck.c: Include gimplify.h.
2850 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
2851 for second time. Formatting fixes.
2853 2019-03-29 Marek Polacek <polacek@redhat.com>
2855 PR c++/89876 - ICE with deprecated conversion.
2856 * call.c (convert_like_real): Only give warnings with tf_warning.
2858 2019-03-28 Marek Polacek <polacek@redhat.com>
2860 PR c++/89612 - ICE with member friend template with noexcept.
2861 * pt.c (maybe_instantiate_noexcept): For function templates, use their
2862 template result (function decl). Don't set up local specializations.
2863 Temporarily turn on processing_template_decl. Update the template type
2866 PR c++/89836 - bool constant expression and explicit conversions.
2867 * call.c (build_converted_constant_expr_internal): New function,
2869 (build_converted_constant_expr): ...this. New.
2870 (build_converted_constant_bool_expr): New.
2871 * cp-tree.h (build_converted_constant_bool_expr): Declare.
2872 * decl.c (build_explicit_specifier): Call
2873 build_converted_constant_bool_expr.
2875 2019-03-28 Jakub Jelinek <jakub@redhat.com>
2878 * constexpr.c (struct check_for_return_continue_data): New type.
2879 (check_for_return_continue): New function.
2880 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
2881 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
2882 in loop bodies and set *jump_target to that if found.
2884 2019-03-27 Jason Merrill <jason@redhat.com>
2886 PR c++/89831 - error with qualified-id in const member function.
2887 * semantics.c (finish_non_static_data_member): Use object cv-quals
2888 in scoped case, too.
2890 PR c++/89421 - ICE with lambda in template parameter list.
2891 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
2892 template parameter list before C++20.
2893 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
2894 * semantics.c (begin_class_definition): Restore error about defining
2895 non-lambda class in template parm list.
2897 2019-03-26 Jason Merrill <jason@redhat.com>
2899 PR c++/86932 - missed SFINAE with empty pack.
2900 * pt.c (coerce_template_parms): Don't add an empty pack if
2902 (fn_type_unification): Pass tf_partial to coerce_template_parms.
2904 PR c++/86429 - constexpr variable in lambda.
2907 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
2908 try evaluating the captured variable directly.
2910 2019-03-26 Jakub Jelinek <jakub@redhat.com>
2913 * semantics.c (finish_omp_atomic): Add warning_sentinel for
2914 -Wunused-value around finish_expr_stmt call.
2916 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
2920 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
2921 to undo the disabling of warnings.
2923 2019-03-25 Jason Merrill <jason@redhat.com>
2925 PR c++/87748 - substitution failure error with decltype.
2926 * pt.c (most_specialized_partial_spec): Clear
2927 processing_template_decl.
2929 2019-03-25 Marek Polacek <polacek@redhat.com>
2931 PR c++/89214 - ICE when initializing aggregates with bases.
2932 * typeck2.c (digest_init_r): Warn about object slicing instead of
2935 PR c++/89705 - ICE with reference binding with conversion function.
2936 * call.c (reference_binding): If the result of the conversion function
2937 is a prvalue of non-class type, use the cv-unqualified type.
2939 2019-03-25 Nathan Sidwell <nathan@acm.org>
2941 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
2943 2019-03-22 Jakub Jelinek <jakub@redhat.com>
2946 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
2947 (maybe_get_tls_wrapper_call): Declare.
2948 * decl2.c (get_tls_wrapper_fn): Make static.
2949 (maybe_get_tls_wrapper_call): New function.
2950 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
2952 * semantics.c (finish_qualified_id_expr): Likewise.
2953 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
2954 * pt.c (tsubst_copy_and_build): Likewise.
2957 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
2958 (cxx_eval_constant_expression): When not skipping, not constant class
2959 or location wrapper, increment *ctx->constexpr_ops_count and if it is
2960 above constexpr_loop_nest_limit, diagnose failure.
2961 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
2962 initialize ctx.constexpr_ops_count to its address.
2963 (is_sub_constant_expr): Likewise.
2965 2019-03-21 Jakub Jelinek <jakub@redhat.com>
2968 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
2969 hash_set<tree, true> &, adjust uses accordingly.
2970 (build_aggr_conv): Change pset from hash_set<tree> *
2971 to hash_set<tree, true>. Replace goto fail; with return NULL;,
2975 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
2976 variables, check for duplicates in this function.
2977 * lambda.c (add_capture): Don't check for duplicates nor use
2979 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
2981 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
2984 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
2985 error_mark_node to comp_except_specs.
2987 2019-03-20 Jason Merrill <jason@redhat.com>
2989 PR c++/87480 - decltype of member access in default template arg
2990 * pt.c (type_unification_real): Accept a dependent result in
2993 2019-03-19 Martin Sebor <msebor@redhat.com>
2995 PR tree-optimization/89688
2996 * typeck2.c (store_init_value): Call braced_lists_to_string for more
2997 kinds of initializers.
2999 2019-03-18 Jason Merrill <jason@redhat.com>
3001 PR c++/89630 - ICE with dependent using-decl as template arg.
3002 * tree.c (cp_tree_equal): Always return false for USING_DECL.
3004 PR c++/89761 - ICE with sizeof... in pack expansion.
3005 * pt.c (argument_pack_element_is_expansion_p): Handle
3006 ARGUMENT_PACK_SELECT.
3008 PR c++/89640 - GNU attributes on lambda.
3009 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
3011 PR c++/89682 - wrong access error in default argument.
3012 * pt.c (tsubst_default_argument): Don't defer access checks.
3014 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
3017 * semantics.c (finish_non_static_data_member): Check return value
3018 of context_for_name_lookup and immediately return error_mark_node
3021 2019-03-17 Jason Merrill <jason@redhat.com>
3023 PR c++/89571 - ICE with ill-formed noexcept on constructor.
3024 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
3025 (regenerate_decl_from_template): Use it for noexcept-specs.
3027 2019-03-14 Jason Merrill <jason@redhat.com>
3029 * parser.c (cp_parser_decl_specifier_seq): Support C++20
3030 concept-definition syntax without 'bool'.
3032 2019-03-14 Jakub Jelinek <jakub@redhat.com>
3035 * semantics.c (finish_qualified_id_expr): Reject variable templates.
3038 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
3039 hash_set<tree> to vec<tree>.
3040 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
3042 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
3043 removal of SAVE_EXPRs from values.
3044 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
3045 method on save_exprs instead of add.
3047 2019-03-13 Jason Merrill <jason@redhat.com>
3049 PR c++/86521 - C++17 copy elision in initialization by constructor.
3050 * call.c (joust_maybe_elide_copy): New.
3053 2019-03-13 Marek Polacek <polacek@redhat.com>
3055 PR c++/88979 - further P0634 fix for constructors.
3056 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
3057 cp_parser_constructor_declarator_p.
3058 (cp_parser_direct_declarator): Allow missing typename for constructor
3060 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
3061 cp_parser_type_specifier.
3063 PR c++/89686 - mixing init-capture and simple-capture in lambda.
3064 * parser.c (cp_parser_lambda_introducer): Give error when combining
3065 init-capture and simple-capture.
3067 PR c++/89660 - bogus error with -Wredundant-move.
3068 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
3069 as the std::move's argument. Don't call convert_for_initialization
3070 when warn_redundant_move isn't on.
3072 2019-03-11 Jason Merrill <jason@redhat.com>
3074 PR c++/86521 - wrong overload resolution with ref-qualifiers.
3075 * call.c (build_user_type_conversion_1): Don't use a conversion to a
3076 reference of the wrong rvalueness for direct binding.
3078 2019-03-11 Martin Liska <mliska@suse.cz>
3080 * cvt.c (build_expr_type_conversion): Wrap apostrophes
3081 in gcc internal format with %'.
3082 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
3083 (grokfndecl): Likewise.
3084 * name-lookup.c (do_pushtag): Likewise.
3085 * pt.c (unify_parameter_deduction_failure): Likewise.
3086 (unify_template_deduction_failure): Likewise.
3088 2019-03-11 Martin Liska <mliska@suse.cz>
3090 * call.c (convert_arg_to_ellipsis): Wrap an option name
3091 in a string format message and fix GNU coding style.
3092 (build_over_call): Likewise.
3093 * class.c (check_field_decl): Likewise.
3094 (layout_nonempty_base_or_field): Likewise.
3095 * constexpr.c (cxx_eval_loop_expr): Likewise.
3096 * cvt.c (type_promotes_to): Likewise.
3097 * decl.c (cxx_init_decl_processing): Likewise.
3098 (mark_inline_variable): Likewise.
3099 (grokdeclarator): Likewise.
3100 * decl2.c (record_mangling): Likewise.
3101 * error.c (maybe_warn_cpp0x): Likewise.
3102 * except.c (doing_eh): Likewise.
3103 * mangle.c (maybe_check_abi_tags): Likewise.
3104 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
3105 (cp_parser_userdef_numeric_literal): Likewise.
3106 (cp_parser_primary_expression): Likewise.
3107 (cp_parser_unqualified_id): Likewise.
3108 (cp_parser_pseudo_destructor_name): Likewise.
3109 (cp_parser_builtin_offsetof): Likewise.
3110 (cp_parser_lambda_expression): Likewise.
3111 (cp_parser_lambda_introducer): Likewise.
3112 (cp_parser_lambda_declarator_opt): Likewise.
3113 (cp_parser_selection_statement): Likewise.
3114 (cp_parser_init_statement): Likewise.
3115 (cp_parser_decomposition_declaration): Likewise.
3116 (cp_parser_function_specifier_opt): Likewise.
3117 (cp_parser_static_assert): Likewise.
3118 (cp_parser_simple_type_specifier): Likewise.
3119 (cp_parser_namespace_definition): Likewise.
3120 (cp_parser_using_declaration): Likewise.
3121 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
3122 (cp_parser_initializer_list): Likewise.
3123 (cp_parser_type_parameter_key): Likewise.
3124 (cp_parser_member_declaration): Likewise.
3125 (cp_parser_try_block): Likewise.
3126 (cp_parser_std_attribute_spec): Likewise.
3127 (cp_parser_requires_clause_opt): Likewise.
3128 * pt.c (check_template_variable): Likewise.
3129 (check_default_tmpl_args): Likewise.
3130 (push_tinst_level_loc): Likewise.
3131 (instantiate_pending_templates): Likewise.
3132 (invalid_nontype_parm_type_p): Likewise.
3133 * repo.c (get_base_filename): Likewise.
3134 * rtti.c (typeid_ok_p): Likewise.
3135 (build_dynamic_cast_1): Likewise.
3136 * tree.c (maybe_warn_parm_abi): Likewise.
3138 2019-03-08 Jakub Jelinek <jakub@redhat.com>
3141 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
3142 one space before " at the end of line and another after " on another
3143 line in a string literal.
3145 PR tree-optimization/89550
3146 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
3147 warning_at returned true.
3148 * decl2.c (c_parse_final_cleanups): Likewise.
3149 * typeck.c (convert_for_assignment): Likewise.
3150 * decl.c (finish_function): Likewise.
3153 * parser.c (cp_parser_asm_definition): Just warn instead of error
3154 on volatile qualifier outside of function body.
3157 * constexpr.c (potential_constant_expression_1): Reject
3158 REINTERPRET_CAST_P NOP_EXPRs.
3161 * call.c (joust): Call print_z_candidate only if pedwarn returned
3164 2019-03-07 Jason Merrill <jason@redhat.com>
3166 PR c++/88123 - lambda and using-directive.
3167 * name-lookup.c (op_unqualified_lookup)
3168 (maybe_save_operator_binding, discard_operator_bindings)
3169 (push_operator_bindings): New.
3170 * typeck.c (build_x_binary_op, build_x_unary_op): Call
3171 maybe_save_operator_binding.
3172 * decl.c (start_preparsed_function): Call push_operator_bindings.
3173 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
3175 PR c++/88820 - ICE with CTAD and member template used in DMI.
3176 * pt.c (do_class_deduction): Handle parm used as its own arg.
3178 2019-03-07 Jakub Jelinek <jakub@redhat.com>
3181 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
3182 at toplevel, but diagnose them.
3184 2019-03-06 Jason Merrill <jason@redhat.com>
3186 PR c++/89381 - implicit copy and using-declaration.
3187 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
3188 op= brought in by a using-declaration.
3190 2019-03-06 Jakub Jelinek <jakub@redhat.com>
3193 * init.c (build_value_init_noctor): Ignore flexible array members.
3195 2019-03-06 Jason Merrill <jason@redhat.com>
3197 PR c++/89576 - if constexpr of lambda capture.
3198 * semantics.c (maybe_convert_cond): Do convert a non-dependent
3199 condition in a template.
3200 * typeck.c (condition_conversion): Handle being called in a
3203 2019-03-06 Marek Polacek <polacek@redhat.com>
3205 PR c++/87378 - bogus -Wredundant-move warning.
3206 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
3207 overload resolution would actually succeed.
3209 2019-03-05 Jason Merrill <jason@redhat.com>
3211 * class.c (is_really_empty_class): Add ignore_vptr parm.
3212 (trivial_default_constructor_is_constexpr): Pass it.
3213 * call.c (build_over_call): Pass it.
3214 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
3215 checking TYPE_POLYMORPHIC_P.
3216 (cxx_eval_component_reference, potential_constant_expression_1):
3218 * cp-gimplify.c (simple_empty_class_p): Pass it.
3219 * init.c (expand_aggr_init_1): Pass it.
3221 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
3224 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
3226 2019-03-04 Jakub Jelinek <jakub@redhat.com>
3229 * call.c (field_in_pset): New function.
3230 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
3232 2019-03-02 Jakub Jelinek <jakub@redhat.com>
3235 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
3236 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
3237 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
3238 (cp_parser_initializer_list): Add designated parameter, set *designated
3239 to a bool whether any designators were parsed.
3240 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
3242 * pt.c (tsubst_copy_and_build): Likewise.
3243 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
3244 don't call build_list_conv, nor build_complex_conv, nor attempt to
3245 convert a single element initializer to scalar.
3247 2019-03-01 Marek Polacek <polacek@redhat.com>
3249 PR c++/89537 - missing location for error with non-static member fn.
3250 * call.c (resolve_args): Use EXPR_LOCATION.
3251 * typeck.c (build_class_member_access_expr): Use input_location.
3253 PR c++/89532 - ICE with incomplete type in decltype.
3254 * semantics.c (finish_compound_literal): Return error_mark_node
3255 if digest_init_flags returns error_mark_node.
3257 2019-03-01 Jakub Jelinek <jakub@redhat.com>
3259 Implement P1002R1, Try-catch blocks in constexpr functions
3261 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
3262 Diagnose constexpr ctor or function with function-try-block with
3263 pedwarn for c++17 and earlier. Formatting fix.
3264 (cp_parser_try_block): Use pedwarn instead of error and only for
3265 c++17 and earlier when try block appears in constexpr function.
3266 * constexpr.c (build_constexpr_constructor_member_initializers):
3267 Handle TRY_BLOCK here instead of erroring on it.
3269 2019-02-28 Jason Merrill <jason@redhat.com>
3271 PR c++/88183 - ICE with .* fold-expression.
3272 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
3274 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3275 * class.c, lambda.c, pt.c: Revert earlier change.
3276 * lambda.c (add_capture): Don't special-case capture of dependent
3279 * name-lookup.c (print_binding_level): Print this_entity.
3281 2019-02-27 Marek Polacek <polacek@redhat.com>
3283 PR c++/88857 - ICE with value-initialization of argument in template.
3284 * call.c (convert_like_real): Don't call build_value_init in template.
3286 2019-02-27 Jason Merrill <jason@redhat.com>
3288 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3289 * semantics.c (process_outer_var_ref): Do capture dependent vars.
3290 * class.c (finish_struct): Only add TAG_DEFN if T is in
3291 current_function_decl.
3292 * lambda.c (vla_capture_type): Force the capture type out into the
3293 lambda's enclosing function.
3294 (add_capture): Pass in the lambda.
3295 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
3297 2019-02-27 Marek Polacek <polacek@redhat.com>
3299 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
3300 * parser.c (cp_parser_using_declaration): For an unscoped enum
3301 only use its context if it's not a function declaration.
3303 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
3306 * method.c (process_subob_fn): When maybe_instantiate_noexcept
3307 returns false don't call merge_exception_specifiers.
3309 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
3312 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
3313 for a non-constant parsed expression.
3315 2019-02-26 Jakub Jelinek <jakub@redhat.com>
3318 * constexpr.c (cxx_eval_store_expression): When changing active union
3319 member, set no_zero_init.
3321 2019-02-23 Marek Polacek <polacek@redhat.com>
3323 PR c++/88294 - ICE with non-constant noexcept-specifier.
3324 * pt.c (maybe_instantiate_noexcept): Set up the list of local
3325 specializations. Set current_class_{ptr,ref}.
3327 2019-02-22 David Malcolm <dmalcolm@redhat.com>
3330 * parser.c (cp_parser_unqualified_id): Capture and use locations
3333 2019-02-22 Marek Polacek <polacek@redhat.com>
3335 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
3336 * decl.c (build_explicit_specifier): Don't check
3337 processing_template_decl. Call instantiation_dependent_expression_p
3338 instead of value_dependent_expression_p. Call
3339 instantiate_non_dependent_expr_sfinae before
3340 build_converted_constant_expr instead of calling
3341 instantiate_non_dependent_expr after it. Add
3342 processing_template_decl_sentinel.
3344 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
3346 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
3347 parameter, move loc formal parameter to the front. Adjust all
3349 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
3352 2019-02-21 Jason Merrill <jason@redhat.com>
3354 PR c++/87685 - generic lambda 'this' capture error.
3355 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
3356 (maybe_generic_this_capture): Pass -1.
3358 PR c++/88394 - ICE with VLA init-capture.
3359 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
3361 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
3362 * pt.c (do_class_deduction): Don't include explicit specialization
3365 PR c++/89422 - ICE with -g and lambda in default arg in template.
3366 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
3368 2019-02-21 Jason Merrill <jason@redhat.com>
3370 PR c++/88419 - C++17 ICE with class template arg deduction.
3371 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
3372 CLASS_PLACEHOLDER_TEMPLATE.
3374 2019-02-21 Jakub Jelinek <jakub@redhat.com>
3377 * constexpr.c (struct constexpr_fundef): Add parms and result members.
3378 (retrieve_constexpr_fundef): Adjust for the above change.
3379 (register_constexpr_fundef): Save constexpr body with copy_fn,
3380 temporarily set DECL_CONTEXT on DECL_RESULT before that.
3381 (get_fundef_copy): Change FUN argument to FUNDEF with
3382 constexpr_fundef * type, grab body and parms/result out of
3383 constexpr_fundef struct and temporarily change it for copy_fn calls
3385 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
3386 adjust current_function_decl from ctx->call context. Test
3387 !potential_constant_expression instead of !is_constant_expression.
3388 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
3389 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
3390 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
3391 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
3392 operands to be NULL.
3393 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
3394 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
3395 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
3396 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
3397 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
3398 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
3399 DECL_EXPR with USING_DECL operand.
3400 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
3401 build_int_cst to make it a valid constant expression.
3403 2019-02-20 Jason Merrill <jason@redhat.com>
3405 PR c++/88690 - C++17 ICE with empty base in aggregate.
3406 * typeck2.c (process_init_constructor_record): Skip trivial
3407 initialization of an empty base.
3409 2019-02-21 Richard Biener <rguenther@suse.de>
3412 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
3413 make symtab process new functions here.
3415 2019-02-20 Jason Merrill <jason@redhat.com>
3417 PR c++/87921 - wrong error with inline static data member.
3418 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
3419 for a non-template inline variable. Do nothing for an
3420 already-instantiated variable.
3421 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
3423 * decl.c (check_initializer): Likewise.
3424 (make_rtl_for_nonlocal_decl): Likewise.
3425 * pt.c (instantiate_decl): Likewise.
3426 * typeck2.c (store_init_value): Likewise.
3428 2019-02-20 Jakub Jelinek <jakub@redhat.com>
3431 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
3432 for flag_syntax_only from here...
3433 * semantics.c (expand_or_defer_fn_1): ... here.
3436 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
3437 DECL_COMMON, set DECL_INTERFACE_KNOWN.
3440 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
3441 union member for -std=c++17 and earlier.
3443 2019-02-19 Jason Merrill <jason@redhat.com>
3445 PR c++/87513 - 'sorry' mangling PMF template-id.
3446 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
3448 2019-02-19 Jason Merrill <jason@redhat.com>
3450 PR c++/88380 - wrong-code with flexible array and NSDMI.
3451 * typeck2.c (process_init_constructor_record): Skip flexarrays.
3453 2019-02-20 will wray <wjwray@gmail.com>
3455 PR c++/88572 - wrong handling of braces on scalar init.
3456 * decl.c (reshape_init_r): Allow braces around scalar initializer
3457 within aggregate init. Reject double braced-init of scalar
3460 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
3463 * pt.c (tsubst_init): Diagnose an initializer expanding to an
3464 empty list of expressions; tweak wrt dependent types.
3465 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
3466 instead of tsubst_expr.
3468 2019-02-19 Jason Merrill <jason@redhat.com>
3470 PR c++/88368 - wrong 'use of deleted function'
3471 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
3472 (get_defaulted_eh_spec): Call push_tinst_level.
3473 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
3474 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
3476 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
3479 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
3480 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
3482 2019-02-19 Jakub Jelinek <jakub@redhat.com>
3485 * lambda.c (maybe_generic_this_capture): Don't check
3486 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
3489 * typeck.c (build_reinterpret_cast_1): Don't handle void to
3490 && conversion go through build_target_expr_with_type.
3493 * error.c (qualified_name_lookup_error): Only call
3494 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
3496 2019-02-19 Tom Honermann <tom@honermann.net>
3498 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
3500 2019-02-18 Jason Merrill <jason@redhat.com>
3502 PR c++/89336 - multiple stores in constexpr stmt.
3503 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
3506 * pt.c (check_explicit_specialization): If the declarator is a
3507 template-id, only check whether the arguments are dependent.
3509 Improve duplicate [[likely]] diagnostic.
3510 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
3511 to process_stmt_hotness_attribute.
3512 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
3513 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
3515 2019-02-17 Marek Polacek <polacek@redhat.com>
3517 PR c++/89217 - ICE with list-initialization in range-based for loop.
3518 * constexpr.c (unshare_constructor): No longer static.
3519 * cp-tree.h (unshare_constructor): Declare.
3520 * semantics.c (finish_compound_literal): When dealing with a
3521 non-dependent expression in a template, return the original
3522 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
3524 2019-02-13 Marek Polacek <polacek@redhat.com>
3526 PR c++/89297 - ICE with OVERLOAD in template.
3527 * semantics.c (finish_compound_literal): Call
3528 instantiate_non_dependent_expr_sfinae.
3530 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
3533 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
3534 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
3535 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
3536 (shared_member_p): Likewise.
3537 (lookup_member): Likewise.
3538 * decl.c (grok_special_member_properties): Skip USING_DECLs.
3539 * semantics.c (finish_omp_declare_simd_methods): Likewise.
3540 (finish_qualified_id_expr): Do not call shared_member_p with
3544 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
3545 Move cp_evaluated resetting before signature tsubsting.
3546 (gen_elem_of_pack_expansion_instantiation): Separate local
3547 specializations per index.
3549 2019-02-13 David Malcolm <dmalcolm@redhat.com>
3552 * class.c (add_method): Drop destructor assertion.
3554 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
3557 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
3558 context (the first argument).
3559 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
3562 2019-02-12 Jason Merrill <jason@redhat.com>
3564 PR c++/89144 - link error with constexpr initializer_list.
3565 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
3566 array for an empty list.
3567 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
3570 2019-02-11 Jason Merrill <jason@redhat.com>
3572 PR c++/89241 - ICE with __func__ in lambda in template.
3573 * pt.c (enclosing_instantiation_of): Also check
3574 instantiated_lambda_fn_p for the template context.
3576 2019-02-11 Marek Polacek <polacek@redhat.com>
3578 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
3579 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
3580 null member pointer value.
3582 2019-02-11 Jakub Jelinek <jakub@redhat.com>
3585 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
3586 to maybe_constant_value calls.
3588 2019-02-11 Marek Polacek <polacek@redhat.com>
3590 * typeck2.c (digest_init_r): Remove commented code.
3592 2019-02-11 Martin Sebor <msebor@redhat.com>
3595 * decl.c (compute_array_index_type_loc): Preserve signed sizes
3596 for diagnostics. Call valid_array_size_p instead of error.
3597 * init.c (build_new_1): Compute size for diagnostic. Call
3598 invalid_array_size_error
3599 (build_new): Call valid_array_size_p instead of error.
3601 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
3604 * call.c (compare_ics): Deal with ck_aggr in either cs.
3606 2019-02-06 David Malcolm <dmalcolm@redhat.com>
3609 * call.c (get_location_for_expr_unwinding_for_system_header): New
3611 (conversion_null_warnings): Use it when getting locations for
3612 EXPR, effectively adding a call to
3613 get_location_for_expr_unwinding_for_system_header for
3614 -Wconversion-null and making use of EXPR_LOCATION for
3615 -Wzero-as-null-pointer-constant.
3617 2019-02-05 Jakub Jelinek <jakub@redhat.com>
3620 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
3621 PARM_DECLs of the thunk.
3622 * lambda.c (maybe_add_lambda_conv_op): Likewise.
3624 2019-02-05 Marek Polacek <polacek@redhat.com>
3626 PR c++/89158 - by-value capture of constexpr variable broken.
3627 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
3628 instead of mark_rvalue_use.
3630 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
3633 * pt.c (instantiates_primary_template_p): New.
3634 (type_dependent_expression_p): Use it.
3636 2019-02-01 Jason Merrill <jason@redhat.com>
3638 PR c++/88761 - ICE with reference capture of constant.
3639 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
3642 2019-02-01 Marek Polacek <polacek@redhat.com>
3644 PR c++/88325 - ICE with invalid out-of-line template member definition.
3645 * parser.c (cp_parser_class_name): Don't call make_typename_type
3648 2019-02-01 Jakub Jelinek <jakub@redhat.com>
3651 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
3652 if require_open failed.
3654 2019-01-31 Marek Polacek <polacek@redhat.com>
3656 PR c++/89083, c++/80864 - ICE with list initialization in template.
3657 * constexpr.c (adjust_temp_type): Use copy_node and change the type
3658 instead of using build_constructor.
3659 * decl.c (reshape_init_r): Don't reshape a digested initializer.
3660 Return the initializer for COMPOUND_LITERAL_P.
3662 PR c++/88983 - ICE with switch in constexpr function.
3663 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
3664 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
3665 label in the else branch if we found it in the then branch.
3667 2019-01-30 Jason Merrill <jason@redhat.com>
3669 PR c++/88752 - ICE with lambda and constexpr if.
3670 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
3671 * pt.c (tsubst_lambda_expr): Set it.
3672 (instantiated_lambda_fn_p): Check it.
3673 (enclosing_instantiation_of): Use it.
3675 2019-01-31 Jakub Jelinek <jakub@redhat.com>
3678 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
3679 a C cast in pp_c_flag_gnu_v3 mode.
3681 2019-01-30 Jakub Jelinek <jakub@redhat.com>
3684 * lambda.c (is_capture_proxy): Don't return true for
3685 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
3687 2019-01-30 Marek Polacek <polacek@redhat.com>
3689 PR c++/89119 - ICE with value-initialization in template.
3690 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
3692 2019-01-29 Jason Merrill <jason@redhat.com>
3694 PR c++/86943 - wrong code converting lambda to function pointer.
3695 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
3696 call. Only forward parms for decltype.
3697 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
3699 * typeck.c (check_return_expr): Don't mess with a thunk call.
3701 2019-01-28 Jason Merrill <jason@redhat.com>
3703 PR c++/89089 - ICE with [[no_unique_address]].
3704 PR c++/88865 - wrong layout with [[no_unique_address]].
3705 * class.c (check_field_decls): A potentially-overlapping field makes
3706 the class non-layout-POD, but not non-empty.
3707 (end_of_class): Always consider empty data members.
3708 (layout_class_type): Set DECL_SIZE for empty fields.
3710 2019-01-28 Marek Polacek <polacek@redhat.com>
3712 PR c++/88358 - name wrongly treated as type.
3713 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
3714 in parameter-list is a type if the function's declarator-id is not
3717 2019-01-27 Marek Polacek <polacek@redhat.com>
3719 PR c++/88815 - narrowing conversion lost in decltype.
3720 PR c++/78244 - narrowing conversion in template not detected.
3721 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
3722 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
3723 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
3724 * semantics.c (finish_compound_literal): When the compound literal
3725 isn't instantiation-dependent and the type isn't type-dependent,
3726 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
3728 PR c++/89024 - ICE with incomplete enum type.
3729 * call.c (standard_conversion): When converting an
3730 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
3732 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
3735 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
3736 * decl2.c (coerce_delete_type): Use build_pointer_type instead
3739 2019-01-24 Jason Merrill <jason@redhat.com>
3741 PR c++/89001 - mangling of reference temporaries
3742 * cp-tree.h (struct saved_scope): Add ref_temp_count.
3743 (current_ref_temp_count): New macro.
3744 * mangle.c (mangle_ref_init_variable): Use it.
3745 * typeck2.c (store_init_value): Clear it.
3746 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
3749 2019-01-24 Jakub Jelinek <jakub@redhat.com>
3752 * semantics.c (finish_omp_cancel): Diagnose more than one if
3753 on #pragma omp cancel with different modifiers. Use
3754 maybe_convert_cond when not in template or build_x_binary_op
3757 2019-01-23 Marek Polacek <polacek@redhat.com>
3759 PR c++/88757 - qualified name treated wrongly as type.
3760 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
3761 in parameter-list as types if name lookup for declarator-id didn't
3762 find one or more function templates.
3764 2019-01-23 Jakub Jelinek <jakub@redhat.com>
3767 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
3768 after genericizing cond and incr expressions.
3771 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
3772 before the begin_bc_block call.
3774 2019-01-21 Jason Merrill <jason@redhat.com>
3776 PR c++/87893 - constexpr ctor ICE on ARM.
3777 PR c++/88293 - ICE with comma expression.
3778 * constexpr.c (initialized_type): Don't shortcut non-void type.
3779 Handle COMPOUND_EXPR.
3780 (cxx_eval_outermost_constant_expr): Return early for void type.
3782 2019-01-21 Jakub Jelinek <jakub@redhat.com>
3785 * optimize.c (cxx_copy_decl): New function.
3786 (clone_body): Use it instead of copy_decl_no_change.
3789 * typeck.c (cp_build_binary_op): Don't instrument
3790 SANITIZE_POINTER_COMPARE if processing_template_decl.
3791 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
3793 2019-01-18 Jason Merrill <jason@redhat.com>
3795 PR c++/88875 - error with explicit list constructor.
3796 * call.c (reference_binding): Don't modify EXPR. Set
3797 need_temporary_p on the ck_user conversion for a temporary.
3798 (convert_like_real): Check it.
3800 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
3804 * call.c (convert_for_arg_passing): Upate the
3805 warn_for_address_or_pointer_of_packed_member call.
3806 * typeck.c (convert_for_assignment): Likewise.
3808 2019-01-17 Jason Merrill <jason@redhat.com>
3810 PR c++/86205 - ICE with ?: of throw and template-id.
3811 * pt.c (resolve_nondeduced_context_or_error): Split out from...
3812 * typeck.c (decay_conversion): ...here.
3813 * call.c (build_conditional_expr_1): Use it.
3815 PR c++/86740, ICE with constexpr if and nested generic lambdas.
3816 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
3818 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
3820 * decl.c (grokdeclarator): Use typespec_loc in error messages
3821 about 'auto' and trailing return type.
3823 2019-01-17 David Malcolm <dmalcolm@redhat.com>
3826 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
3829 2019-01-17 Nathan Sidwell <nathan@acm.org>
3832 * semantics.c (process_outer_var_ref): Only skip dependent types
3835 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
3838 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
3839 * name-lookup.c (do_push_to_top_level): Save and reset it.
3840 (do_pop_from_top_level): Restore it.
3843 * pt.c (make_template_placeholder): Use auto_identifier.
3844 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
3845 * error.c (dump_type): Handle template placeholders.
3846 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
3849 * cvt.c (convert_to_void): Handle all cdtor calls as if
3852 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
3854 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
3855 error messages about ill-formed uses of mutable.
3857 2019-01-16 Marek Polacek <polacek@redhat.com>
3859 PR c++/78244 - narrowing conversion in template not detected.
3860 * call.c (perform_implicit_conversion_flags): Set
3861 IMPLICIT_CONV_EXPR_BRACED_INIT.
3862 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
3863 * pt.c (tsubst_copy_and_build): Use it.
3865 2019-01-15 David Malcolm <dmalcolm@redhat.com>
3868 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
3871 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
3873 * decl.c (start_decl): Improve error location.
3874 * decl2.c (grokfield): Likewise.
3876 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
3878 * decl.c (grokdeclarator): Move further up the location_t loc
3879 declaration and use the location when building a TYPE_DECL for
3881 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
3882 about an ill-formed bit-field as typedef.
3884 2019-01-14 Marek Polacek <polacek@redhat.com>
3886 PR c++/88830 - ICE with abstract class.
3887 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
3890 PR c++/88825 - ICE with bogus function return type deduction.
3891 * typeck.c (can_do_nrvo_p): Check error_mark_node.
3893 2019-01-14 Tom Honermann <tom@honermann.net>
3895 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
3896 * cvt.c (type_promotes_to): Handle char8_t promotion.
3897 * decl.c (grokdeclarator): Handle invalid type specifier
3898 combinations involving char8_t.
3899 * lex.c (init_reswords): Add char8_t as a reserved word.
3900 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
3901 * parser.c (cp_keyword_starts_decl_specifier_p)
3902 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
3904 (cp_parser_string_literal): Use char8_array_type_node for the type
3906 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
3908 * rtti.c (emit_support_tinfos): type_info support for char8_t.
3909 * tree.c (char_type_p): Recognize char8_t as a character type.
3910 * typeck.c (string_conv_p): Handle conversions of u8 string
3911 literals of char8_t type.
3912 (check_literal_operator_args): Handle UDLs with u8 string literals
3914 * typeck2.c (ordinary_char_type_p): New.
3915 (digest_init_r): Disallow initializing a char array with a u8 string
3918 2019-01-14 Martin Liska <mliska@suse.cz>
3920 PR gcov-profile/88263
3921 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
3922 as location of the TLS wrapper.
3924 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
3926 * decl.c (cp_finish_decl): Improve error location.
3927 * decl2.c (grokfield): Likewise, improve two locations.
3929 2019-01-11 Marek Polacek <polacek@redhat.com>
3931 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
3932 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
3935 2019-01-11 Jason Merrill <jason@redhat.com>
3937 PR c++/88312 - pack expansion of decltype.
3938 * pt.c (instantiation_dependent_r): A template non-type parameter
3939 pack is instantiation-dependent.
3941 2019-01-11 Jason Merrill <jason@redhat.com>
3943 PR c++/88613 - ICE with use of const var in lambda.
3944 * expr.c (mark_use): Fix location wrapper handling.
3945 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
3947 2019-01-11 Tobias Burnus <burnus@net-b.de>
3950 * decl2.c (maybe_emit_vtables): If needed, generate code for
3951 the destructor of an abstract class.
3952 (mark_used): Update comment for older function-name change.
3954 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
3956 * decl.c (start_decl): Improve error location.
3957 (grokdeclarator): Likewise, improve two locations.
3959 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
3963 * cp-tree.h: Mechanically replace "can not" with "cannot".
3964 * parser.c: Likewise.
3967 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
3969 * decl.c (grok_reference_init): Improve error location.
3970 (grokdeclarator): Likewise, improve two locations.
3972 2019-01-08 Marek Polacek <polacek@redhat.com>
3974 PR c++/88538 - braced-init-list in template-argument-list.
3975 * parser.c (cp_parser_template_argument): Handle braced-init-list when
3978 PR c++/88548 - this accepted in static member functions.
3979 * parser.c (cp_debug_parser): Adjust printing of
3980 local_variables_forbidden_p.
3981 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
3982 (cp_parser_primary_expression): When checking
3983 local_variables_forbidden_p, use THIS_FORBIDDEN or
3984 LOCAL_VARS_FORBIDDEN.
3985 (cp_parser_lambda_body): Update the type of
3986 local_variables_forbidden_p. Set it to 0 rather than false.
3987 (cp_parser_condition): Adjust call to cp_parser_declarator.
3988 (cp_parser_explicit_instantiation): Likewise.
3989 (cp_parser_init_declarator): Likewise.
3990 (cp_parser_declarator): New parameter. Use it.
3991 (cp_parser_direct_declarator): New parameter. Use it to set
3992 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
3993 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
3994 (cp_parser_parameter_declaration): Likewise.
3995 (cp_parser_default_argument): Update the type of
3996 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
3998 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
3999 'static' or 'friend'.
4000 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
4001 (cp_parser_late_parsing_default_args): Update the type of
4002 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4004 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
4005 (cp_parser_objc_class_ivars): Likewise.
4006 (cp_parser_objc_struct_declaration): Likewise.
4007 (cp_parser_omp_for_loop_init): Likewise.
4008 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
4010 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
4013 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4015 * decl.c (start_decl): Improve permerror location.
4017 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
4018 Jakub Jelinek <jakub@redhat.com>
4021 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
4022 fixit hint if current_class_ref is NULL. Use a single if instead of
4025 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4027 * decl.c (start_decl): Improve two error_at locations.
4028 (expand_static_init): Likewise.
4030 2019-01-07 Marek Polacek <polacek@redhat.com>
4032 PR c++/88741 - wrong error with initializer-string.
4033 * decl.c (cp_complete_array_type): Strip any location wrappers.
4035 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
4041 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
4042 * typeck2.c (digest_init_r): Raise an error for non-static
4043 initialization of a flexible array member.
4044 (process_init_constructor, massage_init_elt,
4045 process_init_constructor_array, process_init_constructor_record,
4046 process_init_constructor_union, process_init_constructor): Add the
4047 flags parameter and pass it thru.
4048 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
4049 digest_init_flags for static decls.
4051 2019-01-07 Jakub Jelinek <jakub@redhat.com>
4054 * cp-tree.h (cp_build_vec_convert): Declare.
4055 * parser.c (cp_parser_postfix_expression): Parse
4056 __builtin_convertvector.
4057 * constexpr.c: Include fold-const-call.h.
4058 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
4059 (potential_constant_expression_1): Likewise.
4060 * semantics.c (cp_build_vec_convert): New function.
4061 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
4064 2019-01-03 Jakub Jelinek <jakub@redhat.com>
4067 * decl.c (builtin_function_1): Return result of pushdecl_top_level
4068 or pushdecl rather than decl.
4070 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
4072 * tree.c (handle_nodiscard_attribute): Improve warning location.
4074 2019-01-02 Marek Polacek <polacek@redhat.com>
4076 PR c++/88612 - ICE with -Waddress-of-packed-member.
4077 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
4078 * typeck.c (convert_for_assignment): Likewise.
4080 PR c++/88631 - CTAD failing for value-initialization.
4081 * typeck2.c (build_functional_cast): Try deducing the template
4082 arguments even if there are no arguments to deduce from.
4084 2019-01-01 Jakub Jelinek <jakub@redhat.com>
4086 Update copyright years.
4088 Copyright (C) 2019 Free Software Foundation, Inc.
4090 Copying and distribution of this file, with or without modification,
4091 are permitted in any medium without royalty provided the copyright
4092 notice and this notice are preserved.