aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
AgeCommit message (Collapse)AuthorFilesLines
2010-05-28c-common.h (GCC_DIAG_STYLE): Define earlier in the file, before including ↵Steven Bosscher1-1/+1
diagnostic-core.h. gcc/ChangeLog: * c-common.h (GCC_DIAG_STYLE): Define earlier in the file, before including diagnostic-core.h. (c_cpp_error): New prototype moved from c-tree.h. Use ATTRIBUTE_GCC_DIAG instead of ATTRIBUTE_GCC_CDIAG. * c-tree.h (ATTRIBUTE_GCC_CDIAG): Remove define. (pedwarn_c90, perwarn_c99): Use ATTRIBUTE_GCC_DIAG instead. (c_cpp_error): Prototype moved to c-common.h. * Makefile.in: Update dependency for C_COMMON_H. cp/ChangeLog: * cp-tree.h (ATTRIBUTE_GCC_CXXDIAG): Remove. Require that this file is included before c-common.h. Define GCC_DIAG_STYLE before including diagnostic-core.h and toplev.h. (pedwarn_cxx98): Use ATTRIBUTE_GCC_DIAG. * pt.c: Include cp-tree.h before c-common.h. From-SVN: r160007
2010-05-27diagnostic-core.h: New.Joseph Myers1-1/+1
* diagnostic-core.h: New. Contents moved from diagnostic.h and toplev.h. * diagnostic.c: Don't include toplev.h. (progname): Define. Moved from toplev.c. (seen_error): New function. * diagnostic.h: Include diagnostic-core.h. (diagnostic_t, emit_diagnostic): Don't declare here. * toplev.c (progname): Move to toplev.c. (emit_debug_global_declarations, compile_file, finalize, do_compile, toplev_main): Use seen_error. * toplev.h: Include diagnostic-core.h. (trim_filename, GCC_DIAG_STYLE, ATTRIBUTE_GCC_DIAG, internal_error, warning, warning_at, error, error_n, error_at, fatal_error, pedwarn, permerror, sorry, inform, inform_n, verbatim, fnotice, progname): Move to diagnostic-core.h. * builtins.c: Include diagnostic-core.h instead of diagnostic.h. (expand_builtin_expect): Use seen_error. * c-decl.c: Include diagnostic-core.h instead of diagnostic.h. (c_make_fname_decl, c_write_global_declarations): Use seen_error. * c-format.c: Include diagnostic-core.h instead of diagnostic.h. * c-gimplify.c: Include diagnostic-core.h instead of diagnostic.h. * c-lang.c: Include diagnostic-core.h instead of diagnostic.h. * c-lex.c (c_lex_with_flags, interpret_float): Don't increment errorcount for errors. * c-opts.c (c_common_finish): Use seen_error. * cgraph.c: Include diagnostic-core.h instead of diagnostic.h. * cgraphunit.c (verify_cgraph_node, verify_cgraph, cgraph_output_pending_asms, cgraph_optimize): Use seen_error. * coverage.c: Include diagnostic-core.h instead of diagnostic.h. (get_coverage_counts): Use seen_error. * dwarf2out.c (dwarf2out_finish): Use seen_error. * gimplify.c (gimplify_var_or_parm_decl, gimple_push_cleanup, gimplify_body): Use seen_error. * ipa-inline.c (cgraph_early_inlining): Use seen_error. * ipa-pure-const.c (gate_pure_const): Use seen_error. * ipa-reference.c (gate_reference): Use seen_error. * jump.c: Include diagnostic-core.h instead of diagnostic.h. * lambda-code.c: Include diagnostic-core.h instead of diagnostic.h. * lto-cgraph.c: Include diagnostic-core.h instead of diagnostic.h. * lto-compress.c: Include diagnostic-core.h instead of diagnostic.h. * lto-section-in.c: Include diagnostic-core.h instead of diagnostic.h. * lto-streamer-out.c: Include diagnostic-core.h instead of diagnostic.h. * lto-streamer.c: Include diagnostic-core.h instead of diagnostic.h. (gate_lto_out): Use seen_error. * matrix-reorg.c: Include diagnostic-core.h instead of diagnostic.h. * omega.c: Include diagnostic-core.h instead of diagnostic.h. * omp-low.c: Include diagnostic-core.h instead of diagnostic.h. (gate_expand_omp, lower_omp_1): Use seen_error. * passes.c: Include diagnostic-core.h instead of diagnostic.h. (rest_of_decl_compilation, rest_of_type_compilation, gate_rest_of_compilation, ipa_write_summaries): Use seen_error. * tree-cfg.c (label_to_block_fn): Use seen_error. * tree-inline.c (optimize_inline_calls): Use seen_error. * tree-mudflap.c (mudflap_finish_file): Use seen_error. * tree-optimize.c (gate_all_optimizations, gate_all_early_local_passes, gate_all_early_optimizations): Use seen_error. * tree-ssa-structalias.c (gate_ipa_pta): Use seen_error. * varpool.c: Include diagnostic-core.h instead of diagnostic.h. (varpool_remove_unreferenced_decls, varpool_assemble_pending_decls): Use seen_error. * Makefile.in (DIAGNOSTIC_CORE_H): Define. (TOPLEV_H, DIAGNOSTIC_H): Update. (c-decl.o, c-lang.o, c-format.o, lto-compress.o, lto-cgraph.o, lto-streamer-out.o, lto-section-in.o, lto-streamer.o, c-gimplify.o, omp-low.o, omega.o, diagnostic.o, passes.o, builtins.o, jump.o, cgraph.o, varpool.o, matrix-reorg.o, coverage.o, lambda-code.o): Update dependencies. cp: * call.c: Include diagnostic-core.h instead of diagnostic.h. * cp-lang.c: Don't include diagnostic.h * name-lookup.c: Include diagnostic-core.h instead of diagnostic.h. (cp_emit_debug_info_for_using): Use seen_error. * optimize.c: Include diagnostic-core.h instead of diagnostic.h. * parser.c: Include diagnostic-core.h instead of diagnostic.h. * pt.c (iterative_hash_template_arg): Use seen_error. * repo.c: Include diagnostic-core.h instead of diagnostic.h. * typeck2.c: Include diagnostic-core.h instead of diagnostic.h. * Make-lang.in (cp/cp-lang.o, cp/typeck2.o, cp/call.o, cp/repo.o, cp/optimize.o, cp/parser.o, cp/name-lookup.o): Update dependencies. lto: * lto.c: Include diagnostic-core.h instead of diagnostic.h. (read_cgraph_and_symbols, lto_main): Use seen_error. * Make-lang.in (lto/lto.o): Update dependencies. objc: * objc-act.c: Include diagnostic-core.h instead of diagnostic.h. * Make-lang.in (objc/objc-act.o): Update dependencies. From-SVN: r159947
2010-05-26re PR c++/43382 ([C++0x] ICE with auto return type and variadic templates)Jason Merrill1-13/+17
PR c++/43382 * pt.c (fn_type_unification): Don't get confused by recursive unification. From-SVN: r159873
2010-05-25Makefile.in (EXCEPT_H): Fix typo.Steven Bosscher1-7/+5
gcc/ChangeLog: * Makefile.in (EXCEPT_H): Fix typo. objc/ChangeLog: * objc-act.h: Do not include gimple.h. * objc-act.c: Do not include rtl.h, expr.h, libfuncs.h, and tm_p.h. Include gimple.h. Explain why except.h has to be included. * objc-lang.c: Do not include diagnostics.h. * Make-lang.in: Update dependencies. objcp/ChangeLog: * objcp-decl.c: Do not include tm.h, rtl.h, expr.h, c-common.h, flags.h, input.h, except.h, output.h, toplev.h, cpplib.h, debug.h, and target.h. * objcp-lang.c: Do not include tm.h, toplev.h, diagnostics.h, and debug.h. Explain why except.h has to be included. * Make-lang.in: Update dependencies. cp/ChangeLog: * cp-tree.h: Do not include splay-tree.h. (struct prtmem_cst): Remove unused field and false comment. * typeck.c: Do not include rtl.h, expr.h, and tm_p.h. * optimize.c: Do not inclde rtl.h, insn-config.h, and integrate.h. * init.c: Do not include rtl.h and expr.h. * class.c: Do not include rtl.h. Include splay-tree.h. (build_clone): Use plain NULL instead of NULL_RTX. * decl.c: Do not include expr.h. Explain why rtl.h has to be included. Include splay-tree.h. * method.c: Do not include rtl.h and expr.h. (use_thunk): Use plain NULL instead of NULL_RTX. * except.c: Do not include rtl.h, expr.h, and libfuncs.h. * tree.c: Do not include rtl.h, insn-config.h, integrate.h, and target.h. Include splay-tree.h. * expr.c: Do not include rtl.h and expr.h. * pt.c: Do not include obstack.h and rtl.h. (tsubst_friend_function): Use plain NULL instead of NULL_RTX. (tsubst_decl): Likewise. (instantiate_decl): Likewise. * semantics.c: Do not include exprt.h and debug.h. Explain why rtl.h has to be included. * decl2.c: Do not include rtl.h and expr.h. Include splay-tree.h. * call.c: Do not include rtl.h and expr.h. * search.c: Do not include obstack.h and rtl.h. * friend.c: Do not include rtl.h and expr.h. * Make-lang.in: Update dependencies. From-SVN: r159839
2010-05-19call.c (reference_binding): Use cp_build_qualified_type_real and ↵Jason Merrill1-4/+4
cp_type_quals consistently. * call.c (reference_binding): Use cp_build_qualified_type_real and cp_type_quals consistently. (add_function_candidate): Likewise. (build_conditional_expr): Likewise. (convert_like_real): Likewise. (type_passed_as): Likewise. * class.c (add_method): Likewise. (same_signature_p): Likewise. (layout_class_type): Likewise. * decl.c (cxx_init_decl_processing): Likewise. (cp_fname_init): Likewise. (grokdeclarator): Likewise. * decl2.c (cp_reconstruct_complex_type): Likewise. * init.c (build_new_1): Likewise. * method.c (do_build_copy_constructor): Likewise. (implicitly_declare_fn): Likewise. * pt.c (tsubst_aggr_type): Likewise. (tsubst): Likewise. * rtti.c (init_rtti_processing): Likewise. (build_headof): Likewise. (build_dynamic_cast_1): Likewise. (tinfo_base_init): Likewise. (emit_support_tinfos): Likewise. * semantics.c (capture_decltype): Likewise. * tree.c (cv_unqualified): Likewise. * typeck.c (composite_pointer_type): Likewise. (string_conv_p): Likewise. * mangle.c (write_CV_qualifiers_for_type): Tweak. * call.c (initialize_reference): Use CP_TYPE_CONST_P. * decl.c (start_decl): Likewise. * semantics.c (finish_compound_literal): Likewise. * typeck.c (check_return_expr): Use CP_TYPE_VOLATILE_P. (cp_type_readonly): Remove. * cp-tree.h: Remove declaration. From-SVN: r159599
2010-05-19decl.c (grokdeclarator): Don't check quals on fn type.Jason Merrill1-3/+3
* decl.c (grokdeclarator): Don't check quals on fn type. * typeck.c (cp_apply_type_quals_to_decl): Likewise. * tree.c (cp_build_qualified_type_real): Simplify qualifier checking. From-SVN: r159597
2010-05-19re PR c++/44193 (function types, cv-quals and typename)Jason Merrill1-15/+7
PR c++/44193 * typeck.c (type_memfn_quals): New fn. (apply_memfn_quals): New fn. (cp_type_quals): Return TYPE_UNQUALIFIED for FUNCTION_TYPE. (cp_type_readonly): Use cp_type_quals. * cp-tree.h: Add declarations. * tree.c (cp_build_qualified_type_real): Don't set, but do preserve, quals on FUNCTION_TYPE. (strip_typedefs): Use apply_memfn_quals and type_memfn_quals. * decl.c (build_ptrmem_type): Likewise. (grokdeclarator): Likewise. (static_fn_type): Likewise. * decl2.c (change_return_type): Likewise. (cp_reconstruct_complex_type): Likewise. * pt.c (tsubst_function_type): Likewise. (unify): Likewise. (tsubst): Likewise. Drop special FUNCTION_TYPE substitution code. From-SVN: r159596
2010-05-15re PR c++/44148 (C++ genericization/gimplification may clobber templare ↵Jakub Jelinek1-1/+1
arguments) PR c++/44148 * pt.c (tsubst): Unshare template argument. * g++.dg/torture/pr44148.C: New test. From-SVN: r159443
2010-05-11re PR c++/34272 (ICE with invalid template specialization)Paolo Carlini1-3/+6
/cp 2010-05-11 Paolo Carlini <paolo.carlini@oracle.com> PR c++/34272 PR c++/43630 PR c++/34491 * pt.c (process_partial_specialization): Return error_mark_node in case of unused template parameters in partial specialization. /testsuite 2010-05-11 Paolo Carlini <paolo.carlini@oracle.com> PR c++/34272 PR c++/43630 PR c++/34491 * g++.dg/template/crash97.C: New. * g++.dg/template/crash98.C: Likewise. * g++.dg/template/crash99.C: Likewise. * g++.dg/cpp0x/pr31439.C: Adjust. * g++.dg/template/crash95.C: Likewise. From-SVN: r159295
2010-05-06C++ support for -Wunused-but-set-variableJakub Jelinek1-0/+1
gcc/cp/ChangeLog: PR 18624 * cp-tree.h (mark_exp_read, mark_rvalue_use, mark_lvalue_use, mark_type_use): Declare ... * expr.c (mark_exp_read, mark_rvalue_use, mark_lvalue_use, mark_type_use): ... new fns. * typeck.c (cxx_sizeof_expr, cxx_alignof_expr): Call mark_type_use. (perform_integral_promotions): Call mark_rvalue_use. (cp_build_unary_op): Call mark_lvalue_use. (decay_conversion): Update comment. Call mark_lvalue. * decl.c (unused_but_set_errorcount): New variable. (poplevel): Issue -Wunused-but-set-variable diagnostics. (duplicate_decls): Merge DECL_READ_P flags. (start_cleanup_fn): Set DECL_READ_P flag. (finish_function): Issue -Wunused-but-set-parameter diagnostics. * tree.c (rvalue): Call mark_rvalue_use. * pt.c (convert_nontype_argument): Likewise. * semantics.c (finish_typeof, finish_decltype_type): Call mark_type_use. (finish_asm_stmt): Call mark_lvalue_use. (finish_expr_stmt): Call mark_exp_read. * call.c (convert_like_real) <ck_identity, ck_user>: Call mark_rvalue_use. (build_x_va_arg): Call mark_lvalue_use. (build_over_call): Call mark_type_use. * init.c (build_new, build_delete): Call mark_value_use. * rtti.c (build_typeid): Call mark_lvalue_use or mark_type_use. (build_dynamic_cast_1): call mark_lvalue_use or mark_rvalue_use. gcc/testsuite/ChangeLog: PR 18624 * g++.dg/warn/Wunused-7.C: Add dg-warning. * g++.dg/template/sfinae16.C: Likewise. * gcc.dg/Wunused-var-1.c: Moved to... * c-c++-common/Wunused-var-1.c: ...here. New test. * gcc.dg/Wunused-var-2.c: Moved to... * c-c++-common/Wunused-var-2.c: ...here. New test. * gcc.dg/Wunused-var-3.c: Moved to... * c-c++-common/Wunused-var-3.c: ...here. New test. * gcc.dg/Wunused-var-4.c: Moved to... * gcc.dg/Wunused-var-1.c: ... here. * gcc.dg/Wunused-var-5.c: Moved to... * c-c++-common/Wunused-var-4.c: ...here. New test. * gcc.dg/Wunused-var-7.c: Moved to... * c-c++-common/Wunused-var-5.c: ...here. New test. * gcc.dg/Wunused-var-6.c: Moved to... * gcc.dg/Wunused-var-2.c: ... here. * c-c++-common/Wunused-var-1.c: New test. * c-c++-common/Wunused-var-2.c: New test. * c-c++-common/Wunused-var-3.c: New test. * c-c++-common/Wunused-var-4.c: New test. * c-c++-common/Wunused-var-5.c: New test. * g++.dg/warn/Wunused-var-1.C: New test. * g++.dg/warn/Wunused-var-2.C: New test. * g++.dg/warn/Wunused-var-3.C: New test. * g++.dg/warn/Wunused-var-4.C: New test. * g++.dg/warn/Wunused-var-5.C: New test. * g++.dg/warn/Wunused-var-6.C: New test. * g++.dg/warn/Wunused-var-7.C: New test. * g++.dg/warn/Wunused-var-8.C: New test. * g++.dg/warn/Wunused-parm-1.C: New test. * g++.dg/warn/Wunused-parm-2.C: New test. * g++.dg/warn/Wunused-parm-3.C: New test. Co-Authored-By: Dodji Seketeli <dodji@redhat.com> From-SVN: r159096
2010-05-04re PR c++/43028 ([C++0x] internal compiler error in ↵Paolo Carlini1-0/+4
maybe_adjust_types_for_deduction) /cp 2010-05-04 Paolo Carlini <paolo.carlini@oracle.com> PR c++/43028 * pt.c (unify): Check each elt for error_mark_node. /testsuite 2010-05-04 Paolo Carlini <paolo.carlini@oracle.com> PR c++/43028 * g++.dg/cpp0x/initlist31.C: New. From-SVN: r159045
2010-05-04re PR c++/43953 (ICE: dependent_type_p, at cp/pt.c:17404)Dodji Seketeli1-3/+5
Fix PR c++/43953 gcc/cp/ChangeLog: PR c++/43953 * pt.c (most_specialized_class): Pretend we are processing a template decl during the call to coerce_template_parms. gcc/testsuite/ChangeLog: PR c++/43953 * g++.dg/other/crash-12.C: New test. From-SVN: r159019
2010-04-13call.c (type_decays_to): Check MAYBE_CLASS_TYPE_P instead of CLASS_TYPE_P.Jason Merrill1-0/+6
* call.c (type_decays_to): Check MAYBE_CLASS_TYPE_P instead of CLASS_TYPE_P. * parser.c (cp_parser_lambda_expression): Complain about lambda in unevaluated context. * pt.c (iterative_hash_template_arg): Don't crash on lambda. From-SVN: r158277
2010-04-07PR c++/11094, DR 408Jason Merrill1-4/+20
PR c++/11094, DR 408 * cp-tree.h (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): New. * decl2.c (finish_static_data_member_decl): Set it. * decl.c (duplicate_decls): Propagate it. * pt.c (tsubst_decl): Don't substitute the domain of an array VAR_DECL if it's set. (regenerate_decl_from_template): Substitute it here. (type_dependent_expression_p): Return true if it's set. * semantics.c (finish_decltype_type): Instantiate such a variable. * typeck.c (cxx_sizeof_expr): Likewise. (strip_array_domain): New. From-SVN: r158075
2010-04-07re PR c++/38392 (Template friend function injection)Jason Merrill1-5/+12
PR c++/38392 * pt.c (tsubst_friend_function): Instatiate a friend that has already been used. From-SVN: r158073
2010-04-07pt.c (print_template_statistics): New.Jason Merrill1-0/+15
* pt.c (print_template_statistics): New. * cp-tree.h: Declare it. * tree.c (cxx_print_statistics): Call it. From-SVN: r158072
2010-04-07re PR c++/42697 (ice-on-legal-code: template class template function local ↵Dodji Seketeli1-1/+2
objects) Fix PR c++/42697 gcc/cp/ChangeLog: PR c++/42697 *pt.c (tsubst_decl): Get the arguments of a specialization from the specialization template, not from the most general template. gcc/testsuite/ChangeLog: PR c++/42697 * g++.dg/template/crash94.C: New test. From-SVN: r158068
2010-04-06re PR c++/43621 (ICE: in poplevel_class, at cp/name-lookup.c:2615 with ↵Jason Merrill1-2/+4
invalid qualified name) PR c++/43621 * pt.c (maybe_update_decl_type): Check the return value from push_scope. From-SVN: r158006
2010-03-31re PR c++/43558 (Rejects specialization)Dodji Seketeli1-3/+3
Fix PR c++/43558 gcc/cp/ChangeLog: PR c++/43558 * cp-tree.h (TEMPLATE_TYPE_PARM_SIBLING_PARMS): New accessor macro. * pt.c (end_template_parm_list): Store sibling template parms of each TEMPLATE_TYPE_PARMs into its TEMPLATE_TYPE_PARM_SIBLING_PARMS. (push_template_decl_real): Don't store the containing template decl into the DECL_CONTEXT of TEMPLATE_TYPE_PARMs anymore. * typeck.c (get_template_parms_of_dependent_type): Get sibling parms of a TEMPLATE_TYPE_PARM from TEMPLATE_TYPE_PARM_SIBLING_PARMS. Simplify the logic. gcc/testsuite/ChangeLog: PR c++/43558 * g++.dg/template/typedef31.C: New test. From-SVN: r157857
2010-03-30re PR c++/43076 (ICE: SIGSEGV with invalid C++ code after giving diagnostics)Jason Merrill1-0/+3
PR c++/43076 * pt.c (push_template_decl_real): Deal better with running out of scopes before running out of template parms. From-SVN: r157842
2010-03-30re PR c++/43559 (Overloaded template functions became ambiguous)Jason Merrill1-5/+2
PR c++/43559 * pt.c (more_specialized_fn): Don't control cv-qualifier check with same_type_p. From-SVN: r157831
2010-03-26re PR c++/43327 (ICE in unifiy.c)Dodji Seketeli1-0/+22
Fix for PR c++/43327 gcc/cp/ChangeLog: PR c++/43327 * pt.c (add_to_template_args): Support NULL ARGS; (most_specialized_class): call coerce_template_parms on template arguments passed to get_class_bindings. Use add_to_template_args. (unify): Handle VAR_DECLs. gcc/testsuite/ChangeLog: PR c++/43327 * g++.dg/other/crash-10.C: New test. * g++.dg/other/crash-11.C: New test. From-SVN: r157745
2010-03-26Fix compilation.Dodji Seketeli1-1/+1
* cp-tree.h (get_template_parms_at_level): Change unsigned parm into int. * pt.c (get_template_parms_at_level): Adjust. From-SVN: r157743
2010-03-25Fix candidate for PR c++/43206Dodji Seketeli1-0/+19
gcc/cp/ChangeLog: PR c++/43206 * cp-tree.h (get_template_parms_at_level): Declare ... * pt.c (get_template_parms_at_level): ... new function. * typeck.c (get_template_parms_of_dependent_type): If a template type parm's DECL_CONTEXT isn't yet set, get its siblings from current_template_parms. Use get_template_parms_at_level. Remove useless test. (incompatible_dependent_types_p): If we get empty parms from just one of the template type parms we are comparing then the template parms are incompatible. gcc/testsuite/ChangeLog: PR c++/43206 * g++.dg/template/typedef30.C: New test case. From-SVN: r157730
2010-03-22re PR c++/43281 ([c++0x] ICE with invalid auto)Jason Merrill1-0/+26
PR c++/43281 * pt.c (contains_auto_r): New fn. (do_auto_deduction): Use it. (tsubst): Don't look at TREE_TYPE of a TEMPLATE_TYPE_PARM. From-SVN: r157651
2010-03-04pt.c (process_partial_specialization): Use error_n instead of error.Marco Poletti1-7/+10
2010-03-04 Marco Poletti <poletti.marco@gmail.com> * pt.c (process_partial_specialization): Use error_n instead of error. From-SVN: r157229
2010-03-01toplev.h (inform_n, error_n): Declare.Shujing Zhao1-4/+8
gcc/ 2010-03-01 Marco Poletti <poletti.marco@gmail.com> * toplev.h (inform_n, error_n): Declare. * diagnostic.c (inform_n, error_n): New function. gcc/cp/ 2010-03-01 Marco Poletti <poletti.marco@gmail.com> * pt.c (redeclare_class_template): Use error_n and inform_n. gcc/po 2010-03-01 Shujing Zhao <pearly.zhao@oracle.com> * exgettext: Handle the functions that end with _n. From-SVN: r157134
2010-02-28re PR c++/42748 (warnings about 'mangling of 'va_list' has changed in GCC ↵Mark Mitchell1-4/+2
4.4' not suppressed in sytem headers) 2010-02-27 Mark Mitchell <mark@codesourcery.com> PR c++/42748 * cp-tree.h (push_tinst_level): Declare. (pop_tinst_level): Likewise. * pt.c (push_tinst_level): Give it external linkage. (pop_tinst_level): Likewise. * mangle.c (mangle_decl_string): Set the source location to that of the decl while mangling. 2010-02-27 Mark Mitchell <mark@codesourcery.com> PR c++/42748 * g++.dg/abi/mangle11.C: Adjust mangling warning locations. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/template/cond2.C: Likewise. * g++.dg/template/pr35240.C: Likewise. From-SVN: r157124
2010-02-27re PR c++/42054 (ICE with invalid template parameter)Simon Martin1-10/+12
gcc/cp/ 2010-02-27 Simon Martin <simartin@users.sourceforge.net> PR c++/42054 * pt.c (redeclare_class_template): Return false if there are erroneous template parameters. gcc/testsuite/ 2010-02-27 Simon Martin <simartin@users.sourceforge.net> PR c++/42054: * g++.dg/parse/error37.C: New test. From-SVN: r157112
2010-02-24c.opt (-ftemplate-depth=): New.Manuel López-Ibáñez1-2/+2
2010-02-24 Manuel López-Ibáñez <manu@gcc.gnu.org> * c.opt (-ftemplate-depth=): New. (-ftemplate-depth-): Deprecate. * optc-gen.awk: Handle -ftemplate-depth=. * opth-gen.awk: Likewise. * c-opts.c (c_common_handle_option): Likewise. * doc/invoke.texi (-ftemplate-depth-): Replace with -ftemplate-depth=. cp/ * pt.c (push_tinst_level): Replace -ftemplate-depth- with -ftemplate-depth=. From-SVN: r157054
2010-02-21re PR c++/42824 (c++ compilation complains about error: call of overloaded)Dodji Seketeli1-17/+73
Fix PR c++/42824 gcc/cp/ChangeLog: PR c++/42824 * pt.c (lookup_template_class): Better support of specialization of member of class template implicit instantiation. gcc/testsuite/ChangeLog: PR c++/42824 * g++.dg/template/memclass4.C: New test. From-SVN: r156939
2010-02-18re PR c++/26261 (Rejects template with const static data member used in ↵Jason Merrill1-8/+52
return type) PR c++/26261 PR c++/43101 * pt.c (tsubst_qualified_id): Do normal lookup in non-dependent scope. (maybe_update_decl_type): New fn. * parser.c (cp_parser_init_declarator): Use it. From-SVN: r156865
2010-02-17re PR c++/43079 (ICE with incompatible pointer-to-member-function as ↵Jason Merrill1-3/+4
template parameter) PR c++/43079 * pt.c (convert_nontype_argument): Change assert to test. From-SVN: r156839
2010-02-10Make-lang.in (cp/cvt.o, [...]): Depend on intl.h.Shujing Zhao1-7/+11
2010-02-10 Shujing Zhao <pearly.zhao@oracle.com> * Make-lang.in (cp/cvt.o, cp/parser.o, cp/search.o): Depend on intl.h. * cvt.c (warn_ref_binding): Wrap the messages into G_() for easy translation. * parser.c (cp_parser_postfix_expression, cp_parser_new_type_id) (cp_parser_cast_expression, cp_parser_condition, cp_parser_decltype) (cp_parser_parameter_declaration) (cp_parser_exception_specification_opt) (cp_parser_exception_declaration): Likewise. * pt.c (check_default_tmpl_args): Likewise. * search.c (lookup_field_r): Likewise. From-SVN: r156645
2010-02-09re PR c++/42399 ([c++0x] assigning lambda causes segfault from null ↵Jason Merrill1-0/+2
dereference at libiberty/splay-tree.c:148) PR c++/42399 * pt.c (tsubst_copy_and_build): Propagate LAMBDA_EXPR_LOCATION. From-SVN: r156635
2010-01-29Fix PRs c++/42758, c++/42634, c++/42797Dodji Seketeli1-4/+66
... and mitigate PR c++/42336 gcc/cp/ChangeLog: PR c++/42758 PR c++/42634 PR c++/42336 PR c++/42797 PR c++/42880 * cp-tree.h (NON_DEFAULT_TEMPLATE_ARGS_COUNT, SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT, GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT): New accessor macros. * pt.c (coerce_template_parms, type_unification_real, expand_template_argument_pack, coerce_template_parameter_pack): Set the non default template args count. (current_template_args): Always set non defaulted template args count when compiled with --enable-checking (tsubst_template_args, type_unification_real): Propagate the non defaulted template args count. * error.c (get_non_default_template_args_count): Renamed count_non_default_template_args into this. Don't calculate the non default template argument count anymore. Use the new accessor macros above to get it. (dump_template_argument_list, dump_type, dump_decl, dump_template_parms): Adjust. * parser.c (cp_parser_template_argument_list): Always set defaulted template args count when compiled with --enable-checking. gcc/testsuite/ChangeLog: PR c++/42758 PR c++/42634 PR c++/42336 PR c++/42797 PR c++/42880 * g++.dg/other/crash-5.C: New test. * g++.dg/other/crash-6.C: New test. * g++.dg/other/crash-7.C: New test. * g++.dg/other/crash-8.C: New test. From-SVN: r156351
2010-01-28re PR c++/42713 (ICE - segfault in tsubst)Dodji Seketeli1-0/+2
Fix PR c++/42713 gcc/cp/ChangeLog: PR c++/42713 PR c++/42820 * typeck.c (get_template_parms_of_dependent_type): Factorized this out of incompatible_template_type_parms_p (incompatible_dependent_types_p): Renamed incompatible_template_type_parms_p into this. Make it detect two incompatible dependent typedefs too. (structural_comptypes): Use incompatible_dependent_types_p. * pt.c (get_template_info): Handle BOUND_TEMPLATE_TEMPLATE_PARAM. gcc/testsuite/ChangeLog: PR c++/42713 PR c++/42820 * g++.dg/template/typedef27.C: New test case. * g++.dg/template/typedef28.C: New test case. From-SVN: r156316
2010-01-17Revert PR c++/42697Dodji Seketeli1-2/+1
The commit is reverted as this was not a regression. It's rather going to be stagged for 4.6. From-SVN: r155976
2010-01-17re PR c++/42697 (ice-on-legal-code: template class template function local ↵Dodji Seketeli1-1/+2
objects) Fix PR c++/42697 gcc/cp/ChangeLog: PR c++/42697 *pt.c (tsubst_decl): Get the arguments of a specialization from the specialization template, not from the most general template. gcc/testsuite/ChangeLog: PR c++/42697 * g++.dg/template/crash94.C: New test. From-SVN: r155975
2010-01-07re PR c++/40155 ([c++0x] variadic template pack problem)Dodji Seketeli1-18/+7
Fix PR c++/40155 gcc/cp/ChangeLog: c++/40155 * pt.c (unify_pack_expansion): In non-deduced contexts, re-use template arguments that were previously deduced. gcc/testsuite/ChangeLog: c++/40155 * g++.dg/cpp0x/variadic-unify-2.C: New test. From-SVN: r155705
2010-01-05pt.c (unify_pack_expansion): Handle deduction from init-list.Jason Merrill1-0/+3
* pt.c (unify_pack_expansion): Handle deduction from init-list. * call.c (build_over_call): Don't complain about it. From-SVN: r155653
2010-01-04re PR c++/42555 (16-byte aligned double is disallowed only in templates)Jason Merrill1-1/+1
PR c++/42555 * pt.c (tsubst_decl): Don't apply type attributes in place. From-SVN: r155628
2009-12-28re PR c++/42447 (ICE during processing complex templates)Jason Merrill1-0/+7
PR c++/42447 * pt.c (iterative_hash_template_arg): Don't rely on TYPE_CANONICAL for ARRAY_TYPE. From-SVN: r155499
2009-12-22re PR c++/42466 (Multiple instantiations of template constructor fail)Jason Merrill1-1/+2
PR c++/42466 * pt.c (reduce_template_parm_level): Check the type before returning cached TEMPLATE_PARM_INDEX. From-SVN: r155411
2009-12-19Fix PR c++/42225, take 2Dodji Seketeli1-0/+3
gcc/cp/ChangeLog: PR c++/42225 * pt.c (push_template_decl_real): Set DECL_CONTEXT of template type parms to their containing template decl. * typeck.c (comp_template_parms_position): Split this from structural_comptypes. (incompatible_template_type_parms_p): Renamed incompatible_dependent_typedefs_p into this. Change the function to handle comparison between TEMPLATE_TYPE_PARMs only. (structural_comptypes): Use comp_template_parms_position in TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM cases. Use incompatible_template_type_parms_p in TEMPLATE_TYPE_PARM case. * mangle.c (decl_mangling_context): Template type parms don't have a mangling context. * tree.c (cp_set_underlying_type): Set type structural equality only for TEMPLATE_TYPE_PARMs. gcc/testsuite/ChangeLog: PR c++/42225 * g++.dg/template/typedef26.C: New test. From-SVN: r155363
2009-12-18re PR c++/28300 (In-class partial specialization of class accepted)Jason Merrill1-0/+6
PR c++/28300 PR c++/42062 * pt.c (check_specialization_namespace): Complain about specialization at non-namespace scope. From-SVN: r155349
2009-12-17re PR c/40885 (build_indirect_ref i18n problems)Shujing Zhao1-1/+1
2009-12-17 Shujing Zhao <pearly.zhao@oracle.com> PR c/40885 * c-common.h (ref_operator): New type. (build_indirect_ref): Adjust prototype with new argument. * c-typeck.c (build_indirect_ref): Accept ref_operator as argument and emit the diagnostics for easy translation. (build_array_ref): Update calls to build_indirect_ref. * c-omp.c (c_finish_omp_atomic): Likewise. * c-parser.c (c_parser_unary_expression, c_parser_postfix_expression_after_primary): Likewise. cp/ 2009-12-17 Shujing Zhao <pearly.zhao@oracle.com> * typeck.c (build_indirect_ref): Update the argument. (build_x_indirect_ref): Likewise. (cp_build_indirect_ref): Update the argument and emit the diagnostics for easy translation. (build_class_member_access_expr, build_array_ref, get_member_function_from_ptrfunc): Update calls. * cp-tree.h (build_x_indirect_ref, cp_build_indirect_ref): Update prototypes. * call.c (build_new_op, convert_like_real, build_x_va_arg, build_over_call): Update calls. * class.c (build_base_path, build_simple_base_path, build_vfn_ref): Likewise. * decl.c (start_preparsed_function): Likewise. * except.c (expand_start_catch_block, build_throw): Likewise. * init.c (emit_mem_initializers, expand_virtual_init, expand_virtual_init, build_new_1, build_vec_init, build_delete, build_vec_delete): Likewise. * parser.c (cp_parser_unary_expression): Likewise. * pt.c (tsubst_copy_and_build): Likewise. * rtti.c (build_headof, get_tinfo_decl_dynamic, get_typeid): Likewise. * semantics.c (finish_non_static_data_member, thisify_lambda_field): Likewise. * tree.c (build_dummy_object, stabilize_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. testsuite/ 2009-12-17 Shujing Zhao <pearly.zhao@oracle.com> * g++.old-deja/g++.mike/net31.C: Make expected dg-error strings explicit. * g++.old-deja/g++.bugs/900213_02.C: Likewise. * g++.old-deja/g++.bugs/900215_02.C: Likewise. From-SVN: r155302
2009-12-15re PR c++/42358 ([C++0x] Assembler failure on ↵Jason Merrill1-5/+5
libstdc++-v3/testsuite/23_containers/multimap/init-list.cc with -O0) PR c++/42358 * pt.c (iterative_hash_template_arg): Completely ignore ARGUMENT_PACK_SELECT. From-SVN: r155267
2009-12-14re PR c++/42364 (C++ testsuite fails with -g)Jason Merrill1-19/+21
PR c++/42364 * pt.c (function_parameter_expanded_from_pack_p): Don't require a pack to have a name. (tsubst_decl): Do typedef magic after applying attributes. From-SVN: r155246
2009-12-15[multiple changes]Paolo Bonzini1-23/+53
2009-12-15 Paolo Bonzini <bonzini@gnu.org> Shujing Zhao <pearly.zhao@oracle.com> * intl.c (get_spaces): New. * intl.h (get_spaces): New. cp: 2009-12-15 Paolo Bonzini <bonzini@gnu.org> Shujing Zhao <pearly.zhao@oracle.com> * Makefile.in (cp/pt.o): Depend on intl.h * call.c (print_z_candidates): Make loop more compact, choose head string depending on number of candidates, extract creation of spaces string to intl.c. * pt.c (print_overloaded_functions): Replace with... (print_candidates_1): ... this rewrite. (print_candidates): Rewrite to call print_candidates_1. (most_specialized_class): Make loop more compact, choose head string depending on number of candidates, and size indents depending on translations. testsuite: 2009-12-15 Shujing Zhao <pearly.zhao@oracle.com> * g++.dg/other/error20.C: Adjust dg-message strings. * g++.dg/other/error31.C: Likewise. * g++.dg/rtti/typeid6.C: Likewise. * g++.dg/ext/ms-1.C: Likewise. * g++.dg/parse/error19.C: Likewise. * g++.dg/parse/crash5.C: Likewise. * g++.dg/cpp0x/explicit4.C: Likewise. * g++.dg/template/ptrmem4.C: Likewise. * g++.dg/template/crash37.C: Likewise. * g++.dg/template/qualttp5.C: Likewise. * g++.dg/template/local6.C: Likewise. * g++.dg/template/instantiate5.C: Likewise. * g++.old-deja/g++.brendan/overload1.C: Likewise. * g++.old-deja/g++.brendan/cvt3.C: Likewise. * g++.old-deja/g++.brendan/overload4.C: Likewise. * g++.old-deja/g++.jason/conversion11.C: Likewise. * g++.old-deja/g++.jason/scoping10.C: Likewise. * g++.old-deja/g++.other/expr1.C: Likewise. * g++.old-deja/g++.other/pmf3.C: Likewise. * g++.old-deja/g++.other/crash24.C: Likewise. * g++.old-deja/g++.niklas/t120.C: Likewise. * g++.old-deja/g++.niklas/t121.C: Likewise. * g++.old-deja/g++.law/operators9.C: Likewise. * g++.old-deja/g++.law/arm9.C: Likewise. * g++.old-deja/g++.law/enum4.C: Likewise. * g++.old-deja/g++.law/arg11.C: Likewise. * g++.old-deja/g++.benjamin/15800-1.C: Likewise. * g++.old-deja/g++.mike/p2431.C: Likewise. * g++.old-deja/g++.mike/p438.C: Likewise. * g++.old-deja/g++.mike/p9068.C: Likewise. * g++.old-deja/g++.mike/p11110.C: Likewise. * g++.old-deja/g++.bugs/900330_02.C: Likewise. From-SVN: r155245