aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
AgeCommit message (Collapse)AuthorFilesLines
2009-11-24re PR c++/42137 (error: expected constructor, destructor, or type conversion ↵Jason Merrill2-19/+43
before ‘{’ token) PR c++/42137 * parser.c (cp_parser_mem_initializer_id): Pass typename_type to cp_parser_class_name. (cp_parser_unqualified_id): Same, rather than class_type. PR c++/11764 * parser.c (cp_parser_expression_statement): Give helpful error for constructor name used as type. From-SVN: r154519
2009-11-24pt.c (determine_specialization): Give helpful error about missing "template<>".Jason Merrill2-0/+9
* pt.c (determine_specialization): Give helpful error about missing "template<>". From-SVN: r154518
2009-11-23re PR middle-end/42095 (g++.dg/lto/20081118-1 ↵Jakub Jelinek3-2/+19
cp_lto_20081118-1_0.o-cp_lto_20081118-1_1.o link) PR middle-end/42095 * tree.c: Include cgraph.h. (cp_fix_function_decl_p): Don't return true for same_body aliases. * Make-lang.in (cp/tree.o): Depend on $(CGRAPH_H). From-SVN: r154449
2009-11-23re PR c++/14777 (typedef doesn't fully expose base class type)Dodji Seketeli9-68/+208
Fix PR c++/14777 gcc/cp/ChangeLog: PR c++/14777 * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree node. * cp-tree.h (struct tree_template_info, struct qualified_typedef_usage_s): New. (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO. (union lang_tree_node): Add template_info. (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Adjust. (build_template_info): Declare. (get_types_needing_access_check): Adjust return type. (add_typedef_to_current_template_for_access_check): Declare. * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO. * semantics.c (add_typedef_to_current_template_for_access_check): Split from ... (check_accessibility_of_qualified_id): ... here. * decl.c (make_typename_type): Use it. * pt.c (build_template_info): Define. (check_explicit_specialization, find_parameter_packs_r, push_template_decl_real, lookup_template_class, for_each_template_parm_r, tsubst_decl, tsubst): Use build_template_info. (get_types_needing_access_check): Adjust return type. (append_type_to_template_for_access_check_1): Record the location of the usage point of the typedef. Adjust to TEMPLATE_INFO. (append_type_to_template_for_access_check): Add new location parameter. Pass it to append_type_to_template_for_access_check_1. Adjust to TEMPLATE_INFO. (perform_typedefs_access_check): Temporarily set input_location to the usage point of the typedef we are checking access for. Adjust to new TEMPLATE_INFO tree node. * tree.c (bind_template_template_parm): Use build_template_info. * call.c (add_template_candidate_real): Likewise. * decl.c (grokfndecl): Likewise. (cp_tree_node_structure): Handle TEMPLATE_INFO. gcc/testsuite/ChangeLog: PR c++/14777 * g++.dg/template/typedef13.C: Adjust. * g++.dg/template/typedef19.C: Adjust. * g++.dg/template/typedef20.C: Adjust. * g++.dg/template/typedef22.C: New test. From-SVN: r154443
2009-11-21PR c++/9050, DR 147, DR 318Jason Merrill4-40/+114
PR c++/9050, DR 147, DR 318 * parser.c (cp_parser_lookup_name): If the name matches the explicit class scope, we're naming the constructor. (cp_parser_constructor_declarator_p): Just use cp_parser_unqualified_id if we have a nested-name-specifier. (cp_parser_direct_declarator): Handle getting an overload set as a constructor declarator. (cp_parser_unqualified_id): Avoid looking up the constructor when naming the destructor. (cp_parser_diagnose_invalid_type_name): Give good diagnostic for improper use of constructor as template. * typeck.c (finish_class_member_access_expr): Give good diagnostic about calling constructor. * error.c (dump_aggr_type): Don't print A::A for injected-class-name. From-SVN: r154403
2009-11-20re PR c++/38646 (ICE with invalid specialization of variadic template)Simon Martin2-5/+11
gcc/cp/ 2009-11-20 Simon Martin <simartin@users.sourceforge.net> PR c++/38646 * pt.c (process_partial_specialization): Do not turn wrongly located parameter pack arguments into error_mark_node. Split too long lines into two. gcc/testsuite/ 2009-11-20 Simon Martin <simartin@users.sourceforge.net> PR c++/38646 * g++.dg/cpp0x/pr38646.C: New test. From-SVN: r154378
2009-11-20re PR c++/42060 ([c++0x] ICE throwing array with initializer list)Paolo Carlini2-2/+12
cp/ 2009-11-20 Paolo Carlini <paolo.carlini@oracle.com> PR c++/42060 * except.c (build_throw): Check the tree returned by decay_conversion for error_mark_node. testsuite/ 2009-11-20 Paolo Carlini <paolo.carlini@oracle.com> PR c++/42060 * g++.dg/cpp0x/initlist28.C: New. From-SVN: r154371
2009-11-20re PR c++/29017 (%s substituted with different untranslated words can't be ↵Shujing Zhao4-37/+155
properly translated) /cp 2009-11-20 Shujing Zhao <pearly.zhao@oracle.com> PR c++/29017 * cp-tree.h (composite_pointer_operation): New type. (composite_pointer_type): Adjust prototype with new argument. * typeck.c (composite_pointer_type): Accept composite_pointer_operation as argument and emit diagnostic to be visible to gettext and checked at compile time. (composite_pointer_type_r): Likewise. (common_pointer_type): Update call to composite_pointer_type. (cp_build_binary_op): Likewise. * call.c (build_conditional_expr): Likewise. /testsuite 2009-11-20 Shujing Zhao <pearly.zhao@oracle.com> * g++.old-deja/g++.jason/rfg20.C: Make expected dg-error strings explicit. * g++.old-deja/g++.rfg/00321_01-.C: Likewise. * g++.old-deja/g++.rfg/00324_02-.C: Likewise. * g++.old-deja/g++.law/typeck1.C: Likewise. * g++.old-deja/g++.bugs/900324_02.C: Likewise. * g++.dg/conversion/ptrmem9.C: Likewise. * g++.dg/expr/cond2.C: Likewise. From-SVN: r154360
2009-11-20re PR c++/42115 (r154072 & r154073 break build of ppl, non-placement ↵Jason Merrill2-0/+17
deallocation issue) PR c++/42115 * call.c (build_op_delete_call): Don't complain about using op delete (void *, size_t) for placement delete if there's an op delete (void *). From-SVN: r154357
2009-11-19DR 176 permissivenessJason Merrill5-0/+32
DR 176 permissiveness gcc/ * dwarf2out.c (get_context_die): Take TYPE_MAIN_VARIANT. gcc/cp/ * class.c (build_self_reference): Call set_underlying_type. * decl.c (check_elaborated_type_specifier): Don't complain about injected-class-name. (type_is_deprecated): Use TYPE_MAIN_VARIANT. * pt.c (convert_template_argument): Handle injected-class-name used as template template argument. * typeck2.c (abstract_virtuals_error): Use TYPE_MAIN_VARIANT. From-SVN: r154354
2009-11-19re PR c++/561 (std:unclear about Overloaded Function Pointer resolution)Jason Merrill5-38/+63
PR c++/561 * decl.c (static_fn_type): Split out... (revert_static_member_fn): ...from here. * cp-tree.h: Declare it. * class.c (resolve_address_of_overloaded_function): Use it to compare pointers to member functions. * typeck.c (build_static_cast_1): Call instantiate_type. From-SVN: r154336
2009-11-18re PR c++/40892 (maybe_warn_cpp0x i18n problems)Shujing Zhao6-22/+100
/cp 2009-11-18 Shujing Zhao <pearly.zhao@oracle.com> PR c++/40892 * error.c (maybe_warn_cpp0x): Accept enum cpp0x_warn_str as argument. (maybe_warn_variadic_templates): Update the maybe_warn_cpp0x calls to match the new declaration. * cp-tree.h (cpp0x_warn_str): New type. (maybe_warn_cpp0x): Adjust prototype with new argument. * call.c (reference_binding): Update the maybe_warn_cpp0x calls. * decl.c (reshape_init_r, check_initializer, grokdeclarator): Likewise. * parser.c (cp_parser_primary_expression) (cp_parser_parenthesized_expression_list, cp_parser_new_initializer) (cp_parser_assignment_expression, cp_parser_condition) (cp_parser_jump_statement, cp_parser_mem_initializer) (cp_parser_simple_type_specifier, cp_parser_elaborated_type_specifier) (cp_parser_enum_specifier, cp_parser_initializer) (cp_parser_pure_specifier, cp_parser_functional_cast): Likewise. /testsuite 2009-11-18 Shujing Zhao <pearly.zhao@oracle.com> * g++.old-deja/g++.other/crash28.C: Make expected dg-error strings explicit. * g++.dg/inherit/error4.C: Likewise. * g++.dg/template/crash90.C: Likewise. From-SVN: r154288
2009-11-18re PR c++/3187 (gcc lays down two copies of constructors)Jakub Jelinek6-22/+93
PR c++/3187 * cgraph.h (struct cgraph_node): Add same_body and same_body_alias fields. (cgraph_same_body_alias, cgraph_remove_same_body_alias): New prototypes. * cgraphunit.c (cgraph_expand_function, cgraph_emit_thunks, cgraph_materialize_all_clones): Handle same_body aliases. * cgraph.c (cgraph_allocate_node): New function. (cgraph_create_node): Use it. (cgraph_node_for_decl, cgraph_node, cgraph_get_node, cgraph_node_for_asm, cgraph_remove_node): Handle same_body aliases. (cgraph_same_body_alias, cgraph_remove_same_body_alias): New functions. * lto-cgraph.c (lto_output_node): Stream out same_body aliases. (input_node): Stream in same_body aliases. * lto-symtab.c (lto_cgraph_replace_node): Clear node pointers for same_body aliases. (lto_symtab_merge_cgraph_nodes_1): Handle same_body aliases. * cp-tree.h (expand_or_defer_fn_1): New prototype. * decl2.c (cp_write_global_declarations): Mark as !DECL_EXTERNAL also all same_body aliases. * semantics.c (expand_or_defer_fn): Move most of the function except registering with cgraph to ... (expand_or_defer_fn_1): ... here. New function. * optimize.c: Include cgraph.h. (maybe_clone_body): If in charge parm is not used and both base and complete clones are created and are not comdat, tell cgraph they have the same body. * Make-lang.in (cp/optimize.o): Depend on $(CGRAPH_H). * g++.dg/abi/mangle26.C: Also match *C2* definition. * g++.dg/abi/mangle27.C: Likewise. * g++.dg/abi/mangle28.C: Likewise. * g++.dg/abi/mangle29.C: Likewise. From-SVN: r154284
2009-11-17re PR c++/42058 (Trouble with invalid array initialization)Paolo Carlini3-1/+11
cp/ 2009-11-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/42058 * typeck2.c (digest_init_r): Check init for error_operand_p. * decl.c (reshape_init_class): Check return value of reshape_init_r for error_mark_node. testsuite/ 2009-11-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/42058 * testsuite/g++.dg/init/array26.C: New. * testsuite/g++.dg/init/array27.C: Likewise. * testsuite/g++.old-deja/g++.benjamin/13478.C: Adjust dg-errors. From-SVN: r154267
2009-11-17re PR c++/42061 ([c++0x] ICE with invalid initializer list for reference)Jakub Jelinek2-0/+6
PR c++/42061 * call.c (reference_binding): Return NULL for initializer list with error operand inside of it. * g++.dg/cpp0x/initlist27.C: New test. From-SVN: r154238
2009-11-17re PR c++/42059 ([c++0x] ICE with initializer list for VLA)Jakub Jelinek2-1/+11
PR c++/42059 * typeck.c (cp_build_modify_expr): For initializer list call check_array_initializer to make sure lhs isn't a VLA. * g++.dg/cpp0x/initlist26.C: New test. From-SVN: r154237
2009-11-17PR c++/189, c++/9937, c++/13950, DR 176Jason Merrill1-1/+1
PR c++/189, c++/9937, c++/13950, DR 176 * g++.dg/tc1/dr176.C: Adjust. From-SVN: r154235
2009-11-16PR c++/13950, DR 176Jason Merrill6-40/+86
PR c++/13950, DR 176 * search.c (lookup_field_r): Allow lookup to find the injected-class-name from a template base. (template_self_reference_p): Remove. * decl.c (make_typename_type): Diagnose ambiguity. Use maybe_get_template_decl_from_type_decl. * parser.c (cp_parser_template_name): Pass true to is_template rather than use maybe_get_template_decl_from_type_decl. (cp_parser_lookup_name): Use maybe_get_template_decl_from_type_decl. * pt.c (maybe_get_template_decl_from_type_decl): Handle ambiguity. Use DECL_SELF_REFERENCE_P. * parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Avoid duplicate ambiguity error. * error.c (dump_decl): Don't say "typedef" for injected-class-name. * pt.c (convert_template_argument): Tweak logic. From-SVN: r154223
2009-11-16re PR c++/42055 (ICE with ambiguous template specialization)Paolo Carlini2-1/+7
cp/ 2009-11-16 Paolo Carlini <paolo.carlini@oracle.com> PR c++/42055 * pt.c (determine_specialization): Assign to candidates the return value of the chainon called before print_candidates. testsuite/ 2009-11-16 Paolo Carlini <paolo.carlini@oracle.com> PR c++/42055 * testsuite/g++.dg/template/crash92.C: New. From-SVN: r154202
2009-11-16re PR c++/32056 (Storage classes on template parameters)Paolo Carlini4-1/+21
cp/ 2009-11-16 Paolo Carlini <paolo.carlini@oracle.com> PR c++/32056 * decl.h (enum decl_context): Add TPARM enumerator. * decl.c (grokdeclarator): Per 14.1/2, error out if a storage class is specified in a template parameter declaration. * parser.c (cp_parser_template_parameter): Call grokdeclarator with TPARM as third argument. testsuite/ 2009-11-16 Paolo Carlini <paolo.carlini@oracle.com> PR c++/32056 * testsuite/g++.dg/template/error44.C: New. From-SVN: r154198
2009-11-13re PR c++/27425 (ICE with invalid template-template-parameter)Jason Merrill2-1/+8
PR c++/27425 PR c++/34274 * pt.c (expand_template_argument_pack): Handle null arg gracefully. (convert_template_argument): Use %T for type. From-SVN: r154164
2009-11-13re PR c++/29363 (ICE throwing undeclared object)Jason Merrill4-3/+7
PR c++/29363 * decl.c (create_implicit_typedef): Set TYPE_STUB_DECL here. (cxx_init_decl_processing): Not here. * name-lookup.c (pushtag): Or here. * pt.c (lookup_template_class): Or here. From-SVN: r154163
2009-11-13re PR c++/35075 (ICE with references in templates)Jason Merrill2-0/+25
PR c++/35075 * pt.c (convert_nontype_argument): Give helpful error about reference variable argument to reference template parameter. From-SVN: r154151
2009-11-13PR c++/21008, DR 515Jason Merrill2-9/+12
PR c++/21008, DR 515 * semantics.c (finish_non_static_data_member): Don't check derivation in a template. From-SVN: r154150
2009-11-13re PR c++/11987 (Accepts-invalid with inherited nested type)Jason Merrill5-4/+32
PR c++/11987 * parser.c (cp_parser_direct_declarator): Give helpful error about trying to define member of a dependent typedef. * pt.c (resolve_typename_type): Don't resolve a typedef typename. * tree.c (typedef_variant_p): New. * cp-tree.h: Declare it. From-SVN: r154149
2009-11-12re PR c++/27078 (Duplicate error message for ambiguous enum)Jason Merrill2-6/+14
PR c++/27078 * parser.c (cp_parser_primary_expression): Don't give a duplicate ambiguity error. From-SVN: r154139
2009-11-12re PR c++/39560 (Erroneous warnings 'unused variable' in a templated class ↵Jason Merrill2-0/+4
method with union) PR c++/39560 * decl2.c (build_anon_union_vars): Set DECL_ARTIFICIAL. From-SVN: r154133
2009-11-12re PR c++/37037 (ICE on template class member function definition after ↵Jason Merrill2-1/+6
explicit template class instantation) PR c++/37037 * decl.c (grokdeclarator): Don't generate a void PARM_DECL. From-SVN: r154131
2009-11-12re PR c++/42013 (cv-qualification of conditional expression type depending ↵Jason Merrill2-5/+12
on the value of its first expression?!?) PR c++/42013 * call.c (build_conditional_expr): Check specifically for folding to CALL_EXPR rather than TREE_SIDE_EFFECTS. From-SVN: r154129
2009-11-12typeck.c (cv_qualified_p): New fn.Jason Merrill5-8/+26
* typeck.c (cv_qualified_p): New fn. (decay_conversion): Use it. * cp-tree.h: Declare it. * tree.c (rvalue): Use it and cv_unqualified. * init.c (build_aggr_init): Likewise. From-SVN: r154125
2009-11-12re PR c++/42013 (cv-qualification of conditional expression type depending ↵Jason Merrill2-2/+13
on the value of its first expression?!?) PR c++/42013 * call.c (build_conditional_expr): Don't fold a TREE_SIDE_EFFECTS COND_EXPR in unevaluated context. From-SVN: r154124
2009-11-12decl2.c (constrain_visibility): Clear WEAK and COMMON flags.Jan Hubicka2-0/+6
* decl2.c (constrain_visibility): Clear WEAK and COMMON flags. * ipa.c (function_and_variable_visibility): Verify that WEAK || COMMON imply PUBLIC || EXTERNAL. From-SVN: r154115
2009-11-11re PR c++/39131 (decimal float point: ICE on typeid( 0.dd ))Jason Merrill2-0/+6
PR c++/39131 * rtti.c (emit_support_tinfos): Add DFP types. * config/abi/pre/gnu.ver: Add DFP types. * testsuite/util/testsuite_abi.cc (check_version): Add CXXABI_1.3.4. From-SVN: r154113
2009-11-11call.c (build_op_delete_call): Downgrade error about placement/non-placement ↵Jason Merrill2-2/+7
confusion to permerror. * call.c (build_op_delete_call): Downgrade error about placement/non-placement confusion to permerror. From-SVN: r154106
2009-11-10* call.c (build_op_delete_call): Tweak error.Jason Merrill2-3/+9
From-SVN: r154073
2009-11-10re PR c++/34158 (Template delete doesn't call if exception thrown in ↵Jason Merrill4-66/+90
constructor) PR c++/34158 PR c++/36406 * call.c (non_placement_deallocation_fn_p): Split out... (build_op_delete_call): ...from here. Use instantiate_type for placement delete. Simplify logic. * pt.c (primary_template_instantiation_p): Non-static. * cp-tree.h: Declare it. From-SVN: r154072
2009-11-09re PR c++/41972 (nondependent static member function as a reference template ↵Jason Merrill2-2/+14
parameter fails) PR c++/41972 * parser.c (cp_parser_template_argument): Accept SCOPE_REF around VAR_DECL. From-SVN: r154042
2009-11-09re PR c++/41994 (ICE with &A::operator T)Jason Merrill2-3/+9
PR c++/41994 * pt.c (tsubst_baselink): tsubst the name. From-SVN: r154041
2009-11-0837920, not 37290Jason Merrill1-1/+1
From-SVN: r154021
2009-11-08re PR target/37290 (Endless recursion in cse_cc_succs)Jason Merrill2-4/+14
PR c++/37290 * pt.c (tsubst) [TYPEOF_TYPE]: Set cp_unevaluated_operand. From-SVN: r154018
2009-11-07re PR c++/18451 (C++ error message regression)Jason Merrill4-13/+47
PR c++/18451 PR c++/40738 * cp-tree.h (cp_decl_specifier_seq): Add any_type_specifiers_p. * parser.c (cp_parser_single_declaration): Call cp_parser_parse_and_diagnose_invalid_type_name here, too. (cp_parser_parameter_declaration): And here. (cp_parser_parse_and_diagnose_invalid_type_name): Be less picky about declarator form. Don't skip to the end of the block if we're in a declarator. (cp_parser_decl_specifier_seq): Set any_type_specifiers_p. (cp_parser_simple_declaration): Check it. (cp_parser_member_declaration): Likewise. (cp_parser_diagnose_invalid_type_name): Tweak error message. (cp_parser_expression_statement): Likewise. * decl2.c (grokfield): Mention decltype instead of typeof. From-SVN: r154006
2009-11-06add missing changelog lineJason Merrill1-0/+1
From-SVN: r153979
2009-11-06re PR c++/15946 (Unhelpful error message when "typename" is omitted)Jason Merrill4-8/+49
PR c++/15946 * parser.c (cp_parser_check_template_parameters): Don't talk about specialization at function scope. (cp_parser_diagnose_invalid_type_name): Handle dependent scope. (cp_parser_parse_and_diagnose_invalid_type_name): Likewise. (cp_parser_expression_statement): Suggest typename. * error.c (dump_decl) [SCOPE_REF]: Print the type here. (dump_expr) [SCOPE_REF]: Call it. (dump_type) [UNBOUND_CLASS_TEMPLATE]: Check TFF_UNQUALIFIED_NAME. * cxx-pretty-print.c (pp_cxx_unqualified_id): Print class template args. From-SVN: r153978
2009-11-06re PR c++/9381 (attribute on member function pointer have no effect)Jason Merrill7-24/+48
PR c++/9381 * decl2.c (build_memfn_type): Preserve attributes. (cp_reconstruct_complex_type): Likewise. (maybe_retrofit_in_chrg): Likewise. * call.c (standard_conversion): Use build_memfn_type. * pt.c (tsubst): Likewise. * decl.c (build_ptrmem_type): Likewise (check_function_type): Preserve attributes. * tree.c (cp_build_type_attribute_variant): Propagate exception specs on METHOD_TYPE, too. (strip_typedefs): Preserve exception specs and attributes. From-SVN: r153977
2009-11-06re PR c++/41536 (always_inline does not work always with constructors)Andrew Pinski2-0/+8
2009-11-06 Andrew Pinski <andrew_pinski@playstation.sony.com> PR c++/41536 * optimize.c (maybe_clone_body): Copy DECL_ATTRIBUTES and DECL_DISREGARD_INLINE_LIMITS also. 2009-11-06 Andrew Pinski <andrew_pinski@playstation.sony.com> PR c++/41536 * g++.dg/ext/always_inline-5.C: New test. From-SVN: r153974
2009-11-06re PR c++/41967 (gcc get into endless loop when compiling an openmp program)Jakub Jelinek2-1/+9
PR c++/41967 * parser.c (cp_parser_omp_for_loop): After diagnosing not perfectly nested loop and parsing statements, don't cp_parser_require }, instead exit the loop if next token is CPP_EOF. * g++.dg/gomp/pr41967.C: New test. From-SVN: r153972
2009-11-05re PR c++/34180 (Default copy constructor copies const auto_ptr members)Jason Merrill2-0/+5
PR c++/34180 * method.c (do_build_copy_constructor): Don't drop cv-quals from the field type. From-SVN: r153960
2009-11-05re PR c++/7046 (#pragma pack(1) context evaluated at point of instantiation ↵Jason Merrill3-0/+13
rather than declaration) PR c++/7046 * class.c (finish_struct): Store maximum_field_alignment in TYPE_PRECISION. * pt.c (instantiate_class_template): Set maximum_field_alignment. From-SVN: r153959
2009-11-05re PR c++/34870 (argument-dependent lookup fails to find friend declaration)Jason Merrill3-1/+8
PR c++/34870 * name-lookup.c (arg_assoc_class): Call complete_type. * pt.c (instantiate_class_template): Call uses_template_parms instead of dependent_type_p. From-SVN: r153958
2009-11-05re PR c++/41703 (Problems with SFINAE. Source works at gcc 3.4.6 but fails ↵Jason Merrill2-27/+96
at 4.2.1 and 4.5.0.20091008) PR c++/41703 * pt.c (check_undeduced_parms): New subroutine of... (more_specialized_fn): ...here. Undeduced template parms can make a template less specialized than another. From-SVN: r153957