re PR c++/29727 (ICE on invalid initializer for template member)
[platform/upstream/gcc.git] / gcc / cp / ChangeLog
1 2009-03-27  Simon Martin  <simartin@users.sourceforge.net>
2
3         PR c++/29727
4         * decl.c (check_array_designated_initializer): Handle error_mark_node.
5
6 2009-03-27  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
7
8         PR c++/35652
9         * typeck.c (cp_pointer_sum): Adjust call to pointer_int_sum.
10
11 2009-03-26  Andrew Haley  <aph@redhat.com>
12
13         PR C++/39380
14         * decl2.c (possibly_inlined_p): If java exceptions are in use
15         don't inline a decl unless it is explicitly marked inline.
16         * lex.c: (pragma_java_exceptions): New variable.
17         (handle_pragma_java_exceptions): Set pragma_java_exceptions.
18         * cp-tree.h (pragma_java_exceptions): Declare new variable.
19
20 2009-03-24  Jason Merrill  <jason@redhat.com>
21
22         PR c++/28274
23         * name-lookup.c (pushdecl_maybe_friend): Check default args later.
24
25 2009-03-23  Jakub Jelinek  <jakub@redhat.com>
26
27         PR c/39495
28         * semantics.c (handle_omp_for_class_iterator): Swap cond operands and
29         code if iter is the second operand.
30         * parser.c (cp_parser_binary_expression): Add no_toplevel_fold_p
31         argument.  If it is set, don't build the toplevel expression with
32         build_x_binary_op, but build2.
33         (cp_parser_assignment_expression,  cp_parser_omp_for_incr): Adjust
34         callers.
35         (cp_parser_omp_for_cond): Don't assume the first operand of the
36         comparison must be decl.
37
38 2009-03-23  Jason Merrill  <jason@redhat.com>
39
40         PR c++/37729
41         * pt.c (make_fnparm_pack): Split out from...
42         (instantiate_decl): ...here.
43         (tsubst_pack_expansion): Handle being called in a late-specified
44         return type.
45
46         PR c++/39526
47         * name-lookup.c (pushdecl_maybe_friend): Don't warn about shadowing
48         a parm with a parm.
49
50 2009-03-20  Jason Merrill  <jason@redhat.com>
51
52         PR c++/28879
53         * parser.c (cp_parser_direct_declarator): In a template, wrap 
54         non-constant expression in NOP_EXPR with TREE_SIDE_EFFECTS set.
55         * pt.c (tsubst): Preserve it in a partial instantiation.
56         (dependent_type_p_r): Don't check value_dependent_expression_p.
57         * decl.c (compute_array_index_type): Don't check
58         value_dependent_expression_p if TREE_SIDE_EFFECTS.
59
60         C++ core issue 703
61         * typeck2.c (check_narrowing): Don't complain about loss of 
62         precision when converting a floating-point constant.
63
64 2009-03-19  Jakub Jelinek  <jakub@redhat.com>
65
66         PR c/39495
67         * parser.c (cp_parser_omp_for_cond): Don't check lhs if decl is NULL.
68         (cp_parser_omp_for_loop): Always use cp_parser_omp_for_cond.
69
70 2009-03-18  Jakub Jelinek  <jakub@redhat.com>
71
72         * parser.c (struct cp_token): Reorder fields for 64-bit hosts.
73         (eof_token): Adjust.
74
75 2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>
76
77         PR c++/39425
78         * parser.c (cp_parser_explicit_specialization): Don't skip the
79         rest of the specialization when begin_specialization returns
80         false.
81
82 2009-03-17  Jason Merrill  <jason@redhat.com>
83
84         * decl.c (grokfndecl): Set DECL_CONTEXT on parms.
85         (duplicate_decls): Adjust DECL_CONTEXT of newdecl's parms.
86         * pt.c (check_explicit_specialization): Likewise.
87         (tsubst_copy) [PARM_DECL]: Return a dummy parm if we don't have a
88         local specialization.
89         * tree.c (cp_tree_equal) [PARM_DECL]: Check type and index, not name.
90         * decl2.c (parm_index): New fn.
91         * semantics.c (finish_decltype_type): Don't use describable_type.
92         * mangle.c (write_expression): Likewise.  Mangle ALIGNOF_EXPR.
93         Give a sorry for unsupported codes rather than crash.  Mangle
94         conversions with other than 1 operand.  New mangling for PARM_DECL.
95         * operators.def (ALIGNOF_EXPR): Mangle as "az".
96
97 2009-03-17  Jing Yu  <jingyu@google.com>
98
99         PR middle-end/39378
100         * method.c (use_thunk): Change is_thunk from crtl to cfun.
101
102 2009-03-17  Paolo Carlini  <paolo.carlini@oracle.com>
103
104         PR c++/39475
105         * semantics.c (check_trait_type): New.
106         (finish_trait_expr): Use it.
107
108 2009-03-17  Jakub Jelinek  <jakub@redhat.com>
109
110         * name-lookup.c (cp_emit_debug_info_for_using): Emit USING_STMTs
111         instead of calling imported_module_or_decl debug hook if
112         building_stmt_tree ().
113         * cp-gimplify.c (cp_gimplify_expr): Don't assert the first operand
114         is a NAMESPACE_DECL.
115
116         PR debug/37890
117         * name-lookup.c (do_namespace_alias): Don't call global_decl debug
118         hook at function scope.
119
120         PR debug/39471
121         * cp-gimplify.c (cp_gimplify_expr): Don't set DECL_NAME
122         on IMPORTED_DECL.
123
124 2009-03-09  Jakub Jelinek  <jakub@redhat.com>
125
126         PR c++/39371
127         * semantics.c (finish_switch_cond): Don't call get_unwidened.
128         * decl.c (finish_case_label): Pass SWITCH_STMT_TYPE as 3rd argument
129         instead of TREE_TYPE (cond).
130
131 2009-03-08  H.J. Lu  <hongjiu.lu@intel.com>
132
133         PR c++/39060
134         * parser.c (cp_parser_late_parsing_default_args): Continue
135         the loop when cp_parser_assignment_expression returns
136         error_mark_node.
137
138 2009-03-07  Jason Merrill  <jason@redhat.com>
139
140         PR c++/39367
141         * init.c (build_new_1): Don't use a VLA type.
142         (build_vec_init): Handle getting a pointer for BASE.
143
144 2009-03-06  H.J. Lu  <hongjiu.lu@intel.com>
145
146         PR c++/37520
147         * cp-tree.h: Check NO_DOT_IN_LABEL before NO_DOLLAR_IN_LABEL
148         when mangling symbols.
149
150 2009-03-06  Paolo Carlini  <paolo.carlini@oracle.com>
151
152         PR c++/33492
153         * error.c (dump_expr): Don't try to print THROW_EXPRs in full.
154
155 2009-03-06  Alexandre Oliva  <aoliva@redhat.com>
156
157         * decl.c (record_builtin_java_type): Use canonicalized integer
158         types.
159
160 2009-03-04  Jason Merrill  <jason@redhat.com>
161
162         PR c++/38908
163         * class.c (is_really_empty_class): New fn.
164         * cp-tree.h: Declare it.
165         * cp-objcp-common.c (cp_expr_size): Use it.
166
167         PR c++/13549
168         * semantics.c (perform_koenig_lookup): Handle TEMPLATE_ID_EXPR.
169         * parser.c (cp_parser_postfix_expression): Call it for 
170         TEMPLATE_ID_EXPR.
171         * tree.c (is_overloaded_fn): Look through TEMPLATE_ID_EXPR.
172         (get_first_fn): Likewise.
173
174         PR c++/9634
175         PR c++/29469
176         PR c++/29607
177         Implement DR 224.
178         * decl.c (make_typename_type): Do look inside currently open classes.
179         * parser.c (cp_parser_lookup_name): Likewise.
180         (cp_parser_template_name): Likewise.
181         * pt.c (dependent_scope_p): New function.
182         * cp-tree.h: Declare it.
183         * class.c (currently_open_class): Return fast if T isn't a class.
184
185 2009-02-26  H.J. Lu  <hongjiu.lu@intel.com>
186
187         PR c++/37789
188         * parser.c (cp_parser_mem_initializer): Return error_mark_node
189         if cp_parser_mem_initializer_id returns error_mark_node.
190
191 2009-02-24  Richard Guenther  <rguenther@suse.de>
192
193         PR c++/39242
194         * pt.c (instantiate_decl): Do not instantiate extern, non-inline
195         declared functions.
196
197 2009-02-23  H.J. Lu  <hongjiu.lu@intel.com>
198
199         PR c++/36411
200         * pt.c (coerce_template_template_parms): Return 0 if parameter
201         is error_mark_node.
202
203 2009-02-23  Jason Merrill  <jason@redhat.com>
204
205         * pt.c (unify): Call maybe_adjust_types_for_deduction when
206         deducing from an initializer list.
207
208 2009-02-20  Jason Merrill  <jason@redhat.com>
209
210         PR c++/39225
211         * decl.c (grokdeclarator): Handle ~identifier.
212
213 2009-02-19  Jakub Jelinek  <jakub@redhat.com>
214
215         PR target/39175
216         * decl2.c (determine_visibility): If visibility changed and
217         DECL_RTL has been already set, call make_decl_rtl to update symbol
218         flags.
219
220 2009-02-19  H.J. Lu  <hongjiu.lu@intel.com>
221
222         PR c++/39188
223         * cp-tree.h (maybe_commonize_var): New.
224
225         * decl.c (maybe_commonize_var): Make it extern.
226
227         * decl2.c (finish_anon_union): Call maybe_commonize_var.
228
229 2009-02-18  H.J. Lu  <hongjiu.lu@intel.com>
230
231         PR c++/39219
232         * parser.c (cp_parser_enum_specifier): Apply all attributes.
233
234 2009-02-18  Jason Merrill  <jason@redhat.com>
235
236         * cfns.h: Tweak pathname for cfns.gperf.
237
238 2009-02-13  Jason Merrill  <jason@redhat.com>
239
240         PR c++/39070
241         * semantics.c (finish_call_expr): Change koenig_p parm to int.
242         If -1, don't set KOENIG_LOOKUP_P but do keep hidden candidates.
243         * cp-tree.h: Adjust prototype.
244         * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Pass -1.
245
246 2009-02-12  Jason Merrill  <jason@redhat.com>
247
248         PR c++/38950
249         * pt.c (unify)[TEMPLATE_PARM_INDEX]: Convert to the tsubsted type.
250
251 2009-02-11  Jason Merrill  <jason@redhat.com>
252
253         PR c++/39153
254         * decl2.c (cp_write_global_declarations): 
255         Check DECL_DEFAULTED_FN, not DECL_ARTIFICIAL.
256
257         PR c++/30111
258         * init.c (build_value_init_noctor): Split out from...
259         (build_value_init): ...here.
260         (expand_aggr_init_1): Handle value-initialization.
261         * cp-tree.h: Add declaration.
262         * class.c (type_has_user_provided_constructor): 
263         Handle non-class arguments.
264
265 2009-02-10  Jason Merrill  <jason@redhat.com>
266
267         PR c++/38649
268         * class.c (defaultable_fn_p): Handle ... properly.
269
270         PR c++/36744
271         * tree.c (lvalue_p_1): Condition rvalue ref handling on
272         treat_class_rvalues_as_lvalues, too.
273
274 2009-02-10  Paolo Carlini  <paolo.carlini@oracle.com>
275
276         PR c++/34397
277         * typeck.c (build_x_array_ref): New.
278         * cp-tree.h: Declare it.
279         * pt.c (tsubst_copy_and_build): Use it for case ARRAY_REF.
280
281 2009-02-09  Jason Merrill  <jason@redhat.com>
282
283         PR c++/39109
284         * semantics.c (simplify_aggr_init_expr): Do zero-initialization here.
285         * init.c (build_value_init): Not here. Don't build a TARGET_EXPR.
286         * tree.c (get_target_expr): Handle AGGR_INIT_EXPR.
287         * cp-gimplify.c (cp_gimplify_init_expr): Remove special handling
288         for build_value_init TARGET_EXPR.
289         * cp-tree.h (AGGR_INIT_ZERO_FIRST): New macro.
290
291 2009-02-06  Paolo Carlini  <paolo.carlini@oracle.com>
292
293         PR c++/35147
294         PR c++/37737
295         * cp-tree.h (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Check TREE_VEC_LENGTH.
296
297 2009-02-04  Jakub Jelinek  <jakub@redhat.com>
298
299         PR c++/39095
300         * operators.def: Use COMPONENT_REF code for ->/pt operator again,
301         remove ./dt operator.
302         * mangle.c (write_expression): Handle COMPONENT_REF after handling
303         ADDR_EXPR, for COMPONENT_REF without ARROW_EXPR inside of it
304         write_string ("dt") instead of using operators.def.
305
306 2009-02-03  Jason Merrill  <jason@redhat.com>
307
308         * typeck.c (cp_build_unary_op): Only complain about taking address
309         of main if pedantic.
310
311 2009-02-03  Jakub Jelinek  <jakub@redhat.com>
312
313         PR inline-asm/39059
314         * parser.c (cp_parser_primary_expression): Reject FIXED_CSTs.
315
316         PR c++/39056
317         * typeck2.c (digest_init_r): Don't call process_init_constructor
318         for COMPLEX_TYPE.
319
320 2009-02-03  Paolo Bonzini  <bonzini@gnu.org>
321
322         PR c++/36897
323         * pt.c (convert_nontype_argument_function): Expect expr to be an
324         ADDR_EXPR.
325
326         PR c++/37314
327         * typeck.c (merge_types): Call resolve_typename_type if only
328         one type is a typename.
329
330 2009-02-02  Jason Merrill  <jason@redhat.com>
331
332         PR c++/39054
333         * parser.c (cp_parser_unqualified_id): Don't wrap error_mark_node 
334         in BIT_NOT_EXPR.
335
336 2009-02-01  Paolo Carlini  <paolo.carlini@oracle.com>
337
338         PR c++/39053
339         * parser.c (cp_parser_pure_specifier): If there are no tokens left
340         do not call cp_lexer_consume_token.
341
342 2009-01-30  Jakub Jelinek  <jakub@redhat.com>
343
344         PR c++/39028
345         * parser.c (cp_parser_already_scoped_statement): Handle __label__
346         declarations.
347
348 2009-01-30  Paolo Carlini  <paolo.carlini@oracle.com>
349
350         PR c++/33465
351         * error.c (dump_expr): Handle FIX_TRUNC_EXPR and FLOAT_EXPR.
352
353 2009-01-30  Paolo Carlini  <paolo.carlini@oracle.com>
354
355         PR c++/38655
356         * error.c (dump_type_prefix, dump_type_suffix): Handle FIXED_POINT_TYPE.
357
358 2009-01-29  Paolo Carlini  <paolo.carlini@oracle.com>
359
360         * typeck.c (invalid_nonstatic_memfn_p): Use
361         DECL_NONSTATIC_MEMBER_FUNCTION_P.
362
363 2009-01-27  Paolo Carlini  <paolo.carlini@oracle.com>
364
365         PR c++/37554
366         * call.c (build_over_call): If convert_for_arg_passing returns
367         error_mark_node unconditionally return it.
368
369 2009-01-22  Adam Nemet  <anemet@caviumnetworks.com>
370
371         * class.c (check_field_decls): Also inherit packed for bitfields
372         regardless of their type.
373
374 2009-01-22  Dodji Seketeli  <dodji@redhat.com>
375
376         PR c++/38930
377         * decl2.c (grokfield): Reverting changes of PR c++/26693
378         (save_template_attributes): Likewise.
379         * decl.c (grokdeclarator): Likewise.
380         * name-lookup.c (pushdecl_maybe_friend): Likewise.
381         * cp-tree.h (MEMBER_TYPES_NEEDING_ACCESS_CHECK): Likewise.
382         (append_type_to_template_for_access_check): Likewise.
383         * semantics.c (check_accessibility_of_qualified_id): Likewise.
384         * pt.c (instantiate_class_template, instantiate_template ): Likewise.
385         (tsubst): Likewise.
386         (resolve_type_name_type): Likewise.
387         (append_type_to_template_for_access_check): Likewise.
388
389 2009-01-21  Dodji Seketeli  <dodji@redhat.com>
390
391         PR c++/26693
392         * decl2.c (grokfield): when a typedef appears in a
393         class, create the typedef variant type node for it.
394         (save_template_attributes): Creating typedef variant type node
395          here is now useless.
396         * decl.c (grokdeclarator): If the typedef'ed struct/class was
397         anonymous, set the proper type name to all its type variants.
398         * name-lookup.c (pushdecl_maybe_friend): Reuse the
399         set_underlying_type function to install typedef variant types.
400         * cp-tree.h (MEMBER_TYPES_NEEDING_ACCESS_CHECK): New template accessor
401         macro.
402         (append_type_to_template_for_access_check): New entry points.
403         * semantics.c (check_accessibility_of_qualified_id):
404         When a typedef that is a member of a class appears in a template,
405         add it to the template. It will be ...
406         * pt.c (instantiate_class_template, instantiate_template ): ... access
407         checked at template instantiation time.
408         (tsubst): Handle the case of being called with NULL args.
409         (resolve_type_name_type): The type name should be the name of the
410         main type variant.
411         (append_type_to_template_for_access_check): New entry point.
412
413 2009-01-19  Jason Merrill  <jason@redhat.com>
414
415         PR c++/23287
416         * parser.c (cp_parser_unqualified_id): In a template,
417         accept ~identifier.
418         * typeck.c (lookup_destructor): Handle IDENTIFIER_NODE.
419
420 2009-01-16  Jason Merrill  <jason@redhat.com>
421
422         PR c++/38877
423         * tree.c (lvalue_p_1): Allow non-fields in COMPONENT_REF.
424         * init.c (build_new): Don't call describable_type unless we
425         have an auto.
426
427         PR c++/29470
428         * pt.c (tsubst_decl) [USING_DECL]: Propagate access flags.
429
430         PR c++/38579
431         * search.c (protected_accessible_p): N doesn't vary.
432
433 2009-01-15  Jason Merrill  <jason@redhat.com>
434
435         PR c++/38850
436         * pt.c (tsubst_copy_and_build): Tell finish_call_expr to
437         accept hidden friends.
438
439 2009-01-15  Andrew Pinski  <andrew_pinski@playstation.sony.com>
440
441         PR C++/29388
442         * decl.c (grokdeclarator): Check for a non namespace/class context.
443
444 2009-01-15  Jason Merrill  <jason@redhat.com>
445
446         PR c++/36334
447         PR c++/37646
448         * tree.c (lvalue_p_1): Handle BASELINK.  A COMPONENT_REF to
449         a function isn't necessarily an lvalue. Take tree, not const_tree.
450         (lvalue_p, real_lvalue_p): Take tree, not const_tree.
451         * typeck.c (lvalue_or_else): Likewise.
452         * cp-tree.h: Adjust prototypes.
453
454 2009-01-15  Steve Ellcey  <sje@cup.hp.com>
455
456         PR c++/38357
457         * pt.c (tsubst): Check for NULL args.
458
459 2009-01-15  Dodji Seketeli  <dodji@redhat.com>
460
461         PR c++/38636
462         * name-lookup.c (pushtag): Don't create members to types that are not
463         being created.
464
465 2009-01-14  Nick Clifton  <nickc@redhat.com>
466
467         PR c++/37862
468         * parser.c: Pass cp_id_kind computed in
469         cp_parser_postfix_dot_deref_expression to
470         cp_parser_primary_expression.
471
472 2009-01-13  Jakub Jelinek  <jakub@redhat.com>
473
474         PR c++/38795
475         * tree.c (cp_walk_subtrees): Handle REINTERPRET_CAST_EXPR,
476         STATIC_CAST_EXPR, CONST_CAST_EXPR and DYNAMIC_CAST_EXPR the same
477         as CAST_EXPR.
478
479 2009-01-12  Jason Merrill  <jason@redhat.com>
480             Steve Ellcey  <sje@cup.hp.com>
481
482         PR c++/35109
483         * name-lookup.c (lookup_name_real): Keep looking past a hidden 
484         binding.
485
486 2009-01-12  Dodji Seketeli  <dodji@redhat.com>
487
488         PR c++/36019
489         * pt.c (parameter_of_template_p): New function.
490         * cp-tree.h: Declare it.
491         * name-lookup.c (binding_to_template_parms_of_scope_p): New
492         function.
493         (outer_binding): Take template parameters in account when looking for
494         a name binding.
495
496 2009-01-12  Jason Merrill  <jason@redhat.com>
497
498         PR c++/31488
499         * tree.c (pod_type_p): Return 1 for structs created by the back end.
500
501 2009-01-12  Jakub Jelinek  <jakub@redhat.com>
502
503         PR c/32041
504         * parser.c (cp_parser_builtin_offsetof): Allow `->' in
505         offsetof member-designator, handle it as `[0].'.
506
507         PR c++/38794
508         * decl.c (start_function): If grokdeclarator hasn't returned
509         FUNCTION_DECL nor error_mark_node, issue diagnostics.
510
511 2009-01-11  Jakub Jelinek  <jakub@redhat.com>
512
513         PR c++/36254
514         * cp-gimplify.c (genericize_if_stmt): Renamed from ...
515         (gimplify_if_stmt): ... this.
516         (cp_gimplify_expr): Don't handle IF_STMT here.
517         (cp_genericize_r): Call genericize_if_stmt for IF_STMT.
518
519 2009-01-10  Andrew Pinski  <pinskia@gmail.com>
520
521         PR c++/38648
522         * typeck.c (cp_build_modify_expr): Check for NULL current_function_decl.
523
524         PR c++/36695
525         * typeck2.c (build_functional_cast): Check for reference type and NULL
526         PARMS.
527
528 2009-01-09  Steve Ellcey  <sje@cup.hp.com>
529
530         * typeck.c (cp_build_unary_op): Check for ERROR_MARK.
531
532 2009-01-09  Jakub Jelinek  <jakub@redhat.com>
533
534         PR c++/35335
535         * error.c (dump_expr): Handle EXPR_STMT like BIND_EXPR.
536
537 2009-01-09  John F. Carr  <jfc@mit.edu>
538
539         PR c++/37877
540         * parser.c (cp_parser_class_specifier): Clear
541         parser->in_unbraced_linkage_specification_p while parsing class
542         specifiers.
543
544 2009-01-07  Jakub Jelinek  <jakub@redhat.com>
545
546         PR c++/38725
547         * semantics.c (finish_goto_stmt): Convert destination to
548         void *.
549
550 2009-01-06  Jason Merrill  <jason@redhat.com>
551
552         PR c++/35297
553         PR c++/35477
554         PR c++/35784
555         PR c++/36846
556         PR c++/38276
557         * pt.c (check_default_tmpl_args): Don't complain about
558         out-of-order parameter packs in the enclosing class
559         or parameter packs after default args.
560         (coerce_template_parms): If we have more than one
561         parameter pack, don't flatten argument packs.
562         (template_args_equal): Handle argument packs.
563         (comp_template_args): Don't flatten argument packs.
564         (check_instantiated_arg): Split out from...
565         (check_instantiated_args): Here.  Handle arg packs.
566         (convert_template_argument): Just check that nontype argument
567         packs have the right type.
568
569 2009-01-05  Dodji Seketeli  <dodji@redhat.com>
570
571         PR c++/38472
572         * typeck.c (type_after_usual_arithmetic_conversions): Fix a typo.
573
574 2009-01-05  Jason Merrill  <jason@redhat.com>
575
576         PR c++/38698
577         * typeck2.c (process_init_constructor_union): Handle union with
578         no fields.
579
580         * mangle.c (write_expression): Remove mangling for zero-operand
581         casts.
582
583         PR c++/38701
584         * decl.c (cp_finish_decl): Clear DECL_INITIAL for invalid
585         defaulting.
586
587         PR c++/38702
588         * class.c (defaultable_fn_p): Only operator== can be a copy
589         assignment operator.
590
591 2009-01-02  Jason Merrill  <jason@redhat.com>
592
593         PR c++/38698
594         * typeck2.c (process_init_constructor_union): Handle excess
595         initializers.
596         (process_init_constructor_record): Likewise.
597
598         PR c++/38684
599         * typeck2.c (digest_init_r): Don't use process_init_constructor
600         for non-aggregate classes.