1 2011-03-16 Jason Merrill <jason@redhat.com>
4 * semantics.c (potential_constant_expression_1): Don't allow *this
6 (register_constexpr_fundef): Use potential_rvalue_constant_expression.
9 * decl.c (compute_array_index_type): Don't bother trying to deal
10 with literal classes in ABI v1.
13 * decl.c (duplicate_decls): Return NULL_TREE for clashing
17 * semantics.c (cxx_eval_constant_expression) [COMPOUND_EXPR]: Don't
18 use the generic binary expression handling.
20 2011-03-16 Diego Novillo <dnovillo@google.com>
22 * Make-lang.in (CXX_PARSER_H): New.
23 (cp/parser.o): Add dependency on CXX_PARSER_H.
24 Add dependency on tree-pretty-print.h
25 (cp/cp-lang.o): Add dependency on CXX_PARSER_H.
26 * cp-lang.c: Include parser.h.
27 * parser.c: Include parser.h.
28 (struct cp_token): Add bitfield purged_p.
31 (CPP_PURGED): Remove. Update all users.
32 (struct cp_lexer): Change field buffer to be a VEC of cp_token.
33 Remove field buffer_length.
36 (struct tree_check): Move to parser.h.
37 (cp_token_position): Likewise.
38 (struct cp_token_cache): Likewise.
39 (CPP_KEYWORD): Likewise.
40 (CPP_TEMPLATE_ID): Likewise.
41 (CPP_NESTED_NAME_SPECIFIER): Likewise.
42 (N_CP_TTYPES): Likewise.
43 (enum cp_parser_status_kind): Likewise.
44 (struct cp_parser_context): Likewise.
45 (struct cp_default_arg_entry_d): Likewise.
46 (struct cp_unparsed_functions_entry_d): Likewise.
47 (struct cp_parser): Likewise.
48 (cp_lexer_dump_tokens): New.
49 (cp_lexer_debug_tokens): New.
50 (cp_lexer_finished_p): New.
51 (cp_lexer_alloc): Factor out of cp_lexer_new_main.
52 (cp_lexer_new_main): Re-write main lexing loop to push
53 tokens into the new VEC buffer.
54 (cp_lexer_print_token): Improve printing of CPP_NUMBER tokens.
55 Do not abort if the token type is not recognized, just print
58 * config-lang.in (gtfiles): Add cp/parser.h.
60 2011-03-16 Jason Merrill <jason@redhat.com>
63 * typeck.c (check_return_expr): Fix conditions for setting
66 * call.c (build_over_call): Remove require_complete_type_sfinae call.
69 * decl.c (check_array_designated_initializer): Allow integer index.
70 (reshape_init_array_1): Set index on the elements.
72 2011-03-16 Jason Merrill <jason@redhat.com>
75 * typeck.c (convert_for_initialization): Use
76 perform_implicit_conversion_flags.
77 * call.c (standard_conversion): If LOOKUP_PREFER_RVALUE, set
78 rvaluedness_matches_p on ck_rvalue.
79 (convert_like_real) [ck_rvalue]: And restore it here.
82 * call.c (convert_arg_to_ellipsis): Handle incomplete type.
84 2011-03-16 Jason Merrill <jason@redhat.com>
86 * parser.c (cp_parser_abort_tentative_parse): Make sure we haven't
87 committed to this tentative parse.
90 * semantics.c (finish_call_expr): Preserve reference semantics
93 * call.c (convert_default_arg): Use LOOKUP_IMPLICIT.
95 2011-03-16 Jakub Jelinek <jakub@redhat.com>
97 * cp-objcp-common.c (cp_function_decl_explicit_p): Don't crash if
98 DECL_LANG_SPECIFIC is NULL.
100 2011-03-15 Jason Merrill <jason@redhat.com>
103 * pt.c (value_dependent_expression_p) [NOEXCEPT_EXPR]: Don't
104 check value_dependent_expression_p on the operand.
106 * semantics.c (push_cx_call_context): Return bool.
107 (cxx_eval_call_expression): Handle excess depth.
110 * method.c (synthesized_method_walk): Cleanups don't affect the
111 triviality of a constructor, but do affect deletion and exception
114 2011-03-15 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
116 * decl2.c (cp_check_const_attributes): New.
117 (cplus_decl_attributes): Call cp_check_const_attributes.
119 2011-03-15 Jason Merrill <jason@redhat.com>
122 * call.c (convert_default_arg): Use DECL_ORIGIN of fn. Check for
124 (push_defarg_context, pop_defarg_context): New.
125 * parser.c (cp_parser_late_parsing_default_args): Use them.
126 * cp-tree.h: Declare them.
128 2011-03-11 Dodji Seketeli <dodji@redhat.com>
130 * call.c (add_builtin_candidate)<case INDIRECT_REF>: The type of
131 the argument of the indirection operator should not be dependent.
134 2011-03-11 Jason Merrill <jason@redhat.com>
137 * pt.c (tsubst) [TYPENAME_TYPE]: Only give errors if tf_error.
140 * parser.c (cp_parser_template_type_arg): Set
141 type_definition_forbidden_message.
144 * decl.c (compute_array_index_type): Discard folding
145 if it didn't produce a constant.
147 2011-03-11 Jakub Jelinek <jakub@redhat.com>
150 * init.c (build_zero_init_1): Extracted from build_zero_init.
151 Add FIELD_SIZE argument, if non-NULL and field bit_position
152 as not smaller than that, don't add that field's initializer.
153 Pass DECL_SIZE as last argument to build_zero_init_1
154 for DECL_FIELD_IS_BASE fields.
155 (build_zero_init): Use build_zero_init_1.
157 2011-03-10 Jason Merrill <jason@redhat.com>
160 * pt.c (iterative_hash_template_arg): Remove special case for
164 * parser.c (cp_parser_single_declaration): Just return if
165 cp_parser_parse_and_diagnose_invalid_type_name complained.
167 2011-03-09 Jason Merrill <jason@redhat.com>
170 * pt.c (unify): An unresolved overload is a nondeduced context.
172 2011-03-09 Martin Jambor <mjambor@suse.cz>
174 PR tree-optimization/47714
175 * method.c (use_thunk): Clear addressable flag of thunk arguments.
177 2011-03-08 Dodji Seketeli <dodji@redhat.com>
180 * pt.c (convert_nontype_argument): Only call decay_conversion on
183 2011-03-08 Jason Merrill <jason@redhat.com>
186 * mangle.c (write_template_arg_literal) [STRING_CST]: Sorry.
189 * pt.c (convert_nontype_argument): Don't crash on non-pointer
190 argument to pointer parameter.
193 * pt.c (instantiate_decl): Don't clear DECL_INTERFACE_KNOWN on
196 2011-03-08 Dodji Seketeli <dodji@redhat.com>
199 * name-lookup.c (binding_to_template_parms_of_scope_p): Only
200 consider scopes of primary template definitions. Adjust comments.
202 2011-03-07 Jason Merrill <jason@redhat.com>
205 * pt.c (convert_nontype_argument): Fix -fpermissive allowing
207 * semantics.c (potential_constant_expression_1): Check TREE_OVERFLOW.
210 * init.c (constant_value_1): Always require init to be TREE_CONSTANT.
213 * mangle.c (write_type): Strip cv-quals from FUNCTION_TYPE here.
214 (write_CV_qualifiers_for_type): Not here.
216 2011-03-06 Joseph Myers <joseph@codesourcery.com>
218 * lang-specs.h: Match -save-temps* instead of -save-temps.
220 2011-03-05 Jason Merrill <jason@redhat.com>
222 * mangle.c (write_expression): Change ABI v6 to v5.
223 (write_type): Likewise.
225 2011-03-04 Jan Hubicka <jh@suse.cz>
228 * optimize.c (maybe_clone_body): Update call of cgraph_same_body_alias
229 and cgraph_add_thunk.
230 * method.c (make_alias_for_thunk, use_thunk): Likewise.
231 * mangle.c (mangle_decl): Likewise.
233 2011-03-04 Jason Merrill <jason@redhat.com>
236 * pt.c (tsubst_copy_and_build) [PSEUDO_DTOR_EXPR]: Use tsubst for type.
237 (tsubst_copy) [default]: Just return t if !ENABLE_CHECKING.
240 * search.c (check_final_overrider): Allow pointer to same incomplete
241 class type with different cv-quals.
243 2011-03-03 Paolo Carlini <paolo.carlini@oracle.com>
246 * pt.c (tsubst_template_args): Check argument t for error_mark_node.
248 2011-03-03 Jason Merrill <jason@redhat.com>
251 * pt.c (tsubst_copy_and_build) [TARGET_EXPR]: Retain TREE_CONSTANT.
253 2011-03-02 Jason Merrill <jason@redhat.com>
256 * parser.c (cp_parser_condition): Don't fold_non_dependent_expr here.
259 * tree.c (build_vec_init_elt): Split out from...
260 (build_vec_init_expr): ...here.
261 (diagnose_non_constexpr_vec_init): New fn.
262 * semantics.c (potential_constant_expression_1): Use it.
263 * cp-tree.h: Declare it.
265 2011-03-01 Jason Merrill <jason@redhat.com>
268 * parser.c (cp_parser_primary_expression): Don't warn about a
269 failed tentative parse.
272 * semantics.c (cxx_bind_parameters_in_call): Don't call
273 adjust_temp_type on non-constant args.
276 * call.c (standard_conversion): Provide requested cv-quals on
277 class rvalue conversion.
280 * decl2.c (grokbitfield): Handle type-dependent width.
282 2011-02-28 Jason Merrill <jason@redhat.com>
285 * class.c (update_vtable_entry_for_fn): Check BINFO_LOST_PRIMARY_P
286 after checking for a non-thunk.
288 2011-02-26 Jason Merrill <jason@redhat.com>
291 * tree.c (cp_tree_equal): Compare DECL_PARM_LEVEL.
292 * pt.c (iterative_hash_template_arg): And hash it.
295 * semantics.c (non_const_var_error): Split out from...
296 (cxx_eval_constant_expression): ...here.
297 (potential_constant_expression_1) [VAR_DECL]: Use it.
298 Allow dependent variables.
300 2011-02-24 Jason Merrill <jason@redhat.com>
302 * parser.c (cp_parser_constant_expression): Set
303 non_integral_constant_expression correctly for C++0x too.
304 (cp_parser_static_assert): Allow non-constant expression.
305 (cp_parser_direct_declarator): Expect non_constant_p to be set
307 * pt.c (value_dependent_expression_p): Handle TYPEID_EXPR.
308 * semantics.c (maybe_constant_value): Check type_unknown_p too.
309 (potential_rvalue_constant_expression): New.
310 (require_potential_rvalue_constant_expression): New.
312 2011-02-23 Jason Merrill <jason@redhat.com>
314 * cp-tree.h (DECL_PARM_LEVEL): New.
315 (struct lang_decl_parm): Add level field.
316 * name-lookup.c (function_parm_depth): New fn.
317 * name-lookup.h: Declare it.
318 * parser.c (cp_parser_parameter_declaration_list): Use it.
319 * mangle.c (struct globals): Add parm_depth field.
320 (write_bare_function_type): Adjust it.
321 (write_expression): Include the level delta in PARM_DECL mangling
324 * semantics.c (finish_decltype_type): Remove shortcut for decltype
326 * mangle.c (write_type) [DECLTYPE_TYPE]: Strip it here for abi < 6.
328 2011-02-23 Nathan Froyd <froydnj@codesourcery.com>
331 * parser.c (cp_parser_class_specifier): Require a closing brace
332 to attempt error recovery.
334 2011-02-23 Jakub Jelinek <jakub@redhat.com>
337 * pt.c (struct pending_template): Add chain_next GTY option.
338 * decl.c (struct named_label_use_entry): Likewise.
340 2011-02-22 Paolo Carlini <paolo.carlini@oracle.com>
343 * semantics.c (build_lambda_object): Bail out if a field is
346 2011-02-22 Dodji Seketeli <dodji@redhat.com>
349 * class.c (dfs_declare_virt_assop_and_dtor)
350 (declare_virt_assop_and_dtor): New static functions.
351 (add_implicitly_declared_members): Use
352 declare_virt_assop_and_dtor.
354 2011-02-21 Jason Merrill <jason@redhat.com>
357 * decl2.c (decl_constant_var_p): A constexpr var needs an
358 initializer to be constant.
359 * semantics.c (cxx_eval_constant_expression): Complain about
360 constexpr var used in its own initializer.
361 * call.c (set_up_extended_ref_temp): Set
362 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P too.
364 2011-02-20 Jason Merrill <jason@redhat.com>
367 * semantics.c (cxx_eval_call_expression): Call
368 cxx_eval_constant_expression in trivial shortcut.
371 * call.c (convert_class_to_reference): Don't try to set up a
372 second conv sequence for non-viable candidates.
375 * error.c (location_of): Handle non-tagged types.
378 * method.c (process_subob_fn): Instantiate constexpr templates.
379 * optimize.c (maybe_clone_body): Propagate DECL_DECLARED_CONSTEXPR_P.
381 2011-02-20 Dodji Seketeli <dodji@redhat.com>
384 * pt.c (tsubst_pack_expansion): do not use
385 cp_tree_equal/same_type_p to detect an expansion of a parameter
388 2011-02-19 Jason Merrill <jason@redhat.com>
391 * semantics.c (cxx_eval_call_expression): Shortcut trivial copy.
393 2011-02-18 Paolo Carlini <paolo.carlini@oracle.com>
396 * semantics.c (finish_non_static_data_member): Early return if
397 object is error_mark_node.
399 2011-02-18 Dodji Seketeli <dodji@redhat.com>
402 * pt.c (do_auto_deduction): Do not mention error_mark_node in
404 * semantics.c (finish_id_expression): Do not pass erroneous decl
405 to decl_constant_var_p.
407 2011-02-17 Jakub Jelinek <jakub@redhat.com>
410 * cvt.c (convert_from_reference): Call mark_exp_read.
412 2011-02-11 Dodji Seketeli <dodji@redhat.com>
415 * pt.c (finish_call_expr): Consider a call expression that has a
416 dependent "this" pointer as being dependent. Add comments.
417 (dependent_type_p, type_dependent_expression_p): Update comments.
419 2011-02-16 Dodji Seketeli <dodji@redhat.com>
422 * pt.c (tsubst_copy)<case SIZEOF_EXPR>: Ensure that even pack
423 expansion arguments are not evaluated.
425 2011-02-16 Jakub Jelinek <jakub@redhat.com>
428 * cp-tree.h (ENUM_FIXED_UNDERLYING_TYPE_P): Use TYPE_LANG_FLAG_5
429 instead of TYPE_LANG_FLAG_3.
430 * pt.c (lookup_template_class): Copy over
431 ENUM_FIXED_UNDERLYING_TYPE_P.
433 2011-02-15 Jason Merrill <jason@redhat.com>
436 * method.c (synthesized_method_walk): Always exit early for
437 trivial fn in C++98 mode.
439 2011-02-14 Jason Merrill <jason@redhat.com>
442 * parser.c (cp_parser_enumerator_definition): Call
443 fold_non_dependent_expr.
445 2011-02-09 Jason Merrill <jason@redhat.com>
447 * decl.c (cp_make_fname_decl): Set DECL_THIS_STATIC at toplevel.
448 * semantics.c (finish_fname): Only return the name if we're in
451 * decl.c (build_enumerator): Don't perform integral promotions on
452 non-integral constants.
454 * cvt.c (convert_to_void): Handle null op1.
456 * class.c (type_has_constexpr_default_constructor): Make sure the
457 caller stripped an enclosing array.
458 * init.c (perform_member_init): Strip arrays before calling it.
461 * semantics.c (potential_constant_expression_1): Handle TEMPLATE_DECL.
463 2011-02-03 Dodji Seketeli <dodji@redhat.com>
466 * tree.c (cp_tree_equal)<TEMPLATE_PARM_INDEX>: Take the number of
467 template parameters in account.
469 2011-02-03 Nathan Froyd <froydnj@codesourcery.com>
472 * parser.c (cp_parser_class_specifier): Fix setting of
475 2011-01-31 Jakub Jelinek <jakub@redhat.com>
478 * semantics.c (build_data_member_initialization): Handle
479 STATEMENT_LIST always instead of just for CLEANUP_BODY.
481 2011-01-31 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
483 * g++spec.c (lang_specific_driver) [HAVE_LD_STATIC_DYNAMIC] Use
484 LD_STATIC_OPTION, LD_DYNAMIC_OPTION.
486 2011-01-29 Dodji Seketeli <dodji@redhat.com>
489 * cp-tree.h (fixup_template_parms): Declare.
490 * pt.c (end_template_parm_list): Do not fixup template parms here.
491 (fixup_template_parms): Remove static. Fix typo in the
492 comments. Remove useless code statement.
493 (fixup_template_parm): For a template template parameter, fixup
494 its attributes before fixing up its type.
496 (cp_parser_template_declaration_after_export): After parsing
497 template parameters fixup their types.
499 2011-01-26 Jakub Jelinek <jakub@redhat.com>
502 * semantics.c (potential_constant_expression_1): Handle
505 2011-01-26 Dave Korn <dave.korn.cygwin@gmail.com>
508 * semantics.c (expand_or_defer_fn_1): Handle it.
509 * decl2.c (decl_needed_p): Likewise.
511 2011-01-21 Jason Merrill <jason@redhat.com>
514 * semantics.c (build_constexpr_constructor_member_initializers):
517 2011-01-21 Jakub Jelinek <jakub@redhat.com>
520 * semantics.c (begin_for_stmt): If -fno-for-scope, don't
521 assume init must be NULL if scope is NULL.
522 (begin_range_for_stmt): Likewise.
524 2011-01-21 Jason Merrill <jason@redhat.com>
527 * semantics.c (cxx_eval_constant_expression): Handle OFFSET_REF.
530 * semantics.c (potential_constant_expression_1): Split out from
531 potential_constant_expression. Add want_rval parm. Handle
532 template expression forms. Don't enforce restriction on address
533 of automatic variable here. Add a couple of diagnostics that
535 (require_potential_constant_expression): New entry point.
536 (build_data_member_initialization, register_constexpr_fundef): Adjust.
537 (maybe_constant_value): Check potential_constant_expression.
538 * pt.c (fold_non_dependent_expr_sfinae): Likewise.
539 * tree.c (build_vec_init_expr): Adjust.
541 2011-01-19 Jakub Jelinek <jakub@redhat.com>
544 * decl2.c (finish_anon_union): Only call mangle_decl if TREE_STATIC
547 2011-01-17 Jason Merrill <jason@redhat.com>
550 * semantics.c (base_field_constructor_elt): New fn.
551 (cxx_eval_bare_aggregate): Use it.
552 (build_data_member_initialization): Leave COMPONENT_REF for
555 2011-01-14 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
557 * parser.c (cp_parser_range_for): Remove the "unused variable" warning
560 2011-01-15 Giovanni Funchal <gafunchal@gmail.com>
561 Jonathan Wakely <jwakely.gcc@gmail.com>
564 * decl.c (grokdeclarator): Reject mutable reference members.
566 2011-01-14 Jason Merrill <jason@redhat.com>
569 * pt.c (coerce_template_parms): Fix error recovery.
572 * typeck2.c (check_narrowing): Only check arithmetic types.
575 * tree.c (build_vec_init_expr): Handle flexible array
578 2011-01-13 Kai Tietz <kai.tietz@onevision.com>
581 * cp-tree.h (CLASSTYPE_VISIBILITY): Use
582 TYPE_MAIN_DECL instead of TYPE_NAME.
583 (CLASSTYPE_VISIBILITY_SPECIFIED): Likewise.
584 * decl2.c (determine_visibility): Add check
585 of CLASS_TYPE_P for underlying_type.
587 2011-01-12 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
589 * cp-tree.h (begin_for_scope): New prototype.
590 (begin_for_stmt): Update prototype.
591 (begin_range_for_stmt): Update prototype.
592 * init.c (build_vec_init): Update call to begin_for_stmt.
593 * parser.c (cp_parser_for): New.
594 (cp_parser_c_for): Add three new parameters.
595 (cp_parser_range_for): Likewise. Most parsing code removed.
596 (cp_parser_iteration_statement): Call cp_parser_for instead of
597 cp_parser_c_for and cp_parser_range_for.
598 (cp_parser_for_init_statement): Add new parameter and return type.
599 (cp_parser_block_declaration): Update call to
600 cp_parser_simple_declaration.
601 (cp_parser_simple_declaration): Add new parameter.
602 Update call to cp_parser_init_declarator.
603 (cp_parser_init_declarator): Add new parameter.
604 * pt.c (tsubst_expr): Update call to begin_for_stmt.
605 * semantics.c (begin_for_scope): New.
606 (begin_for_stmt): Add two new parameters.
607 (begin_range_for_stmt): Likewise.
609 2011-01-12 Nicola Pero <nicola.pero@meta-innovation.com>
611 * parser.c (cp_parser_objc_at_property_declaration): Improved
614 2011-01-11 Dodji Seketeli <dodji@redhat.com>
617 * cp-lang.c (get_template_innermost_arguments_folded)
618 (get_template_argument_pack_elems_folded)
619 (template_arg_needs_folding, fold_cplus_constants): New static
621 (LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS): Set this hook to
622 get_template_innermost_arguments_folded.
623 (LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS): Set this hook to
624 get_template_argument_pack_elems_folded.
626 2011-01-11 Jason Merrill <jason@redhat.com>
629 * init.c (build_new_1): Handle value-init in templates differently.
632 * tree.c (maybe_dummy_object): Check current_class_ref against
633 context, not current_class_type.
635 2011-01-08 Nicola Pero <nicola.pero@meta-innovation.com>
638 * parser.c (cp_parser_objc_typename): If the type is unknown, for
639 error recovery purposes behave as if it was not specified so that
640 the default type is used.
642 2011-01-07 Jakub Jelinek <jakub@redhat.com>
645 * pt.c (tsubst_copy_and_build): Use tsubst instead of tsubst_copy
646 for the second build_x_va_arg argument.
648 2011-01-05 Tom Tromey <tromey@redhat.com>
650 * typeck.c (cp_build_addr_expr_1): Update call to lvalue_error.
651 (lvalue_or_else): Likewise.
653 2011-01-01 Kai Tietz <kai.tietz@onevision.com>
656 * tree.c (cxx_type_hash_eq):
657 Allow METHOD_TYPE, too.
660 Copyright (C) 2011 Free Software Foundation, Inc.
662 Copying and distribution of this file, with or without modification,
663 are permitted in any medium without royalty provided the copyright
664 notice and this notice are preserved.