aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
AgeCommit message (Collapse)AuthorFilesLines
2011-09-23correct ChangeLogJason Merrill1-1/+1
From-SVN: r179131
2011-09-23Core 234 - allow const objects with no initializer or user-provided default...Jason Merrill6-8/+59
Core 234 - allow const objects with no initializer or user-provided default constructor if the defaulted constructor initializes all the subobjects. PR c++/20039 PR c++/42844 * class.c (default_init_uninitialized_part): New. * cp-tree.h: Declare it. * decl.c (check_for_uninitialized_const_var): Use it. * init.c (perform_member_init): Likewise. (build_new_1): Likewise. * method.c (walk_field_subobs): Likewise. From-SVN: r179130
2011-09-23re PR c++/50258 ([C++0x] -std=gnu++0x should allow in-class initialization ↵Paolo Carlini2-2/+10
of static const floating types without constexpr) /cp 2011-09-23 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50258 * decl.c (check_static_variable_definition): Allow in-class initialization of static data member of non-integral type in permissive mode. /testsuite 2011-09-23 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50258 * g++.dg/cpp0x/constexpr-static8.C: New. From-SVN: r179121
2011-09-23re PR c++/50491 ([C++0x] [4.6/4.7 Regression] "unexpected ast of kind ↵Paolo Carlini2-0/+6
using_decl" on call to using'ed grandparent member function) /cp 2011-09-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50491 * semantics.c (potential_constant_expression_1): Handle USING_DECL. /testsuite 2011-09-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50491 * g++.dg/cpp0x/pr50491.C: New. From-SVN: r179109
2011-09-22re PR c++/50371 ([C++0x] std::nullptr_t rejected as non-type template-parameter)Paolo Carlini2-0/+7
/cp 2011-09-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50371 * pt.c (invalid_nontype_parm_type_p): Handle NULLPTR_TYPE. /testsuite 2011-09-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50371 * g++.dg/cpp0x/nullptr24.C: New. From-SVN: r179096
2011-09-22re PR c++/50344 (friend declaration confused by const qualifier)Jonathan Wakely2-1/+10
/cp 2011-09-22 Jonathan Wakely <jwakely.gcc@gmail.com> Paolo Carlini <paolo.carlini@oracle.com> PR c++/50344 * friend.c (make_friend_class): cv-qualification is ok in a friend declaration. /testsuite 2011-09-22 Jonathan Wakely <jwakely.gcc@gmail.com> Paolo Carlini <paolo.carlini@oracle.com> PR c++/50344 * g++.dg/template/friend52.C: New. Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com> From-SVN: r179088
2011-09-21re PR c++/50454 (Unexpected problems with -pedantic / -pedantic-errors and ↵Paolo Carlini2-19/+19
__int128 and unsigned __int128 specializations) /cp 2011-09-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50454 * decl.c (grokdeclarator): Consistently handle both __int128 and unsigned __int128 with -pedantic; suppress diagnostic in system headers. /testsuite 2011-09-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50454 * g++.dg/ext/int128-1.C: New. * g++.dg/ext/int128-2.C: Likewise. * g++.dg/ext/int128-2.h: Likewise. From-SVN: r179042
2011-09-20cp-tree.h (DECL_TEMPLOID_INSTANTIATION): New.Jason Merrill4-5/+22
* cp-tree.h (DECL_TEMPLOID_INSTANTIATION): New. (DECL_GENERATED_P): New. * class.c (finalize_literal_type_property): Use them. * semantics.c (is_instantiation_of_constexpr): Likewise. (register_constexpr_fundef): Likewise. From-SVN: r179017
2011-09-20call.c (convert_default_arg): Avoid redundant copy.Jason Merrill3-12/+15
* call.c (convert_default_arg): Avoid redundant copy. * tree.c (bot_manip): Copy everything. From-SVN: r179016
2011-09-20call.c (build_new_method_call_1): Use non-virtual lookup for final virtual ↵Roberto Agostino Vitillo2-1/+9
functions. * call.c (build_new_method_call_1): Use non-virtual lookup for final virtual functions. From-SVN: r179014
2011-09-16re PR c++/50424 (G++ doesn't notice possible throw from default argument)Jason Merrill4-45/+61
PR c++/50424 * call.c (set_flags_from_callee): Split out from build_call_a. * cp-tree.h: Declare it. * tree.c (bot_manip): Call it. From-SVN: r178918
2011-09-15re PR c++/50365 (non-static data member error on valid code)Jason Merrill2-1/+7
PR c++/50365 * parser.c (cp_parser_late_return_type_opt): Check quals parameter for clearing current_class_ptr, too. From-SVN: r178883
2011-09-14name-lookup.c (lookup_arg_dependent): Use conditional timevars.Diego Novillo3-4/+12
* name-lookup.c (lookup_arg_dependent): Use conditional timevars. * decl.c (xref_tag): Likewise. From-SVN: r178860
2011-09-14re PR c++/50391 ([C++0x] ICE on invalid code, pair with incomplete type)Paolo Carlini2-1/+7
/cp 2011-09-14 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50391 * pt.c (regenerate_decl_from_template): Don't pass an error_mark_node to build_exception_variant. /testsuite 2011-09-14 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50391 * g++.dg/cpp0x/noexcept15.C: New. From-SVN: r178857
2011-09-13c++/48320 - Template parameter packs cannot be expanded in default template ↵Dodji Seketeli2-47/+78
arguments gcc/cp/ PR c++/48320 * pt.c (template_parameter_pack_p): Support TEMPLATE_PARM_INDEX nodes. Add a comment. (arg_from_parm_pack_p): New static function, factorized out from tsubst_pack_expansion and extended to support non-type parameter packs represented with TEMPLATE_PARM_INDEX nodes. (tsubst_pack_expansion): Use arg_from_parm_pack_p. gcc/testsuite/ PR c++/48320 * g++.dg/cpp0x/variadic116.C: New test case. From-SVN: r178811
2011-09-12pt.c (type_unification_real): Fix handling of DEDUCE_CONV with no deducible ↵Jason Merrill3-4/+46
template parameters. * pt.c (type_unification_real): Fix handling of DEDUCE_CONV with no deducible template parameters. * call.c (rejection_reason_code): Add rr_template_conversion. (print_z_candidate): Handle it. (template_conversion_rejection): New. (build_user_type_conversion_1): Use it. From-SVN: r178791
2011-09-12call.c (merge_conversion_sequences): Set bad_p and user_conv_p on all of the ↵Jason Merrill2-17/+35
second conversion sequence. * call.c (merge_conversion_sequences): Set bad_p and user_conv_p on all of the second conversion sequence. (build_user_type_conversion_1): Set bad_p on the ck_user conv. (convert_like_real): Handle bad ck_ref_bind with user_conv_p in the first section. Fix loop logic. (initialize_reference): Call convert_like for diagnostics when we have a (bad) conversion. From-SVN: r178790
2011-09-12* call.c (convert_class_to_reference)Jason Merrill2-159/+10
(convert_class_to_reference_1): Remove. (reference_binding): Use build_user_type_conversion_1 instead. From-SVN: r178789
2011-09-12call.c (initialize_reference): Add flags parm.Jason Merrill5-8/+17
* call.c (initialize_reference): Add flags parm. * decl.c (grok_reference_init): Likewise. (check_initializer): Pass it. * typeck.c (convert_for_initialization): Likewise. * cp-tree.h: Adjust. From-SVN: r178788
2011-09-12cp-tree.h (LOOKUP_NO_RVAL_BIND): New.Jason Merrill3-25/+44
* cp-tree.h (LOOKUP_NO_RVAL_BIND): New. * call.c (conditional_conversion): Use it. (reference_binding): Fix handling of xvalues. From-SVN: r178787
2011-09-12call.c (implicit_conversion): Check BRACE_ENCLOSED_INITIALIZER_P before ↵Jason Merrill2-2/+7
forcing instantiation. * call.c (implicit_conversion): Check BRACE_ENCLOSED_INITIALIZER_P before forcing instantiation. From-SVN: r178786
2011-09-08re PR c++/50324 ([C++0x] SFINAE does not handle the object creation of an ↵Paolo Carlini2-3/+10
incomplete type) /cp 2011-09-08 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50324 * typeck2.c (digest_init_r): Call complete_type_or_maybe_complain instead of complete_type_or_else. /testsuite 2011-09-08 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50324 * g++.dg/cpp0x/sfinae28.C: New. From-SVN: r178694
2011-09-08PR c++/33255 - Support -Wunused-local-typedefs warningDodji Seketeli5-0/+24
gcc/ * c-decl.c (lookup_name): Use the new maybe_record_typedef_use. (pushdecl): Use the new record_locally_defined_typedef. (store_parm_decls): Allocate cfun->language. (finish_function): Use the new maybe_warn_unused_local_typedefs, and free cfun->language. (c_push_function_context): Allocate cfun->language here only if needed. (c_pop_function_context): Likewise, mark cfun->language for collection only when it should be done. * c-common.c (handle_used_attribute): Don't ignore TYPE_DECL nodes. * c-typeck.c (c_expr_sizeof_type, c_cast_expr): Use the new maybe_record_local_typedef_use. gcc/c-family * c-common.h (struct c_language_function::local_typedefs): New field. (record_locally_defined_typedef, maybe_record_typedef_use) (maybe_warn_unused_local_typedefs): Declare new functions. * c-common.c (record_locally_defined_typedef) (maybe_record_typedef_use) (maybe_warn_unused_local_typedefs): Define new functions. * c.opt: Declare new -Wunused-local-typedefs flag. gcc/cp * name-lookup.c (pushdecl_maybe_friend_1): Use the new record_locally_defined_typedef. * decl.c (finish_function): Use the new maybe_warn_unused_local_typedefs. (grokfield): Use the new record_locally_defined_typedef. * parser.c (lookup_name): Use the new maybe_record_typedef_use. gcc/doc/ * invoke.texi: Update documentation for -Wunused-local-typedefs. gcc/testsuite/ * g++.dg/warn/Wunused-local-typedefs.C: New test file. * c-c++-common/Wunused-local-typedefs.c: Likewise. libstdc++-v3/ * include/ext/bitmap_allocator.h (__detail::__mini_vector::__lower_bound): Remove unused typedef. * src/istream.cc (std::operator>>(basic_istream<char>& __in, basic_string<char>& __str)): Likewise. (std::getline): Likewise. * src/valarray.cc (__valarray_product): Likewise. From-SVN: r178692
2011-09-07re PR c++/50309 ([C++0x] ICE: tree check: expected tree_list, have ↵Paolo Carlini2-0/+10
error_mark in comp_except_specs, at cp/typeck.c:1014 on empty noexcept) /cp 2011-09-07 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50309 * decl.c (grokdeclarator): Check u.function.exception_specification for error_mark_node. /testsuite 2011-09-07 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50309 * g++.dg/cpp0x/noexcept14.C: New. From-SVN: r178654
2011-09-07re PR c++/50298 ([C++0x][constexpr] References cannot be bound to static ↵Jason Merrill2-0/+15
constexpr reference members) PR c++/50298 * parser.c (cp_parser_member_declaration): Don't require a constant rvalue here in C++0x. From-SVN: r178652
2011-09-07pt.c (type_unification_real): Correct complain arg for tsubsting default ↵Jason Merrill2-5/+9
template args. * pt.c (type_unification_real): Correct complain arg for tsubsting default template args. From-SVN: r178651
2011-09-07* pt.c (tsubst_aggr_type): Check TYPE_P before tsubsting.Jason Merrill2-3/+6
From-SVN: r178650
2011-09-06re PR c++/50296 (New C++ test failures)Jason Merrill4-31/+24
PR c++/50296 * semantics.c (register_constexpr_fundef): Call is_valid_constexpr_fn. (cx_check_missing_mem_inits): Handle bases and empty trivial members. (validate_constexpr_fundecl): Remove. * decl.c (start_preparsed_function): Don't call it. * cp-tree.h: Don't declare it. From-SVN: r178604
2011-09-05re PR c++/49267 (Ambiguity with conversion functions "T&" and "T&&", ↵Jason Merrill2-2/+7
initializing a "T&&") PR c++/49267 * call.c (reference_binding): Don't set is_lvalue for an rvalue reference rfrom. From-SVN: r178521
2011-09-05re PR c++/49267 (Ambiguity with conversion functions "T&" and "T&&", ↵Jason Merrill2-5/+16
initializing a "T&&") PR c++/49267 PR c++/49458 DR 1328 * call.c (reference_binding): Set rvaluedness_matches_p properly for reference to function conversion ops. (compare_ics): Adjust. From-SVN: r178520
2011-09-05class.c (trivial_default_constructor_is_constexpr): Rename from ↵Jason Merrill5-13/+35
synthesized_default_constructor_is_constexpr. * class.c (trivial_default_constructor_is_constexpr): Rename from synthesized_default_constructor_is_constexpr. (type_has_constexpr_default_constructor): Adjust. (add_implicitly_declared_members): Call it instead. (explain_non_literal_class): Explain about non-constexpr default ctor. * cp-tree.h: Adjust. * method.c (synthesized_method_walk): Adjust. * semantics.c (explain_invalid_constexpr_fn): Handle defaulted functions, too. From-SVN: r178519
2011-09-05re PR c++/50248 ([C++0x] unnecessary instantiation of constexpr constructor)Jason Merrill4-39/+95
PR c++/50248 Core 1358 * init.c (perform_member_init): Don't diagnose missing inits here. (emit_mem_initializers): Or here. * method.c (process_subob_fn): Don't instantiate constexpr ctors. * semantics.c (cx_check_missing_mem_inits): New. (explain_invalid_constexpr_fn): Call it. (register_constexpr_fundef): Likewise. Leave DECL_DECLARED_CONSTEXPR_P set when the body is unsuitable. (cxx_eval_call_expression): Adjust diagnostics. (cxx_eval_constant_expression): Catch use of 'this' in a constructor. From-SVN: r178518
2011-08-30re PR c++/50084 ([C++0x] ICE: decltype + remove_reference + new)Jason Merrill4-17/+23
PR c++/50084 * cp-tree.h (cp_decl_specifier_seq): Rename user_defined_type_p to type_definition_p. * parser.c (cp_parser_set_decl_spec_type): Likewise. * decl.c (grokdeclarator): Check it. From-SVN: r178340
2011-08-30re PR c++/50089 ([C++0x] ICE when calling a qualified base class member ↵Jason Merrill2-1/+5
function within a lambda expr without "this->") PR c++/50089 * semantics.c (finish_id_expression): Use current_nonlambda_class_type for qualified-ids. From-SVN: r178339
2011-08-30re PR c++/50114 (ICE with declaration inside for statement)Jason Merrill2-0/+7
PR c++/50114 * decl.c (poplevel): Disable for scope compatibility hack in C++11 mode. From-SVN: r178338
2011-08-30re PR c++/50220 ([C++0x] [4.7 Regression] ICE when capturing a by-reference ↵Jason Merrill2-0/+6
template function argument in a lambda) PR c++/50220 * semantics.c (add_capture): Call complete_type for copy. From-SVN: r178326
2011-08-30re PR c++/50234 (internal compiler error: in cxx_eval_component_reference, ↵Jason Merrill2-3/+14
at cp/semantics.c:6527) PR c++/50234 * semantics.c (cxx_eval_component_reference): Handle value-initialization for omitted initializers. From-SVN: r178325
2011-08-30re PR c++/50224 ([C++0x] bogus unused parameter warning (it is referenced in ↵Jason Merrill2-0/+8
lambda)) PR c++/50224 * semantics.c (finish_id_expression): Mark captured variables used. From-SVN: r178277
2011-08-30re PR c++/50207 (G++ segv's on reduced test case)Jakub Jelinek2-3/+25
PR c++/50207 * class.c (finish_struct_1): Complain if the first field is artificial. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r178276
2011-08-30re PR c++/50209 ([C++0x] Braced-init-lists are rejected as function default ↵Jason Merrill2-2/+16
arguments) PR c++/50209 Core DR 994 * parser.c (cp_parser_default_argument): Use cp_parser_initializer_clause. (cp_parser_late_parsing_default_args): Likewise. From-SVN: r178275
2011-08-28Core DR 342 PR c++/48582Jason Merrill5-20/+76
Core DR 342 PR c++/48582 * pt.c (check_valid_ptrmem_cst_expr): A null member pointer value is valid in C++11. (convert_nontype_argument): Likewise. Implicitly convert nullptr and do constant folding. * mangle.c (write_template_arg_literal): Mangle null member pointer values as 0. * call.c (null_member_pointer_value_p): New. * cp-tree.h: Declare it. From-SVN: r178144
2011-08-25* call.c (convert_like_real): Remove redundant complain checks.Jason Merrill2-36/+26
From-SVN: r178082
2011-08-25re PR c++/50157 ([C++0x] Non-silent SFINAE in new expression with explicit ↵Jason Merrill2-9/+14
conversion) PR c++/50157 * call.c (convert_like_real): Exit early if bad and !tf_error. From-SVN: r178081
2011-08-23typeck2.c (build_functional_cast): Don't try to avoid calling build_value_init.Jason Merrill3-14/+7
* typeck2.c (build_functional_cast): Don't try to avoid calling build_value_init. * pt.c (instantiate_class_template_1): Don't copy TYPE_HAS_* flags. From-SVN: r177999
2011-08-23re PR c++/49045 ([C++0x] unexpected "different exception specifier" error ↵Jason Merrill2-1/+29
with noexcept) PR c++/49045 Core 1321 * tree.c (dependent_name): New. (cp_tree_equal): Two calls with the same dependent name are equivalent even if the overload sets are different. From-SVN: r177998
2011-08-23tree.c (build_target_expr): Set TREE_CONSTANT on literal TARGET_EXPR if the ↵Jason Merrill3-4/+10
value is constant. * tree.c (build_target_expr): Set TREE_CONSTANT on literal TARGET_EXPR if the value is constant. * typeck2.c (build_functional_cast): Don't set it here. From-SVN: r177997
2011-08-23Core 903 (partial)Jason Merrill2-10/+9
Core 903 (partial) * call.c (null_ptr_cst_p): Only 0 qualifies in C++11. From-SVN: r177996
2011-08-23Core 975Jason Merrill7-37/+68
Core 975 * decl.c (cxx_init_decl_processing): Initialize dependent_lambda_return_type_node. * cp-tree.h (cp_tree_index): Add CPTI_DEPENDENT_LAMBDA_RETURN_TYPE. (dependent_lambda_return_type_node): Define. (DECLTYPE_FOR_LAMBDA_RETURN): Remove. * semantics.c (lambda_return_type): Handle overloaded function. Use dependent_lambda_return_type_node instead of DECLTYPE_FOR_LAMBDA_RETURN. (apply_lambda_return_type): Don't check dependent_type_p. * pt.c (tsubst_copy_and_build): Handle lambda return type deduction. (instantiate_class_template_1): Likewise. (tsubst): Don't use DECLTYPE_FOR_LAMBDA_RETURN. * mangle.c (write_type): Likewise. * typeck.c (structural_comptypes): Likewise. (check_return_expr): Handle dependent_lambda_return_type_node. From-SVN: r177995
2011-08-23re PR c++/50024 ([C++0x] [4.7 Regression] crash when using braced ↵Jason Merrill4-1/+13
initialization in member function of template) PR c++/50024 * semantics.c (maybe_constant_value): Don't try to fold { }. * pt.c (build_non_dependent_expr): Don't wrap { }. * init.c (build_value_init): Allow scalar value-init in templates. From-SVN: r177994
2011-08-23* semantics.c (potential_constant_expression_1): Allow 'this'.Jason Merrill2-14/+4
From-SVN: r177993