Implement return type deduction for normal functions with -std=c++1y.
[gcc.git] / gcc / cp / ChangeLog
1 2012-03-21 Jason Merrill <jason@redhat.com>
2
3 Implement return type deduction for normal functions with -std=c++1y.
4 * cp-tree.h (FNDECL_USED_AUTO): New macro.
5 (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P): Remove.
6 (dependent_lambda_return_type_node): Remove.
7 (CPTI_DEPENDENT_LAMBDA_RETURN_TYPE): Remove.
8 (struct language_function): Add x_auto_return_pattern field.
9 (current_function_auto_return_pattern): New.
10 (enum tsubst_flags): Add tf_partial.
11 * decl.c (decls_match): Handle auto return comparison.
12 (duplicate_decls): Adjust error message for auto return.
13 (cxx_init_decl_processing): Remove dependent_lambda_return_type_node.
14 (cp_finish_decl): Don't do auto deduction for functions.
15 (grokdeclarator): Allow auto return without trailing return type in
16 C++1y mode.
17 (check_function_type): Defer checking of deduced return type.
18 (start_preparsed_function): Set current_function_auto_return_pattern.
19 (finish_function): Set deduced return type to void if not previously
20 deduced.
21 * decl2.c (change_return_type): Handle error_mark_node.
22 (mark_used): Always instantiate functions with deduced return type.
23 Complain about use if deduction isn't done.
24 * parser.c (cp_parser_lambda_declarator_opt): Use 'auto' for
25 initial return type.
26 (cp_parser_lambda_body): Don't deduce return type in a template.
27 (cp_parser_conversion_type_id): Allow auto in C++1y.
28 * pt.c (instantiate_class_template_1): Don't mess with
29 LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P.
30 (tsubst_copy_and_build): Likewise.
31 (fn_type_unification, tsubst): Don't reduce the template parm level
32 of 'auto' during deduction.
33 (unify): Compare 'auto' specially.
34 (get_bindings): Change test.
35 (always_instantiate_p): Always instantiate functions with deduced
36 return type.
37 (do_auto_deduction): Handle error_mark_node and lambda context.
38 Don't check for use in initializer.
39 (contains_auto_r): Remove.
40 * search.c (lookup_conversions_r): Handle auto conversion function.
41 * semantics.c (lambda_return_type): Handle null return. Don't mess
42 with dependent_lambda_return_type_node.
43 (apply_deduced_return_type): Rename from apply_lambda_return_type.
44 * typeck.c (merge_types): Handle auto.
45 (check_return_expr): Do auto deduction.
46 * typeck2.c (add_exception_specifier): Fix complain check.
47
48 2012-03-22 Paolo Carlini <paolo.carlini@oracle.com>
49
50 PR c++/52487
51 * class.c (check_field_decls): Call literal_type_p only
52 on complete types.
53
54 2012-03-22 Jakub Jelinek <jakub@redhat.com>
55
56 PR c++/52671
57 * decl.c (check_tag_decl): Only use CLASSTYPE_TEMPLATE_INSTANTIATION
58 on CLASS_TYPE_P types.
59
60 2012-03-20 Jason Merrill <jason@redhat.com>
61
62 * lex.c (init_reswords): Use >= for cxx_dialect test.
63 * parser.c (cp_parser_exception_specification_opt): Likewise.
64
65 * mangle.c (write_type): Handle 'auto'.
66 * init.c (build_new): Don't do auto deduction where it might
67 affect template mangling.
68
69 PR c++/52510
70 * decl.c (reshape_init_class): Handle repeated reshaping.
71 * search.c (lookup_field_1): Add sanity check.
72
73 2012-03-19 Paolo Carlini <paolo.carlini@oracle.com>
74
75 PR c++/14710
76 * cp-tree.h (xvalue_p, maybe_warn_about_useless_cast): Declare.
77 * tree.c (xvalue_p): Define.
78 * typeck.c (maybe_warn_about_useless_cast): Define.
79 (build_reinterpret_cast, build_const_cast,
80 build_static_cast, cp_build_c_cast): Use maybe_warn_about_useless_cast.
81 * rtti.c (build_dynamic_cast): Likewise.
82 * pt.c (tsubst_copy_and_build, case CAST_EXPR): Increment/decrement
83 c_inhibit_evaluation_warnings before/after the build_* calls.
84
85 2012-03-15 Jason Merrill <jason@redhat.com>
86
87 PR c++/52582
88 * method.c (implicitly_declare_fn): Set DECL_EXTERNAL.
89
90 2012-03-15 Manuel López-Ibáñez <manu@gcc.gnu.org>
91
92 PR c++/44783
93 * error.c (print_instantiation_partial_context): Use
94 template_backtrace_limit.
95
96 2012-03-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
97
98 * Make-lang.in (doc/g++.1): Remove IRIX 6.5 reference.
99
100 2012-03-14 Jakub Jelinek <jakub@redhat.com>
101
102 PR c++/52521
103 * parser.c (lookup_literal_operator): Return fn only if
104 processed all arguments from args vector and argtypes is
105 void_list_node.
106
107 2012-01-30 Dodji Seketeli <dodji@redhat.com>
108
109 PR c++/51641
110 * cp-tree.h (template_type_parameter_p): Declare new function.
111 (parameter_of_template_p): Remove.
112 * pt.c (template_type_parameter_p): Define new function.
113 (parameter_of_template_p): Remove.
114 * name-lookup.c (binding_to_template_parms_of_scope_p): Don't rely
115 on parameter_of_template_p anymore. Compare the level of the
116 template parameter to the depth of the template.
117
118 2011-12-15 Dodji Seketeli <dodji@redhat.com>
119
120 * call.c (standard_conversion, build_integral_nontype_arg_conv)
121 (build_new_op_1, convert_like_real, is_subseq)
122 (maybe_handle_implicit_object, maybe_handle_ref_bind, compare_ics)
123 (joust): Use next_conversion instead of accessing fields of struct
124 conversion directly.
125
126 2012-03-12 Paolo Carlini <paolo.carlini@oracle.com>
127
128 PR c++/52299
129 * pt.c (tsubst_copy_and_build, case COND_EXPR): Avoid bogus
130 division by zero warnings.
131
132 2012-03-08 Paolo Carlini <paolo.carlini@oracle.com>
133
134 * typeck.c (build_array_ref, cp_build_addr_expr_1, convert_ptrmem,
135 build_ptrmemfunc): Consistently forward the tsubst_flags_t
136 parameter.
137 * call.c (resolve_args): Likewise.
138
139 2012-03-07 Jason Merrill <jason@redhat.com>
140
141 PR c++/52521
142 * mangle.c (write_literal_operator_name): The length comes after the
143 operator prefix.
144
145 2012-03-05 Jakub Jelinek <jakub@redhat.com>
146
147 * pt.c (local_specializations): Change from htab_t into
148 struct pointer_map_t *.
149 (retrieve_local_specializations, register_local_specialization,
150 tsubst_pack_expansion, instantiate_decl): Adjust users.
151 (eq_local_specializations, hash_local_specialization): Remove.
152
153 2012-03-05 Jason Merrill <jason@redhat.com>
154
155 PR c++/51930
156 * decl2.c (determine_visibility): Correct calculation of class
157 args depth.
158 * decl.c (check_tag_decl): Adjust warning.
159
160 * method.c (synthesized_method_walk): Cleanups don't affect the EH
161 spec either.
162
163 2012-03-03 Jason Merrill <jason@redhat.com>
164
165 * init.c (perform_member_init): Cope with uninstantiated NSDMI.
166
167 Core 1270
168 * call.c (build_aggr_conv): Call reshape_init.
169 (convert_like_real): Likewise.
170 * typeck2.c (process_init_constructor): Clear TREE_CONSTANT if
171 not all constant.
172
173 * mangle.c (write_nested_name): Use decl_mangling_context.
174 (write_prefix, write_template_prefix): Likewise.
175
176 PR c++/36797
177 * mangle.c (write_expression): Improve diagnostic for TRAIT_EXPR.
178
179 * class.c (add_method): Always build an OVERLOAD for using-decls.
180 * search.c (lookup_member): Handle getting an OVERLOAD for a
181 single function.
182
183 2012-03-02 Paolo Carlini <paolo.carlini@oracle.com>
184
185 PR c++/51989
186 * typeck2.c (build_x_arrow): Take a tsubst_flags_t argument and
187 propagate it.
188 * cp-tree.h (build_x_arrow): Adjust prototype.
189 * pt.c (tsubst_copy_and_build): Adjust call.
190 * parser.c (cp_parser_postfix_dot_deref_expression): Likewise.
191
192 2012-03-02 Paolo Carlini <paolo.carlini@oracle.com>
193
194 * name-lookup.c (binding_to_template_parms_of_scope_p): Clean up.
195
196 2012-02-29 Jason Merrill <jason@redhat.com>
197
198 PR c++/51930
199 * decl.c (check_tag_decl): Move warning for misplaced attributes here.
200 (shadow_tag): From here.
201 * parser.c (cp_parser_explicit_instantiation): Don't warn here.
202
203 2012-02-21 Jakub Jelinek <jakub@redhat.com>
204
205 PR c++/52312
206 * typeck.c (check_literal_operator_args): Initialize *long_double_p
207 and *long_long_unsigned_p even if processing_template_decl.
208
209 2012-02-16 Jason Merrill <jason@redhat.com>
210
211 PR c++/52248
212 * decl.c (define_label): Use timevar_cond_start/stop.
213
214 2012-02-16 Fabien Chêne <fabien@gcc.gnu.org>
215
216 PR c++/52126
217 * decl.c (xref_basetypes): call dependent_scope_p instead of
218 dependent_type_p.
219
220 2012-02-16 Jason Merrill <jason@redhat.com>
221
222 PR c++/51415
223 * error.c (dump_expr): Handle lambda closures specifically.
224
225 2012-02-14 Jason Merrill <jason@redhat.com>
226
227 * parser.c (cp_parser_explicit_instantiation): Give a warning
228 for ignored attributes on explicit class instantiation.
229
230 2012-02-14 Jakub Jelinek <jakub@redhat.com>
231
232 PR c++/52247
233 * pt.c (tsubst_copy_asm_operands): For LABEL_DECL values call
234 lookup_label on label's name and set TREE_USED.
235
236 2012-02-14 Jason Merrill <jason@redhat.com>
237
238 PR c++/39055
239 * decl.c (local_variable_p_walkfn): Don't check DECL_ARTIFICIAL.
240
241 2012-02-14 Jakub Jelinek <jakub@redhat.com>
242
243 PR c/52181
244 * decl.c (duplicate_decls): If olddecl has bigger DECL_ALIGN than
245 newdecl, copy DECL_ALIGN to newdecl and or DECL_USER_ALIGN bits.
246
247 2012-02-07 Jason Merrill <jason@redhat.com>
248
249 PR c++/51675
250 * semantics.c (cx_check_missing_mem_inits): Handle unions.
251 Fix constexpr default constructor logic.
252
253 PR c++/52035
254 * pt.c (tsubst): Strip uninstantiated typedef.
255
256 2012-02-06 Jason Merrill <jason@redhat.com>
257
258 PR c++/52088
259 * cvt.c (build_expr_type_conversion): Check for template conversion.
260
261 2012-01-31 Jason Merrill <jason@redhat.com>
262
263 PR c++/52043
264 * cp-tree.h (PACK_EXPANSION_LOCAL_P): New.
265 * pt.c (make_pack_expansion, tsubst_initializer_list): Set it.
266 (tsubst_pack_expansion): Check it.
267
268 2012-01-29 Paolo Carlini <paolo.carlini@oracle.com>
269
270 PR c++/51327
271 * class.c (explain_non_literal_class): Correctly handle implicitly
272 deleted constructors.
273
274 2012-01-27 Jakub Jelinek <jakub@redhat.com>
275
276 PR c++/51852
277 * pt.c (tsubst_pack_expansion): Delete and restore
278 local_specialization whenever need_local_specialization, not just
279 when saved_local_specializations is non-NULL.
280
281 2012-01-26 Paolo Carlini <paolo.carlini@oracle.com>
282
283 PR c++/51370
284 * error.c (dump_decl, [TEMPLATE_ID_EXPR]): Handle error_mark_node
285 as TREE_OPERAND (t, 1).
286
287 2012-01-24 Jason Merrill <jason@redhat.com>
288
289 PR c++/51917
290 * decl.c (xref_basetypes): Check VEC_length instead of VEC_space.
291
292 PR c++/51973
293 * tree.c (called_fns_equal): Check template args.
294 (cp_tree_equal): Call it.
295
296 2012-01-24 Aldy Hernandez <aldyh@redhat.com>
297 Patrick Marlier <patrick.marlier@gmail.com>
298
299 PR c++/51928
300 * class.c (set_method_tm_attributes): Use TARGET_THUNK instead of
301 thunk for set_one_vmethod_tm_attributes.
302
303 2012-01-24 Paolo Carlini <paolo.carlini@oracle.com>
304
305 PR c++/51223
306 * call.c (build_over_call): Check for error_mark_node as
307 TREE_VALUE when default arguments are processed.
308
309 2012-01-23 Jason Merrill <jason@redhat.com>
310
311 PR c++/51930
312 * decl2.c (determine_visibility): Check for visibility attribute
313 on template specialization.
314
315 2012-01-23 Paolo Carlini <paolo.carlini@oracle.com>
316
317 PR c++/51398
318 * pt.c (parameter_of_template_p): Skip error_mark_node parameters.
319
320 2012-01-23 Jason Merrill <jason@redhat.com>
321
322 PR c++/51925
323 * class.c (add_method): Set OVL_USED for using-decls.
324 * tree.c (ovl_scope): New.
325 * cp-tree.h: Declare it.
326 * parser.c (cp_parser_template_name): Use it.
327 * semantics.c (baselink_for_fns): Likewise.
328 * name-lookup.c (set_inherited_value_binding_p): Likewise.
329
330 2012-01-20 Paolo Carlini <paolo.carlini@oracle.com>
331
332 PR c++/51402
333 * pt.c (lookup_template_class_1): Check context returned by
334 tsubst for error_mark_node.
335
336 2012-01-19 Kai Tietz <ktietz@redhat.com>
337
338 PR c++/51344
339 * decl2.c (save_template_attributes): Use merge_attributes
340 instead of chaining up via TREE_CHAIN.
341
342 2012-01-19 Jason Merrill <jason@redhat.com>
343
344 PR c++/51889
345 * class.c (finish_struct): Call add_method here for function usings.
346 * semantics.c (finish_member_declaration): Not here.
347
348 2012-01-18 Paolo Carlini <paolo.carlini@oracle.com>
349
350 PR c++/51225
351 * typeck2.c (store_init_value): Within a template guard
352 cxx_constant_value with require_potential_constant_expression.
353 * pt.c (convert_nontype_argument): Likewise.
354
355 2012-01-16 Jakub Jelinek <jakub@redhat.com>
356
357 PR c++/51854
358 * mangle.c (write_template_arg_literal): Handle complex.
359
360 2012-01-16 Jason Merrill <jason@redhat.com>
361
362 PR c++/51827
363 * mangle.c (mangle_decl): Don't mangle uninstantiated templates.
364
365 PR c++/51868
366 * typeck.c (build_static_cast_1): Handle bit-fields properly.
367
368 2012-01-13 Ian Lance Taylor <iant@google.com>
369
370 PR c++/50012
371 * typeck.c (enum_cast_to_int): New static function.
372 (cp_build_binary_op): When handling warn_sign_compare, don't test
373 for TREE_NO_WARNING. Do call enum_cast_to_int.
374 * call.c (avoid_sign_compare_warnings): Remove static function.
375 (build_new_op_1): Don't call avoid_sign_compare_warnings.
376
377 2012-01-13 Steven Bosscher <steven@gcc.gnu.org>
378
379 * decl2.c: Do not include tree-mudflap.h
380 * semantics.c: Likewise.
381
382 2012-01-13 Jason Merrill <jason@redhat.com>
383
384 PR c++/20681
385 * semantics.c (finish_break_stmt): Avoid adding an unreachable
386 BREAK_STMT.
387
388 PR c++/51813
389 * decl2.c (constrain_visibility): Clear DECL_VISIBILITY_SPECIFIED
390 when reducing the visibility.
391
392 PR c++/51620
393 * class.c (build_vtbl_initializer): Use __cxa_deleted_virtual.
394
395 2012-01-12 Jason Merrill <jason@redhat.com>
396
397 PR c++/51714
398 * pt.c (value_dependent_expression_p): Treat STMT_EXPR as
399 value-dependent.
400
401 2012-01-13 Dodji Seketeli <dodji@redhat.com>
402
403 PR c++/51633
404 * semantics.c (cp_parser_ctor_initializer_opt_and_function_body):
405 Set the pointer to the last block of the constructor to the
406 current statement.
407 (build_constexpr_constructor_member_initializers): Get
408 build_data_member_initialization a chance to deal with more
409 statements before we choke.
410
411 2012-01-12 Jason Merrill <jason@redhat.com>
412
413 PR c++/48051
414 * mangle.c (write_expression): Mangle BASELINK scope if
415 BASELINK_QUALIFIED_P.
416 * search.c (adjust_result_of_qualified_name_lookup): Set
417 BASELINK_QUALIFIED_P.
418 * tree.c (cp_tree_equal) [BASELINK]: Compare BASELINK_QUALIFIED_P.
419 * parser.c (cp_parser_postfix_dot_deref_expression): Don't call
420 adjust_result_of_qualified_name_lookup for non-qualified names.
421
422 PR c++/51403
423 * pt.c (unify): Handle error_mark_node.
424
425 2012-01-11 Jason Merrill <jason@redhat.com>
426
427 PR c++/51565
428 * call.c (standard_conversion): For ptrmemfuncs, compare the
429 static_fn_types.
430
431 PR c++/51818
432 * mangle.c (find_substitution): A type is only a substitution
433 match if we're looking for a type.
434 (write_nested_name): Use decl_mangling_context.
435
436 * decl.c (decls_match): Assert that the arguments are decls.
437
438 PR c++/51613
439 * pt.c (resolve_overloaded_unification): Compare types with
440 same_type_p, not decls_match.
441
442 2012-01-10 Jason Merrill <jason@redhat.com>
443
444 PR c++/51614
445 * class.c (build_base_path): Diagnose ambiguous base.
446
447 PR c++/51433
448 * semantics.c (cxx_eval_call_expression): Always retry previously
449 non-constant expressions.
450
451 2012-01-06 Jason Merrill <jason@redhat.com>
452
453 DR 686
454 PR c++/47450
455 * parser.c (cp_parser_new_expression): Set
456 type_definition_forbidden_message.
457
458 PR c++/6057
459 PR c++/48051
460 PR c++/50855
461 PR c++/51322
462 * mangle.c (write_expression): Support NEW_EXPR, DELETE_EXPR,
463 THROW_EXPR, CONSTRUCTOR, OVERLOAD. Fix PREINCREMENT_EXPR and
464 PREDECREMENT_EXPR.
465 (write_template_arg): Fix mangling of class-scope functions and
466 argument packs.
467 (mangle_decl): Update suggested -fabi-version argument.
468 * operators.def: Add DOTSTAR_EXPR, REINTERPRET_CAST_EXPR,
469 DYNAMIC_CAST_EXPR; correct CONST_CAST_EXPR, STATIC_CAST_EXPR.
470 * tree.c (dependent_name): No longer static.
471 * cp-tree.h: Declare it.
472 * pt.c (unify): Defer handling of unconverted functions.
473
474 * mangle.c (mangle_decl): Don't generate mangling aliases
475 for maybe-in-charge [cd]tors.
476
477 * error.c (dump_expr): Print type of CONSTRUCTOR.
478
479 2012-01-05 Dodji Seketeli <dodji@redhat.com>
480
481 PR c++/51541
482 * parser.c (cp_parser_alias_declaration): Get out early upon
483 errors in the identifier or the attributes.
484
485 2012-01-04 Paolo Carlini <paolo.carlini@oracle.com>
486
487 PR c++/51064
488 * pt.c (tsubst_copy_and_build): Maybe set TREE_NO_WARNING on
489 the tree returned by build_x_binary_op.
490
491 2012-01-03 Paolo Carlini <paolo.carlini@oracle.com>
492
493 PR c++/51738
494 * parser.c (cp_parser_postfix_open_square_expression): Handle
495 postfix-expression [ braced-init-list ].
496
497 2012-01-03 Paolo Carlini <paolo.carlini@oracle.com>
498
499 PR c++/29273
500 * rtti.c (build_dynamic_cast_1): In case of T a pointer type,
501 call decay_conversion on v.
502
503 2012-01-03 Paolo Carlini <paolo.carlini@oracle.com>
504
505 PR c++/15867
506 * decl.c (duplicate_decls): With -Wredundant-decls don't warn for
507 declaration followed by specialization.
508
509 2012-01-03 Jakub Jelinek <jakub@redhat.com>
510
511 PR c++/51669
512 * semantics.c (finish_omp_clauses): Call fold_build_cleanup_point_expr
513 on OMP_CLAUSE_{IF,FINAL,NUM_THREADS,SCHEDULE_CHUNK}_EXPR.
514
515 2012-01-02 Jason Merrill <jason@redhat.com>
516
517 DR 1359
518 PR c++/51675
519 * method.c (walk_field_subobs): Don't check for uninitialized
520 fields in a union.
521 (synthesized_method_walk): Check here.
522
523 DR 325
524 PR c++/51666
525 * parser.c (cp_parser_cache_defarg): Split out...
526 (cp_parser_parameter_declaration): ...from here.
527 (cp_parser_save_nsdmi): Use it.
528 (cp_parser_cache_group): Remove CPP_COMMA support.
529
530 2012-01-02 Dodji Seketeli <dodji@redhat.com>
531
532 PR c++/51462
533 * semantics.c (cx_check_missing_mem_inits): Don't assert in case
534 of error.
535
536 2012-01-02 Paolo Carlini <paolo.carlini@oracle.com>
537
538 PR c++/20140
539 * typeck2.c (digest_init_r): Use copy_init when initializing
540 an array of chars.
541
542 2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
543
544 PR c++/16603
545 * decl.c (build_enumerator): Don't call perform_integral_promotions
546 on the value.
547
548 2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
549
550 PR c++/51379
551 * typeck.c (build_reinterpret_cast_1): Implement resolution of
552 DR 799.
553
554 2012-01-01 Fabien Chêne <fabien@gcc.gnu.org>
555
556 * parser.c (cp_parser_using_declaration): Add a warning about
557 deprecated access declarations when no errors were encountered
558 while parsing the access declaration. Save the first token in
559 order to emit the warning at the right place.
560 \f
561 Copyright (C) 2012 Free Software Foundation, Inc.
562
563 Copying and distribution of this file, with or without modification,
564 are permitted in any medium without royalty provided the copyright
565 notice and this notice are preserved.