summaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Fix PR c++/47172"Dodji Seketeli2011-02-111-13/+1
| | | | | | | | | | | | | | gcc/cp/ * pt.c (finish_call_expr, dependent_type_p) (type_dependent_expression_p): Revert the previous attempt to fix PR c++/47172. gcc/testsuite/ * g++.dg/template/inherit6.C: Reverted. From-SVN: r170055
* re PR c++/47172 ([C++0x] cannot call member function without object)Dodji Seketeli2011-02-111-1/+13
| | | | | | | | | | | | | | | | | Fix PR c++/47172 gcc/cp/ PR c++/47172 * pt.c (finish_call_expr): Consider a call expression that has a dependent "this" pointer as being dependent. Add comments. (dependent_type_p, type_dependent_expression_p): Update comments. gcc/testsuite/ * g++.dg/template/inherit6.C: New test. From-SVN: r170045
* decl.c (cp_make_fname_decl): Set DECL_THIS_STATIC at toplevel.Jason Merrill2011-02-101-1/+1
| | | | | | | | * decl.c (cp_make_fname_decl): Set DECL_THIS_STATIC at toplevel. * semantics.c (finish_fname): Only return the name if we're in a function. From-SVN: r170009
* re PR c++/47511 ([C++0x] ICE: unexpected ast of kind template_decl in ↵Jason Merrill2011-02-101-0/+1
| | | | | | | | | potential_constant_expression_1, at cp/semantics.c:7711) PR c++/47511 * semantics.c (potential_constant_expression_1): Handle TEMPLATE_DECL. From-SVN: r170005
* re PR c++/47416 (ICE in build_data_member_initialization, at ↵Jakub Jelinek2011-01-311-12/+11
| | | | | | | | | | | | cp/semantics.c:5509) PR c++/47416 * semantics.c (build_data_member_initialization): Handle STATEMENT_LIST always instead of just for CLEANUP_BODY. * g++.dg/cpp0x/pr47416.C: New test. From-SVN: r169447
* re PR c++/47476 ([C++0x] ICE in potential_constant_expression_1)Jakub Jelinek2011-01-261-0/+1
| | | | | | | | | | PR c++/47476 * semantics.c (potential_constant_expression_1): Handle TRUTH_XOR_EXPR. * g++.dg/cpp0x/pr47476.C: New test. From-SVN: r169306
* c.opt (-fkeep-inline-dllexport): New switch.Dave Korn2011-01-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc/c-family/ChangeLog: * c.opt (-fkeep-inline-dllexport): New switch. gcc/ChangeLog: * tree.c (handle_dll_attribute): Handle it. * doc/extend.texi (@item dllexport): Mention it. * doc/invoke.texi (@item -fno-keep-inline-dllexport): Document it. gcc/cp/ChangeLog: * semantics.c (expand_or_defer_fn_1): Handle it. * decl2.c (decl_needed_p): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/dll-9a.c: New test file. * gcc.dg/dll-11.c: Likewise. * gcc.dg/dll-12.c: Likewise. * gcc.dg/dll-12a.c: Likewise. * gcc.dg/dll-11a.c: Likewise. * gcc.dg/dll-9.c: Likewise. * gcc.dg/dll-10.c: Likewise. * gcc.dg/dll-10a.c: Likewise. * g++.dg/ext/dllexport4a.cc: Likewise. * g++.dg/ext/dllexport4.C: Likewise. * g++.dg/ext/dllexport5.C: Likewise. * g++.dg/ext/dllexport5a.cc: Likewise. From-SVN: r169268
* re PR c++/47041 (Internal compiler error in ↵Jason Merrill2011-01-211-1/+14
| | | | | | | | | | build_data_member_initialization, add cp/semantics.c:5483) PR c++/47041 * semantics.c (build_constexpr_constructor_member_initializers): Handle trivial copy. From-SVN: r169108
* re PR c++/47388 (ICE: in begin_for_stmt, at cp/semantics.c:863 with ↵Jakub Jelinek2011-01-211-5/+7
| | | | | | | | | | | | | | -fno-for-scope and for(;;) inside a template) PR c++/47388 * semantics.c (begin_for_stmt): If -fno-for-scope, don't assume init must be NULL if scope is NULL. (begin_range_for_stmt): Likewise. * g++.dg/cpp0x/range-for10.C: New test. * g++.dg/template/for1.C: New test. From-SVN: r169105
* re PR c++/46552 ([C++0x] Internal compiler error on pointer to member ↵Jason Merrill2011-01-211-0/+1
| | | | | | | | | variable with template) PR c++/46552 * semantics.c (cxx_eval_constant_expression): Handle OFFSET_REF. From-SVN: r169099
* re PR c++/46977 ([C++0x] ICE: SIGSEGV in htab_find_slot_with_hash ↵Jason Merrill2011-01-211-47/+147
| | | | | | | | | | | | | | | | | | (hashtab.c:650)) PR c++/46977 * semantics.c (potential_constant_expression_1): Split out from potential_constant_expression. Add want_rval parm. Handle template expression forms. Don't enforce restriction on address of automatic variable here. Add a couple of diagnostics that had been missing. (require_potential_constant_expression): New entry point. (build_data_member_initialization, register_constexpr_fundef): Adjust. (maybe_constant_value): Check potential_constant_expression. * pt.c (fold_non_dependent_expr_sfinae): Likewise. * tree.c (build_vec_init_expr): Adjust. From-SVN: r169096
* re PR c++/47067 ([c++0x] ICE in cxx_eval_bare_aggregate, at cp/semantics.c:6352)Jason Merrill2011-01-171-18/+41
| | | | | | | | | | PR c++/47067 * semantics.c (base_field_constructor_elt): New fn. (cxx_eval_bare_aggregate): Use it. (build_data_member_initialization): Leave COMPONENT_REF for vfield inits. From-SVN: r168937
* cp-tree.h (begin_for_scope): New prototype.Rodrigo Rivas Costa2011-01-121-10/+44
| | | | | | | | | | | | | | | | | | | | | | | | * cp-tree.h (begin_for_scope): New prototype. (begin_for_stmt): Update prototype. (begin_range_for_stmt): Update prototype. * init.c (build_vec_init): Update call to begin_for_stmt. * parser.c (cp_parser_for): New. (cp_parser_c_for): Add three new parameters. (cp_parser_range_for): Likewise. Most parsing code removed. (cp_parser_iteration_statement): Call cp_parser_for instead of cp_parser_c_for and cp_parser_range_for. (cp_parser_for_init_statement): Add new parameter and return type. (cp_parser_block_declaration): Update call to cp_parser_simple_declaration. (cp_parser_simple_declaration): Add new parameter. Update call to cp_parser_init_declarator. (cp_parser_init_declarator): Add new parameter. * pt.c (tsubst_expr): Update call to begin_for_stmt. * semantics.c (begin_for_scope): New. (begin_for_stmt): Add two new parameters. (begin_range_for_stmt): Likewise. From-SVN: r168731
* re PR c++/47068 ([C++0x] internal compiler error on decltype(~ expression))Jason Merrill2010-12-281-1/+2
| | | | | | | | PR c++/47068 * semantics.c (finish_id_expression): Don't note non-names as being used in the class. From-SVN: r168309
* re PR c++/46626 (simple use of virtual methods causes pure virtual method ↵Jakub Jelinek2010-12-271-5/+19
| | | | | | | | | | | | call in c++0x mode) PR c++/46626 * semantics.c (build_data_member_initialization): For CLEANUP_STMT recurse into CLEANUP_BODY. * g++.dg/cpp0x/constexpr-base4.C: New test. From-SVN: r168271
* re PR c++/45330 (Suggest likely nested-name-specifiers for undeclared ↵Nathan Froyd2010-12-141-31/+0
| | | | | | | | | | | | | | | | | | | identifiers.) gcc/cp/ PR c++/45330 * cp-tree.h (suggest_alternatives_for): Add location_t parameter. * name-lookup.c (suggest_alternatives_for): Likewise. Adjust. * lex.c (unqualified_name_lookup_error): Adjust call to it. * semantics.c (qualified_name_lookup_error): Move to... * error.c (qualified_name_lookup_error): ...here. Call. suggest_alternatives_for. gcc/testsuite/ PR c++/45330 * g++.dg/lookup/suggestions1.C: New test. From-SVN: r167814
* re PR c++/46873 ([C++0x] ICE: in build_data_member_initialization, at ↵Jason Merrill2010-12-131-32/+26
| | | | | | | | | | | cp/semantics.c:5489) PR c++/46873 PR c++/46877 * semantics.c (build_data_member_initialization): Handle cv-qualified data member. From-SVN: r167770
* fooJason Merrill2010-12-131-3/+14
| | | | From-SVN: r167769
* c-typeck.c (readonly_error): Delete.Nathan Froyd2010-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc/ * c-typeck.c (readonly_error): Delete. gcc/c-family/ * c-common.h (readonly_error): Declare. * c-common.c (readonly_error): Define. gcc/cp/ * cp-tree.h (readonly_error_kind): Delete. (readonly_error): Rename to... (cxx_readonly_error): ...this. Change second argument to be an enum lvalue_use. * semantics.c (finish_asm_stmt): Call cxx_readonly_error. * typeck.c (cp_build_unary_op): Likewise. (cp_build_modify_expr): Likewise. * typeck2.c (readonly_error): Rename to... (cxx_readonly_error): ...this. Delegate to readonly_error for most cases. gcc/testsuite/ * gcc.dg/dfp/struct-union.c: Adjust. * gcc.dg/lvalue-2.c: Adjust. * gcc.dg/pr21419.c: Adjust. * gcc.dg/qual-component-1.c: Adjust. * g++.dg/other/const1.C: Adjust. From-SVN: r167687
* re PR c++/46348 ([C++0x] ICE with constexpr default constructor and array ↵Jason Merrill2010-12-081-12/+25
| | | | | | | | | | member) PR c++/46348 * semantics.c (cxx_eval_vec_init_1): Handle value-init. (cxx_eval_vec_init): Pass value_init arg. From-SVN: r167623
* In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero2010-12-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * c-family/c-common.h: Removed the declarations of all the objc_ callbacks, and moved them into c-objc.h. Removed objc_ivar_visibility_kind and moved it into c-objc.h. * c-family/c-objc.h: New file. * c-family/c-common.c: Include c-objc.h. * c-family/c-format.c: Same change. * c-family/stub-objc.c: Same change. * c-decl.c: Include c-family/c-objc.h. * c-parser.c: Same change. * c-typeck.c: Same change. * c-config-lang.in (gtfiles): Added c-family/c-objc.h. * Makefile.in (c-decl.o): Depend on c-family/c-objc.h. (c-parser.o): same change. (c-typeck.o): Same change. (c-family/c-format.o): Same change. (c-family/stub-objc.o): Same change. (c-family/c-common.o): Same change. (PLUGIN_HEADERS): Added c-family/c-objc.h. In gcc/cp/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * call.c: Include c-family/c-objc.h. * decl.c: Same change. * decl2.c: Same change. * error.c: Same change. * lex.c: Same change. * parser.c: Same change. * pt.c: Same change. * semantics.c: Same change. * typeck.c: Same change. * Make-lang.in (cp/decl.o): Depend on c-family/c-objc.h. (cp/decl2.o): Same change. (cp/call.o): Same change. (cp/error.o): Same change. (cp/lex.o): Same change. (cp/parser.o): Same change. (cp/pt.o): Same change. (cp/semantics.o): Same change. (cp/typeck.o): Same change. * config-lang.in (gtfiles): Added c-family/c-objc.h. In gcc/objc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c: Include c-family/c-objc.h. * objc-lang.c: Same change. * Make-lang.in (objc/objc-act.o): Depend on c-family/c-objc.h. (objc/objc-lang.o): Same change. * config-lang.in (gtfiles): Added c-family/c-objc.h. In gcc/objcp/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * config-lang.in (gtfiles): Added c-family/c-objc.h. * Make-lang.in (objcp/objcp-act.o): Depend on c-family/c-objc.h. (objcp/objcp-lang.o): Same change. (objcp/objcp-decl.o): Same change. * objcp-lang.c: Include c-family/c-objc.h. * objcp-decl.c: Same change. From-SVN: r167481
* * semantics.c (build_data_member_initialization): Remove assert.Jason Merrill2010-12-031-3/+1
| | | | From-SVN: r167437
* re PR c++/46526 (VTable Problem?)Jakub Jelinek2010-11-201-1/+1
| | | | | | | | | PR c++/46526 * semantics.c (cxx_eval_call_expression): Unshare the result. * g++.dg/cpp0x/constexpr-base3.C: New test. From-SVN: r166967
* re PR c++/46369 (ICE: unexpected expression '((unsigned char*)&*r)[24]' of ↵Jason Merrill2010-11-101-0/+44
| | | | | | | | | | kind bit_field_ref) PR c++/46369 * semantics.c (cxx_eval_bit_field_ref): New. (cxx_eval_constant_expression): Call it. From-SVN: r166576
* re PR c++/46382 (constexpr vs. static_assert in constexpr ctors)Jason Merrill2010-11-081-0/+42
| | | | | | | | | PR c++/46382 * semantics.c (check_constexpr_ctor_body): New fn. * parser.c (cp_parser_ctor_initializer_opt_and_function_body): Call it. * cp-tree.h: Declare it. From-SVN: r166471
* Correct conversion/overflow behavior.Jason Merrill2010-11-081-12/+20
| | | | | | | | | | | | | | | | | | | | | * cvt.c (ignore_overflows): Move here from typeck.c. (ocp_convert): Use it. (cp_fold_convert): Use it. Don't call rvalue. * typeck.c (build_static_cast_1): Don't use it. Do call rvalue. * error.c (location_of): Handle expressions, too. * class.c (check_bitfield_decl): Set input_location around call to cxx_constant_value. * semantics.c (cxx_eval_outermost_constant_expr): Don't print the expression if it already had TREE_OVERFLOW set. (reduced_constant_expression_p): Check TREE_OVERFLOW_P for C++98, too. (verify_constant): Allow overflow with a permerror if we're enforcing. (cxx_eval_outermost_constant_expr): Use verify_constant. (adjust_temp_type): Use cp_fold_convert. * decl.c (build_enumerator): Don't call constant_expression_warning. * decl2.c (grokbitfield): Likewise. From-SVN: r166453
* init.c (perform_member_init): Use build_vec_init_expr for value-init of ↵Jason Merrill2010-11-061-8/+2
| | | | | | | | | | | | | | | | arrays, too. * init.c (perform_member_init): Use build_vec_init_expr for value-init of arrays, too. * cp-gimplify.c (cp_gimplify_expr): Use VEC_INIT_EXPR_VALUE_INIT. * cp-tree.h (VEC_INIT_EXPR_IS_CONSTEXPR): New macro. (VEC_INIT_EXPR_VALUE_INIT): New macro. * semantics.c (potential_constant_expression): No longer static. Check VEC_INIT_EXPR_IS_CONSTEXPR. * tree.c (build_vec_init_expr): Handle value-init. Set VEC_INIT_EXPR_IS_CONSTEXPR and VEC_INIT_EXPR_VALUE_INIT. From-SVN: r166413
* re PR c++/46298 (constexpr ICE on ARM)Jason Merrill2010-11-041-2/+3
| | | | | | | | PR c++/46298 * semantics.c (build_constexpr_constructor_member_initializers): Handle an enclosing STATEMENT_LIST. From-SVN: r166330
* semantics.c (speculative_access_check): New.Jason Merrill2010-11-041-0/+24
| | | | | | | | | | * semantics.c (speculative_access_check): New. * cp-tree.h: Declare it. * call.c (build_over_call): Use it. * class.c (type_has_constexpr_default_constructor): Use locate_ctor. * method.c (locate_ctor): Use push/pop_deferring_access_checks. From-SVN: r166317
* re PR c++/46293 (constexpr vs. tuple, ice)Jason Merrill2010-11-031-0/+8
| | | | | | | | PR c++/46293 * semantics.c (build_data_member_initialization): Handle value-init of aggregate empty base. From-SVN: r166297
* re PR c++/46289 (ICE in build_constexpr_constructor_member_initializers, at ↵Jason Merrill2010-11-031-2/+3
| | | | | | | | | | cp/semantics.c:5513) PR c++/46289 * semantics.c (build_constexpr_constructor_member_initializers): Avoid ICE on error. From-SVN: r166270
* semantics.c (call_stack, [...]): New.Jason Merrill2010-11-011-10/+38
| | | | | | | | | | | | * semantics.c (call_stack, call_stack_tick, cx_error_context): New. (last_cx_error_tick, push_cx_call_context, pop_cx_call_context): New. (cxx_eval_call_expression): Call push/pop_cx_call_context instead of giving follow-on errors. * error.c (maybe_print_constexpr_context): New. (cp_diagnostic_starter): Call it. * cp-tree.h: Declare cx_error_context. From-SVN: r166169
* semantics.c (cxx_eval_constant_expression): Explain unacceptable use of ↵Jason Merrill2010-11-011-1/+30
| | | | | | | | | variable better. * semantics.c (cxx_eval_constant_expression): Explain unacceptable use of variable better. From-SVN: r166168
* call.c (null_ptr_cst_p): Use maybe_constant_value.Jason Merrill2010-11-011-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * call.c (null_ptr_cst_p): Use maybe_constant_value. (set_up_extended_ref_temp): Support constant initialization. (initialize_reference): Adjust. * class.c (check_bitfield_decl): Use cxx_constant_value. * cvt.c (ocp_convert): Don't use integral_constant_value when converting to class type. * decl.c (finish_case_label): Use maybe_constant_value. (build_init_list_var_init): Support constant initialization. (check_initializer): Likewise. Reorganize. (cp_finish_decl): Likewise. (expand_static_init): Likewise. (compute_array_index_type): Use maybe_constant_value. Add complain parm. (create_array_type_for_decl, grokdeclarator): Pass it. (build_enumerator): Use cxx_constant_value. * decl2.c (grokfield): Use maybe_constant_init. * except.c (check_noexcept_r): Handle constexpr. (build_noexcept_spec): Use maybe_constant_value. * init.c (expand_default_init): Support constant initialization. (build_vec_init): Likewise. (constant_value_1): Adjust. (build_new_1): Adjust. * parser.c (cp_parser_constant_expression): Allow non-integral in C++0x mode. (cp_parser_direct_declarator): Don't fold yet in C++0x mode. (cp_parser_initializer_clause): Toss folded result if non-constant. * pt.c (fold_decl_constant_value): Remove. (convert_nontype_argument): Use maybe_constant_value. Give clearer error about overflow. (tsubst): Move array bounds handling into compute_array_index_type. (value_dependent_expression_p): Handle constant CALL_EXPR. * semantics.c (finish_static_assert): Use maybe_constant_value. (ensure_literal_type_for_constexpr_object): Make sure type is complete. (potential_constant_expression): Use maybe_constant_value. * tree.c (cast_valid_in_integral_constant_expression_p): Any cast is potentially valid in C++0x. * typeck2.c (store_init_value): Handle constant init. (check_narrowing): Use maybe_constant_value. (build_functional_cast): Set TREE_CONSTANT on literal T(). * cp-tree.h (DECL_INTEGRAL_CONSTANT_VAR_P): Remove. (LOOKUP_ALREADY_DIGESTED): New. (compute_array_index_type): Adjust prototype. From-SVN: r166167
* semantics.c (constexpr_call): New datatype.Gabriel Dos Reis2010-11-011-0/+1272
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * semantics.c (constexpr_call): New datatype. (constexpr_call_table): New global table. (constexpr_call_hash): New. (constexpr_call_equal): Likewise. (maybe_initialize_constexpr_call_table): Likewise. (lookup_parameter_binding): Likewise. (cxx_eval_builtin_function_call): Likewise. (cxx_bind_parameters_in_call): Likewise. (cxx_eval_call_expression): Likewise. (cxx_eval_unary_expression): Likewise. (cxx_eval_binary_expression): Likewise. (cxx_eval_conditional_expression): Likewise. (cxx_eval_array_reference): Likewise. (cxx_eval_component_reference): Likewise. (cxx_eval_logical_expression): Likewise. (cxx_eval_object_construction): Likewise. (cxx_eval_constant_expression): Likewise. (cxx_eval_indirect_ref): Likewise. (cxx_constant_value): Likewise. (cxx_eval_bare_aggregate): Likewise. (adjust_temp_type): New. (reduced_constant_expression_p): New. (verify_constant): New. (cxx_eval_vec_init, cxx_eval_vec_init_1): New. (cxx_eval_outermost_constant_expr): New. (maybe_constant_value, maybe_constant_init): New. (cxx_eval_constant_expression): Use them. * cp-tree.h: Declare fns. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r166166
* cp-tree.h (register_constexpr_fundef): Declare.Jason Merrill2010-11-011-0/+726
| | | | | | | | | | | | | | | | | | | | | | | * cp-tree.h (register_constexpr_fundef): Declare. * decl.c (maybe_save_function_definition): New. (finish_function): Use it. * semantics.c (constexpr_fundef): New datatype. (constexpr_fundef_table): New global table. (constexpr_fundef_equal): New. (constexpr_fundef_hash): Likewise. (retrieve_constexpr_fundef): Likewise. (validate_constexpr_fundecl): Store in the table. (build_data_member_initialization): New fn. (build_constexpr_constructor_member_initializers): New. (register_constexpr_fundef): Define. (is_this_parameter): New. (get_function_named_in_call): Likewise. (get_nth_callarg): Likewise. (check_automatic_or_tls): New. (morally_constexpr_builtin_function_p): New. (potential_constant_expression): New. From-SVN: r166165
* decl2.c (decl_constant_var_p): New fn.Jason Merrill2010-11-011-16/+16
| | | | | | | | | | | | | | | | * decl2.c (decl_constant_var_p): New fn. (decl_maybe_constant_var_p): New fn. (mark_used): Rework instantiation of things needed for constant expressions. * cp-tree.h: Declare new fns. * pt.c (instantiate_decl): Handle cp_unevaluated_operand. (always_instantiate_p): Use decl_maybe_constant_var_p. (instantiate_decl): Don't defer constexpr functions. * repo.c (repo_emit_p): Use decl_maybe_constant_var_p. * semantics.c (finish_id_expression): Use decl_constant_var_p. Check for valid name in constant expr after mark_used. From-SVN: r166164
* c-common.c (c_common_reswords): Add __is_literal_type.Jason Merrill2010-10-271-0/+5
| | | | | | | | | | | | | | | | gcc/c-family/ * c-common.c (c_common_reswords): Add __is_literal_type. * c-common.h (enum rid): Add RID_IS_LITERAL_TYPE. gcc/cp/ * cp-tree.h (cp_trait_kind): Add CPTK_IS_LITERAL_TYPE. * cxx-pretty-print.c (pp_cxx_trait_expression): Handle it. * semantics.c (trait_expr_value, finish_trait_expr): Likewise. * parser.c (cp_parser_primary_expression): Handle RID_IS_LITERAL_TYPE. (cp_parser_trait_expr): Likewise. libstdc++-v3/ * include/std/type_traits (is_literal_type): New. From-SVN: r166020
* parser.c (cp_parser_ctor_initializer_opt_and_function_body): Make sure a ↵Gabriel Dos Reis2010-10-271-31/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | constexpr ctor has an empty body. * parser.c (cp_parser_ctor_initializer_opt_and_function_body): Make sure a constexpr ctor has an empty body. * class.c (type_has_constexpr_default_constructor): New. * cp-tree.h: Declare it. * init.c (perform_member_init): Complain about uninitialized member in constexpr ctor. (emit_mem_initializers): And uninitialized base. * decl.c (check_tag_decl): Fix typo. * semantics.c (valid_type_in_constexpr_fundecl_p): New fn. (is_valid_constexpr_fn): New fn. (validate_constexpr_fundecl): Use it. * decl.c (validate_constexpr_redeclaration): New. (duplicate_decls): Use it. (cp_finish_decl): Call validate_constexpr_fundecl and ensure_literal_type_for_constexpr_object here. (start_decl): Not here. Don't ICE on constexpr reference. (check_for_uninitialized_const_var): Don't handle constexpr specially. (grokfndecl): Set DECL_DECLARED_CONSTEXPR_P. (check_static_variable_definition): Give friendly message about missing constexpr. (grokdeclarator): Complain about typedef and volatile with constexpr. Reorganize. Give sorry about non-static data members in C++0x mode. (start_preparsed_function): Check validate_constexpr_fundecl here. (check_function_type): Not here. * decl2.c (finish_static_data_member_decl): Don't complain about in-class init. * parser.c (CP_PARSER_FLAGS_ONLY_TYPE_OR_CONSTEXPR): New. (cp_parser_condition): Pass it to cp_parser_decl_specifier_seq. (cp_parser_decl_specifier_seq): Handle it. (cp_parser_explicit_instantiation): Diagnose inline and constexpr. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r166013
* class.c (check_bases): Propagate non-literality.Gabriel Dos Reis2010-10-271-1/+1
| | | | | | | | | | | | | | | | * class.c (check_bases): Propagate non-literality. (check_field_decls): Likewise. (finalize_literal_type_property): New. (check_bases_and_members): Call it. * cp-tree.h (TYPE_HAS_CONSTEXPR_CTOR): New. (lang_type_class): Add has_constexpr_ctor field. (DECL_DECLARED_CONSTEXPR_P): Strip template. * decl.c (grok_special_member_properties): Set TYPE_HAS_CONSTEXPR_CTOR. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r166012
* semantics.c (finish_compound_stmt): Avoid creating an unnecessary BIND_EXPR.Jason Merrill2010-10-271-1/+13
| | | | | | | * semantics.c (finish_compound_stmt): Avoid creating an unnecessary BIND_EXPR. From-SVN: r166006
* re PR c/46015 (-Wunused-but-set-variable warns for arrays used in gotos)Jakub Jelinek2010-10-181-0/+1
| | | | | | | | | | | | | PR c/46015 * c-parser.c (c_parser_statement_after_labels): Call mark_exp_read on computed goto argument. * semantics.c (finish_goto_stmt): Call mark_rvalue_use on computed goto destination. * c-c++-common/Wunused-var-13.c: New test. From-SVN: r165643
* re PR c++/45984 (ICE: canonical types differ for identical types)Jason Merrill2010-10-131-0/+1
| | | | | | | | | | PR c++/45984 * class.c (fixup_attribute_variants): New fn. * cp-tree.h: Declare it. * pt.c (instantiate_class_template): Call it. * semantics.c (begin_class_definition): Call it. From-SVN: r165443
* semantics.c (finish_id_expression): Diagnose use of function parms in ↵Jason Merrill2010-09-151-0/+10
| | | | | | | | | evaluated context outside function body. * semantics.c (finish_id_expression): Diagnose use of function parms in evaluated context outside function body. From-SVN: r164322
* semantics.c (finish_for_stmt): Always test flag_new_for_scope.Rodrigo Rivas Costa2010-09-131-13/+7
| | | | | | | * semantics.c (finish_for_stmt): Always test flag_new_for_scope. (begin_range_for_stmt): Likewise. From-SVN: r164251
* Implement range-based for-statements.Rodrigo Rivas Costa2010-09-111-7/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cp-tree.def (RANGE_FOR_STMT): New. * cp-tree.h (RANGE_FOR_DECL, RANGE_FOR_EXPR, RANGE_FOR_BODY): New. (cp_convert_range_for): Declare. * pt.c (tsubst_expr): Add RANGE_FOR_STMT. (tsubst_copy_and_build): perform_koenig_lookup takes extra argument. * semantics.c (begin_range_for_stmt): New. (finish_range_for_decl): New. (finish_for_stmt): Accept also RANGE_FOR_STMT. (perform_koenig_lookup): Add extra argument include_std. * parser.c (cp_parser_c_for): New with code from cp_parser_iteration_statement(). (cp_parser_range_for): New. (cp_convert_range_for): New. (cp_parser_iteration_statement): Add range-for support. (cp_parser_condition): Adjust comment. (cp_parser_postfix_expression): perform_koenig_lookup takes extra argument. * dump.c (cp_dump_tree): Add RANGE_FOR_STMT. * cxx-pretty-print.c: Likewise. * lex.c (cxx_init): Likewise. * name-lookup.c (lookup_function_nonclass): Add extra argument include_std. (lookup_arg_dependent): Likewise. * name-lookup.h: Likewise. From-SVN: r164211
* semantics.c (finish_compound_literal): Always build a TARGET_EXPR.Jason Merrill2010-09-061-14/+1
| | | | | | | * semantics.c (finish_compound_literal): Always build a TARGET_EXPR. From-SVN: r163893
* vec.h (FOR_EACH_VEC_ELT): Define.Nathan Froyd2010-08-201-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc/ * vec.h (FOR_EACH_VEC_ELT): Define. * c-decl.c: Use it. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/bfin/bfin.c: Likewise. * config/mips/mips.c: Likewise. * config/rs6000/rs6000.c: Likewise. * dbxout.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * dse.c: Likewise. * dwarf2out.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * ggc-common.c: Likewise. * gimplify.c: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * implicit-zee.c: Likewise. * ipa-prop.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * lambda-code.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-opts.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-symtab.c: Likewise. * matrix-reorg.c: Likewise. * opts.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-data-ref.c: Likewise. * tree-emutls.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * vmsdbgout.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Use FOR_EACH_VEC_ELT. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. gcc/c-family/ * c-common.c: Use FOR_EACH_VEC_ELT. * c-gimplify.c: Likewise. * c-pragma.c: Likewise. gcc/cp/ * call.c: Use FOR_EACH_VEC_ELT. * class.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * error.c: Likewise. * except.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * repo.c: Likewise. * semantics.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * trans-openmp.c: Use FOR_EACH_VEC_ELT. gcc/java/ * class.c: Use FOR_EACH_VEC_ELT. * expr.c: Likewise. * jcf-parse.c: Likewise. * resource.c: Likewise. gcc/lto/ * lto.c: Use FOR_EACH_VEC_ELT. From-SVN: r163401
* re PR c++/44996 ([C++0x] decltype produces rvalue reference type for ↵Jason Merrill2010-07-191-2/+3
| | | | | | | | | | parenthesized id-expression) PR c++/44996 * semantics.c (finish_decltype_type): Correct decltype of parenthesized rvalue reference variable. From-SVN: r162323
* tree.h (DECL_CHAIN): Define.Nathan Froyd2010-07-151-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223