aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/friend.c
AgeCommit message (Collapse)AuthorFilesLines
2011-09-22re PR c++/50344 (friend declaration confused by const qualifier)Jonathan Wakely1-1/+3
/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-05-27re PR c++/47721 ([C++0x] Updated friendship rules?)Jason Merrill1-1/+8
PR c++/47721 * parser.c (cp_parser_member_declaration): Allow friend T. * friend.c (make_friend_class): Ignore non-classes. * pt.c (instantiate_class_template_1): Handle TEMPLATE_TYPE_PARM. From-SVN: r174319
2010-11-30diagnostic-core.h: Include bversion.h.Joseph Myers1-2/+1
* diagnostic-core.h: Include bversion.h. * toplev.h: Don't include input.h or bversion.h. (parse_optimize_options): Don't declare here. * alias.c, auto-inc-dec.c, c-aux-info.c, c-convert.c, c-parser.c, caller-save.c, cfg.c, cfganal.c, cfgbuild.c, cfgcleanup.c, combine-stack-adj.c, config/arm/pe.c, config/darwin-c.c, config/host-darwin.c, config/i386/host-cygwin.c, config/i386/host-mingw32.c, config/i386/msformat-c.c, config/i386/netware.c, config/i386/nwld.c, config/i386/winnt-cxx.c, config/i386/winnt-stubs.c, config/ia64/ia64-c.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/microblaze/microblaze-c.c, config/rs6000/host-darwin.c, config/rs6000/rs6000-c.c, config/score/score3.c, config/score/score7.c, config/sh/symbian-base.c, config/sh/symbian-c.c, config/sh/symbian-cxx.c, config/sol2-c.c, config/sol2.c, config/v850/v850-c.c, config/vxworks.c, convert.c, cppbuiltin.c, cselib.c, dbgcnt.c, ddg.c, dfp.c, dominance.c, emit-rtl.c, fixed-value.c, fwprop.c, ggc-common.c, gimple.c, gimplify.c, graphite-blocking.c, graphite-clast-to-gimple.c, graphite-dependences.c, graphite-flattening.c, graphite-interchange.c, graphite-poly.c, graphite-scop-detection.c, graphite.c, haifa-sched.c, implicit-zee.c, integrate.c, ipa-pure-const.c, ipa-reference.c, ira-build.c, ira-conflicts.c, ira-costs.c, ira-lives.c, jump.c, lists.c, loop-doloop.c, loop-iv.c, lto-cgraph.c, lto-compress.c, lto-opts.c, lto-section-in.c, lto-section-out.c, lto-streamer-out.c, lto-symtab.c, modulo-sched.c, optabs.c, params.c, postreload-gcse.c, postreload.c, predict.c, profile.c, regcprop.c, reginfo.c, regmove.c, reorg.c, resource.c, sched-deps.c, sched-ebb.c, sched-rgn.c, sdbout.c, sel-sched-dump.c, sel-sched-ir.c, sese.c, stmt.c, targhooks.c, tree-cfgcleanup.c, tree-mudflap.c, tree-nomudflap.c, tree-object-size.c, tree-outof-ssa.c, tree-phinodes.c, tree-profile.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-live.c, tree-ssa-loop-prefetch.c, tree-ssa-loop.c, tree-ssa-operands.c, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-vect-patterns.c, value-prof.c, var-tracking.c, web.c: Don't include toplev.h. * Makefile.in (TOPLEV_H): Remove. All uses changed to use toplev.h. Dependencies for above files and c-family files changed to remove $(TOPLEV_H) or toplev.h. (C_TREE_H): Don't include $(TOPLEV_H). (DIAGNOSTIC_CORE_H): Use $(INPUT_H) instead of input.h. Add bversion.h. * config/arm/t-pe, config/arm/t-wince-pe, config/i386/t-cygming, config/ia64/t-ia64, config/mep/t-mep, config/score/t-score-elf, config/t-darwin, config/t-sol2, config/t-vxworks, config/v850/t-v850, config/v850/t-v850e: Dependencies for above files changed to remove $(TOPLEV_H) or toplev.h. c-family: * c-common.h (parse_optimize_options): Declare. * c-cppbuiltin.c, c-format.c, c-gimplify.c, c-lex.c, c-omp.c, c-pch.c, c-pragma.c, c-semantics.c: Don't include toplev.h. cp: * cp-gimplify.c, cp-lang.c, cvt.c, cxx-pretty-print.c, error.c, except.c, expr.c, friend.c, init.c, mangle.c, name-lookup.c, optimize.c, parser.c, rtti.c, tree.c, typeck2.c: Don't include toplev.h. * Make-lang.in: Dependencies for above files changed to remove toplev.h. java: * expr.c, lang.c, mangle.c, mangle_name.c, typeck.c, verify-glue.c: Don't include toplev.h. * Make-lang.in: Dependencies for above files changed to remove toplev.h. lto: * Make-lang.in (lto/lto-object.o): Depend on toplev.h instead of $(TOPLEV_H). From-SVN: r167293
2010-05-25Makefile.in (EXCEPT_H): Fix typo.Steven Bosscher1-2/+0
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
2008-08-20diagnostic.c (inform): Add an explicit location_t parameter.Manuel López-Ibáñez1-1/+1
2008-08-18 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * diagnostic.c (inform): Add an explicit location_t parameter. * toplev.h (inform): Update declaration. * builtins.c: Update all calls to inform. * c-common.c: Likewise. * c-decl.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-pragma.c: Likewise. * c-typeck.c: Likewise. * coverage.c: Likewise. * opts.c: Likewise. * toplev.c: Likewise. * tree-cfg.c: Likewise. * tree-ssa.c: Likewise. cp/ * parser.c: Update all calls to inform. * typeck.c: Likewise. * init.c: Likewise. * class.c: Likewise. * call.c: Likewise. * method.c: Likewise. * friend.c: Likewise. * typeck2.c: Likewise. * pt.c: Likewise. * name-lookup.c: Likewise. * lex.c: Likewise. From-SVN: r139293
2008-08-08re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) ↵Manuel López-Ibáñez1-3/+5
should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-07-18cvt.c (convert_to_void): Avoid C++ keywords.Kaveh R. Ghazi1-4/+4
* cvt.c (convert_to_void): Avoid C++ keywords. * decl.c (walk_namespaces_r, wrapup_globals_for_namespace): Likewise. * friend.c (is_friend): Likewise. * init.c (perform_member_init): Likewise. * mangle.c (write_template_prefix, write_template_template_param): Likewise. * name-lookup.c (do_namespace_alias, do_using_directive, parse_using_directive, ambiguous_decl, arg_assoc): Likewise. * parser.c (cp_parser_template_id, cp_parser_namespace_definition, cp_parser_objc_typename, cp_parser_objc_method_keyword_params): Likewise. * pt.c (is_specialization_of_friend, lookup_template_class, push_tinst_level, instantiate_class_template, tsubst_copy_and_build): Likewise. * tree.c (add_stmt_to_compound): Likewise. * typeck.c (finish_class_member_access_expr): Likewise. From-SVN: r137959
2008-06-21typeck.c (composite_pointer_type_r, [...]): Change pedwarn to permerror.Jonathan Wakely1-1/+1
* typeck.c (composite_pointer_type_r, cxx_sizeof_expr, cxx_alignof_expr, check_template_keyword, cp_build_binary_op, pointer_diff, cp_build_unary_op, build_x_compound_expr_from_list, build_reinterpret_cast_1, cp_build_c_cast, check_return_expr): Change pedwarn to permerror. * init.c (perform_member_init, build_new_1, build_new): Likewise. * decl.c (warn_extern_redeclared_static, duplicate_decls, * identify_goto, check_previous_goto_1, check_goto, define_label, check_tag_decl, start_decl, check_class_member_definition_namespace, grokfndecl, grokdeclarator): Likewise. * except.c (check_handlers): Likewise. * typeck2.c (digest_init): Likewise. * pt.c (check_specialization_namespace, check_explicit_instantiation_namespace, maybe_process_partial_specialization, check_explicit_specialization, convert_template_argument, do_decl_instantiation, do_type_instantiation, instantiate_decl): Likewise. * semantics.c (finish_template_type_parm): Likewise. * name-lookup.c (pushdecl_maybe_friend, check_for_out_of_scope_variable): Likewise. * decl2.c (finish_static_data_member_decl, build_anon_union_vars, coerce_new_type): Likewise. * parser.c (cp_parser_nested_name_specifier_opt, cp_parser_mem_initializer, cp_parser_elaborated_type_specifier, cp_parser_class_head, cp_parser_check_class_key): Likewise. (cp_parser_parameter_declaration): Check flag_permissive instead of flag_pedantic_errors. * call.c (joust): Change pedwarn to warning. * friend.c (make_friend_class): Likewise. From-SVN: r136999
2008-03-21cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P.Paolo Carlini1-3/+3
2008-03-21 Paolo Carlini <pcarlini@suse.de> * cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. (SET_IS_AGGR_TYPE): Rename to SET_CLASS_TYPE_P. (IS_AGGR_TYPE_CODE): Rename to RECORD_OR_UNION_CODE_P. (PROMOTES_TO_AGGR_TYPE): Remove. (CLASS_TYPE_P, TYPE_NON_AGGREGATE_CLASS): Adjust. * typeck.c (unary_complex_lvalue, build_modify_expr, convert_for_initialization): Adjust. * init.c (is_aggr_type): Remove. (is_class_type): Add. (build_offset_ref, build_new_1, build_vec_delete_1, build_vec_init, build_delete): Adjust. * lex.c (make_aggr_type): Remove. (make_class_type): Add. (cxx_make_type): Adjust. * class.c (finish_struct_1, fixed_type_or_null, is_empty_class): Adjust. * decl.c (build_typename_type, make_typename_type, make_unbound_class_template, cxx_init_decl_processing, check_tag_decl, groktypename, start_decl_1, layout_var_decl, check_initializer, cp_finish_decl, build_ptrmemfunc_type, grokparms, grok_op_properties, xref_tag, check_function_type): Adjust. * call.c (check_dtor_name, standard_conversion, implicit_conversion, add_builtin_candidate, add_builtin_candidates, build_user_type_conversion_1, convert_like_real, build_cxx_call, is_subseq, compare_ics): Adjust. * method.c (use_thunk): Adjust. * rtti.c (build_dynamic_cast_1, create_pseudo_type_info, create_tinfo_types): Adjust. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, convert_from_reference, ocp_convert, build_expr_type_conversion): Adjust. * tree.c (bind_template_template_parm, error_type): Adjust. * dump.c (cp_dump_tree): Adjust. * search.c (lookup_member): Adjust. * friend.c (make_friend_class, do_friend): Adjust. * typeck2.c (store_init_value, process_init_constructor_array, process_init_constructor_record, build_x_arrow, build_m_component_ref, build_functional_cast): Adjust. * pt.c (finish_member_template_decl, process_template_parm, lookup_template_class, tsubst_function_type, tsubst, tsubst_copy_and_build, get_template_base, bt_instantiate_type_proc): Adjust. * semantics.c (begin_class_definition, finish_base_specifier, finish_typeof, cxx_omp_predetermined_sharing, finish_decltype_type): Adjust. * name-lookup.c (constructor_name_p, push_overloaded_decl, do_class_using_decl, lookup_qualified_name, maybe_process_template_type_declaration): Adjust. * decl2.c (grok_array_decl, check_member_template, constrain_class_visibility): Adjust. * parser.c (cp_parser_class_name): Adjust. From-SVN: r133434
2008-02-24re PR c++/34749 (Incorrect warning when applying dllimport to friend function)Danny Smith1-7/+7
cp PR c++/34749 * friend.c (do_friend): Call cplus_decl_attributes earlier. testsuite PR c++/34749 * g++.dg.ext/dllimport13.C: New test. From-SVN: r132585
2008-01-22re PR c++/34912 (ICE with friend in local class)Jason Merrill1-5/+19
PR c++/34912 * friend.c (do_friend): Check for prior declaration of a friend function of a local class. * name-lookup.c (lookup_name_innermost_nonclass_level): No longer static. * name-lookup.h: Declare it. From-SVN: r131740
2008-01-15re PR c++/34399 (ICE on invalid friend declaration of variadic template)Douglas Gregor1-1/+1
2008-01-15 Douglas Gregor <doug.gregor@gmail.com> PR c++/34399 * friend.c (do_friend): Don't query TYPE_BEING_DEFINED unless we know we have a class type. 2008-01-15 Douglas Gregor <doug.gregor@gmail.com> PR c++/34399 * g++.dg/cpp0x/vt-34399.C: New. * g++.dg/template/friend50.C: New. From-SVN: r131552
2007-08-02typeck.c: Change copyright header to refer to version 3 of the GNU General ↵Nick Clifton1-6/+5
Public... * typeck.c: Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page. * optimize.c, lang-specs.h, init.c, class.c, repo.c, decl.c, config-lang.in, cp-tree.def, call.c, decl.h, ptree.c, Make-lang.in, method.c, rtti.c, cp-objcp-common.c, g++spec.c, cp-objcp-common.h, except.c, error.c, operators.def, cvt.c, tree.c, mangle.c, cp-tree.h, dump.c, search.c, friend.c, expr.c, cp-gimplify.c, cxx-pretty-print.c, cp-lang.c, typeck2.c, pt.c, cxx-pretty-print.h, semantics.c, name-lookup.c, lex.c, decl2.c, name-lookup.h, parser.c: Likewise. From-SVN: r127154
2007-02-12friend.c (do_friend): Annotate warning about friend declarations in ↵Dirk Mueller1-6/+5
templates with... 2007-02-13 Dirk Mueller <dmueller@suse.de> * friend.c (do_friend): Annotate warning about friend declarations in templates with OPT_Wnon_template_friend. Convert informal message from warning() to inform(). From-SVN: r121867
2006-11-20re PR c++/29475 (incomplete template diagnostics.)Simon Martin1-1/+1
PR c++/29475 * cp-tree.h (enforce_access, perform_or_defer_access_check): Added an extra argument that represents the declaration to use to print potential error messages. * init.c (build_offset_ref): Adjusted the call to perform_or_defer_access_check. * class.c (alter_access, resolve_address_of_overloaded_function): Likewise. * decl.c (make_typename_type, make_unbound_class_template): Likewise. * search.c (lookup_member): Likewise. * friend.c (add_friend): Likewise. * parser.c (cp_parser_template_id, cp_parser_pre_parsed_nested_name_specifier): Likewise. * semantics.c (finish_non_static_data_member, check_accessibility_of_qualified_id, finish_id_expression): Likewise. (pop_to_parent_deferring_access_checks, perform_access_checks, perform_or_defer_access_check): Adjusted the call to enforce_access. * call.c (enforce_access): Use the new extra argument to build the error message. (build_op_delete_call): Adjusted the call to perform_or_defer_access_check. (build_over_call): Likewise. PR c++/29475 * g++.dg/template/access19.C: New test. * g++.old-deja/g++.other/access11.C: Adjusted the line where the error is reported. From-SVN: r119027
2006-10-04re PR c++/29020 (ICE using A<N>::A instead of A<N> in friend declaration)Mark Mitchell1-11/+9
PR c++/29020 * friend.c (do_friend): Improve comments; add assertion. * parser.c (cp_parser_nested_name_specifier_opt): Resolve typenames for qualified names used in declarations, even when caching qualified name lookup. PR c++/29020 * g++.dg/template/friend48.C: New test. From-SVN: r117425
2006-07-05re PR c++/18681 ([DR 45] template friend declaration not recognized)Jason Merrill1-13/+18
PR c++/18681 * friend.c (is_friend): Fix DR 45 implementation. From-SVN: r115208
2006-04-24re PR c++/26912 (friend const member function specialization fails to compile)Mark Mitchell1-7/+2
PR c++/26912 * cp-tree.h (build_this_parm): Declare. (grok_method_quals): Remove. (build_memfn_type): Declare. (build_artificial_parm): Declare. (do_friend): Remove quals parameter. * decl.c (build_this_parm): New function. (grokfndecl): Use it. Do not pass quals to grokclassfn. (grokdeclarator): Rename quals to memfn_quals. Avoid allocating unnecessary TYPE_DECLs. Correct qualification of member function types. Tidy. * method.c (implicitly_declare_fn): Use build_this_parm. * friend.c (do_friend): Remove quals parameter. * decl2.c (grok_method_quals): Remove. (build_memfn_type): New function. (build_artificial_parm): Give it external linkage. (grokclassfn): Remove quals parameter. Do not build "this" PARM_DECL here. PR c++/26912 * g++.dg/template/friend41.C: New test. From-SVN: r113213
2006-01-03re PR c++/25635 (Bogus cruft in error message for invalid operator declaration)Mark Mitchell1-1/+1
PR c++/25635 * class.c (add_method): Set TYPE_HAS_CONVERSION for classes with a conversion operator. * decl.c (grokdeclarator): Do not set TYPE_HAS_CONVERSION here. PR c++/25638 * class.c (add_method): Never associate more than one destructor with a single class. PR c++/25637 * cp-tree.h (do_friend): Adjust prototype. * decl.c (grokfndecl): Make funcdef_flag a bool, not an int. (grokdeclarator): Likewise. Refine check for invalid declarations/definitions of member functions outside of their own class. * friend.c (do_friend): Make funcdef_flag a bool, not an int. PR c++/25633 * parser.c (cp_parser_mem_initializer_list): Check result of cp_parser_mem_initializer against error_mark_node, not NULL_TREE. (cp_parser_mem_initializer): Return error_mark_node for failure. PR c++/25634 * parser.c (cp_parser_template_parameter_list): Call begin_template_parm_list and end_template_parm_list here. (cp_parser_type_parameter): Not here. (cp_parser_template_declaration_after_export): Or here. (cp_parser_elaborated_type_specifier): Call cp_parser_check_template_parameters. * tree.c (build_target_expr_with_type): Use force_target_expr. PR c++/25635 * g++.dg/parse/operator6.C: New test. PR c++/25637 * g++.dg/parse/error29.C: New test. PR c++/25638 * g++.dg/parse/dtor6.C: New test. PR c++/25633 * g++.dg/parse/ctor3.C: New test. PR c++/25634 * g++.dg/template/class3.C: New test. From-SVN: r109270
2005-09-12re PR c++/7874 (g++ finds friend functions defined in class-definition but ↵Ian Lance Taylor1-4/+4
not declared in the enclosing namespace) ./ PR g++/7874 * c.opt (ffriend-injection): New C++ option. * doc/invoke.texi (Option Summary): Mention -ffriend-injection. (C++ Dialect Options): Document -ffriend-injection. cp/ PR g++/7874 * cp-tree.h (struct lang_decl_flags): Add hidden_friend_p bitfield. Make dummy bitfield one bit smaller. (DECL_HIDDEN_FRIEND_P): Define. (pushdecl_maybe_friend): Declare. (pushdecl_top_level_maybe_friend): Declare. * decl.c (duplicate_decls): Add newdecl_is_friend parameter. Change prototype and all callers. Add assertion that a DECL_ARTIFICIAL FUNCTION_DECL is not DECL_HIDDEN_FRIEND_P. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P in duplicated decl if appropriate. * name-lookup.c (supplement_binding): Don't ignore a DECL_HIDDEN_FRIEND_P. (pushdecl_maybe_friend): Break out contents of pushdecl. Add is_friend parameter. Set DECL_ANTICIPATED and DECL_HIDDEN_FRIEND_P for a friend function. (pushdecl): Just call pushdecl_maybe_friend. (pushdecl_with_scope): Add is_friend parameter. Change prototype and all callers. (pushdecl_namespace_level): Likewise. (push_overloaded_decl): Likewise. Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Check DECL_HIDDEN_FRIEND_P as well as DECL_ANTICIPATED when checking for a builtin. (do_nonmember_using_decl): Likewise. (pushdecl_top_level_1): Add is_friend parameter. Change all callers. (pushdecl_top_level_maybe_friend): New function. (remove_hidden_names): New function. (struct arg_lookup): Add args field. (friend_of_associated_class_p): New static function. (arg_assoc_namespace): Ignore hidden functions which are not friends of an associated class of some argument. (lookup_arg_dependent): Remove hidden functions from list passed in. Initialize k.args. * name-lookup.h (remove_hidden_names): Declare. * friend.c (do_friend): Call pushdecl_maybe_friend instead of pushdecl. * call.c (add_function_candidate): Change DECL_ANTICIPATED test to an assertion, with a check for DECL_HIDDEN_FRIEND_P. (build_new_function_call): Add koenig_p parameter. Change prototype and callers. * pt.c (register_specialization): Add is_friend parameter. Change all callers. (push_template_decl_real): Change is_friend parameter to bool. Change prototype and all callers. (tsubst_friend_class): Call pushdecl_top_level_maybe_friend instead of pushdecl_top_level. testsuite/ PR g++/7874 * g++.dg/lookup/friend7.C: New test. * g++.dg/lookup/friend8.C: New test. * g++.dg/parse/defarg4.C: Add a parameter to the friend function, so that it will be found via argument dependent lookup. * g++.old-deja/g++.brendan/crash56.C: Don't expect errors for friend functions which will no longer be found. * g++.old-deja/g++.jason/friend.C: Add a parameter to the friend function g, so that it will be found via argument dependent lookup. * g++.old-deja/g++.jason/scoping15.C: Use -ffriend-injection. * g++.old-deja/g++.mike/net43.C: Likewise. From-SVN: r104188
2005-07-02toplev.c (default_tree_printer): Handle setting location with '+' flag.Joseph Myers1-2/+2
2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
2005-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101312
2005-06-15Canonicalize whitespace.Mike Stump1-7/+7
From-SVN: r100965
2005-06-14Remove extra white spacing at end of lines.Mike Stump1-16/+16
From-SVN: r100952
2005-05-03* friend.c, lex.c, mangle.c, repo.c: Update copyright.Kazu Hirata1-1/+1
From-SVN: r99171
2005-04-23diagnostic.c (warning): Accept parameter to classify warning option.DJ Delorie1-5/+5
* diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2004-11-29re PR c++/18368 (C++ error message regression)Mark Mitchell1-1/+1
PR c++/18368 * parser.c (cp_parser_check_for_definition_in_return_type): Take the defined type as a parameter, and inform the user about the possibility of a missing semicolon. (cp_parser_explicit_instantiation): Adjust call to cp_parser_check_for_definition_in_return_type. (cp_parser_init_declarator): Likewise. (cp_parser_member_declaration): Likewise. PR c++/18674 * cp-tree.def (TYPENAME_TYPE): Remove discussion of implicit typename from comments. * cp-tree.h (TYPENAME_IS_ENUM_P): New macro. (TYPENAME_IS_CLASS_P): Likewise. (make_typename_type): Change prototype. * decl.c (struct_typename_info): New type. (typename_compare): Expect the second argument to be a typename_info, not a tree. (build_typename_type): Add tag_type parameter. Do not create a new type until necessary. (make_typename_type): Add tag_type parameter. * error.c (TYPENAME_TYPE): Print tags other than "typename" if appropriate. * friend.c (make_friend_class): Adjust call to make_typename_type. * parser.c (cp_parser_make_typename_type): Likewise. (cp_parser_primary_expression): Adjust call to cp_parser_lookup_name. (cp_parser_unqualified_id): Adjust calls to cp_parser_class_name. (cp_parser_class_or_namespace_name): Likewise. (cp_parser_postfix_expression): Adjust calls to make_typename_type. (cp_parser_mem_initializer_id): Adjust calls to cp_parser_class_name. (cp_parser_type_parameter): Adjust calls to cp_parser_lookup_name. (cp_parser_template_name): Likewise. (cp_parser_template_argument): Likewise. (cp_parser_type_name): Adjust call to cp_parser_class_name. (cp_parser_elaborated_type_specifier): Adjust calls to make_typename_type and cp_parser_lookup_name. (cp_parser_namespace_name): Likewise. (cp_parser_class_name): Replace type_p parameter with tag_type. Adjust calls to make_typename_type and cp_parser_lookup_name. (cp_parser_class_head): Adjust calls to cp_parser_class_name. (cp_parser_base_specifier): Likewise. (cp_parser_lookup_name): Replace is_type parameter with tag_type. Adjust calls to make_typename_type and lookup_qualified_name. (cp_parser_lookup_name_simple): Adjust call to cp_parser_lookup_name. (cp_parser_constructor_declarator_p): Adjust call to cp_parser_class_name. * pt.c (convert_template_argument): Adjust all to make_typename_type. (tsubst_decl): Do not pre-substitute the type of the declaration. (tsubst): Hand off declarations more quickly. Adjust call to make_typename_type. PR c++/18512 * parser.c (cp_parser_postfix_dot_deref_expression): Robustify. PR c++/18674 * g++.old-deja/g++.brendan/crash16.C: Adjust error messages. * g++.old-deja/g++.law/ctors5.C: Likewise. * g++.old-deja/g++.other/crash25.C: Likewise. PR c++/18674 * g++.dg/template/error16.C: New test. PR c++/18512 * g++.dg/template/crash29.C: New test. From-SVN: r91483
2004-10-20re PR c++/13495 (Friendship to class nested within a template is broken)Kriang Lerdsuwanakij1-14/+99
PR c++/13495 * decl.c (make_unbound_class_template): Add PARM_LIST parameter. * cp-tree.h (make_unbound_class_template): Adjust prototype. * parser.c (cp_parser_lookup_name): Adjust call to make_unbound_class_template. (cp_parser_single_declaration): Handle member class of class template as template friend parsing correctly. * friend.c (is_friend): Call is_specialization_of_friend for template friend class. (make_friend_class): Handle member class of class template as template friend. * pt.c (is_specialization_of_friend): Likewise. (instantiate_class_template): Likewise. (tsubst): Adjust call to make_unbound_class_template. * g++.dg/template/memfriend9.C: New test. * g++.dg/template/memfriend10.C: Likewise. * g++.dg/template/memfriend11.C: Likewise. * g++.dg/template/memfriend12.C: Likewise. * g++.dg/template/memfriend13.C: Likewise. * g++.dg/template/memfriend14.C: Likewise. * g++.dg/template/memfriend15.C: Likewise. * g++.dg/template/memfriend16.C: Likewise. * g++.dg/template/memfriend17.C: Likewise. * g++.old-deja/g++.pt/friend44.C: Remove bogus error. From-SVN: r89335
2004-10-04Convert diagnostics to use quoting flag q 4/nGabriel Dos Reis1-14/+16
Convert diagnostics to use quoting flag q 4/n * except.c (decl_is_java_type, build_throw, is_admissible_throw_operand, check_handlers_1, check_handlers): Use quoting formats. * friend.c (add_friend, make_friend_class, do_friend): Likewise. * init.c (sort_mem_initializers, emit_mem_initializers, member_init_ok_or_else, expand_member_init, is_aggr_type, build_offset_ref, build_java_class_ref): Likewise. From-SVN: r88511
2004-08-30call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable.Nathan Sidwell1-2/+1
* call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. From-SVN: r86778
2004-06-28friend.c (add_friend): Only perform access checks when context is a class.Nathan Sidwell1-6/+4
* friend.c (add_friend): Only perform access checks when context is a class. * lex.c (cxx_make_type): Only create a binfo for aggregate types. * parser.c (cp_parser_class_specifier): Disable access checks here when parsing the body of a templated class. * semantics.c (perform_or_defer_access_checks): Reorder to allow NULL binfos when not checking access. From-SVN: r83771
2004-06-27cp-tree.h (cp_cv_quals): New type.Mark Mitchell1-1/+2
* cp-tree.h (cp_cv_quals): New type. (cp_declarator): Use it instead of "tree" as appropriate. (grok_method_quals): Adjust prototype. (grokclassfn): Likewise. (do_friend): Likewise. * decl.c (grokfndecl): Use cp_cv_quals, not tree. (grokdeclarator): Likewise. * decl2.c (grok_method_quals): Likewise. (grokclassfn): Likewise. * friend.c (do_friend): Likewise. * method.c (implicitly_declare_fn): Adjust call to grokclassfn. * parser.c (make_call_declarator): Use cp_cv_quals, not tree. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (cp_parser_ptr_operator): Likewise. (cp_parser_cv_qualifier_seq_opt): Likewise. (cp_parser_cv_qualifier_opt): Remove. (cp_parser_new_declarator_opt): Adjust call to cp_parser_ptr_operator. (cp_parser_conversion_declaration_opt): Likewise. (cp_parser_declarator): Use cp_cv_quals, not tree. (cp_parser_direct_declarator): Likewise. From-SVN: r83729
2004-05-31re PR c++/15701 (ICE with friends and template template parameter)Mark Mitchell1-1/+5
PR c++/15701 * friend.c (add_friend): Do not try to perform access checks for functions from dependent classes. PR c++/15701 * g++.dg/template/friend29.C: New test. From-SVN: r82516
2004-05-03re PR c++/14389 (Out-of-line of overloaded template rejected)Giovanni Bajo1-1/+4
PR c++/14389 * decl2.c (check_classfn): For member templates, compare also the template parameters to match the declaration. * cp-tree.h: Adjust declaration of check_classfn. * decl.c (start_decl, grokfndecl): Adjust callers of check_classfn. * friend.c (do_friend): Likewise. * pt.c (tsubst_friend_function): Likewise. PR c++/14389 * g++.dg/template/member5.C: New test. From-SVN: r81426
2004-03-24dwarf2asm.c, [...]: Update copyright.Kazu Hirata1-1/+1
gcc/ * dwarf2asm.c, loop.h, pretty-print.c, pretty-print.h, config/i386/mmintrin.h: Update copyright. cp/ * cxx-pretty-print.c, cxx-pretty-print.h, decl.h, friend.c: Update copyright. From-SVN: r79938
2004-03-20call.c (build_op_delete_call): Do not forget the placement arguments when ↵Mark Mitchell1-6/+1
iterating through mutiple delete... * call.c (build_op_delete_call): Do not forget the placement arguments when iterating through mutiple delete operators. * cp-tree.h (svaed_scope): Remove last_parms. (NEW_DELETE_OPNAME_P): New macro. (last_function_parms): Remove. (do_friend): Adjust prototype. * decl.c (grokparms): Return the PARM_DECLs directly, rather than using last_function_parms. (grokfndecl): Take the PARM_DECLs as an argument, rather than using last_function_parms. (grokdeclarator): Adjust accordingly. Do not form METHOD_TYPEs for class-specific operator new and operator delete. (grok_op_properties): Do not look for allocation functions with METHOD_TYPEs. (start_function): Use DECL_ARGUMENTS instead of last_function_parms. * decl.h (last_function_parms): Do not declare. * decl2.c (grokclassfn): Do not use last_function_parms. * friend.c (do_friend): Remove parmdecls parameter. * name-lookup.c (push_to_top_level): Do not save last_function_parms. (pop_from_top_level): Do not restore it. * pt.c (check_explicit_specialization): Do not adjust last_function_parms. * name-lookup.c (do_local_using_decl): Create a local binding for types brought in via using declarations. * name-lookup.c (lookup_arg_dependent): Handle block-scope function declarations correctly. * semantics.c (finish_id_expression): Correct handling of conversion operators to dependent types. * typeck.c (lookup_destructor): Allow the use of destructors from base classes. * g++.dg/init/placement3.C: New test. * g++.dg/template/spec13.C: New test. * g++.dg/lookup/using11.C: New test. * g++.dg/lookup/koenig3.C: New test. * g++.dg/template/operator2.C: New test. * g++.dg/expr/dtor3.C: New test. * g++.old-deja/g++.brendan/crash15.C: Remove incorrect dg-error marker. * g++.old-deja/g++.law/visibility28.C: Likewise. From-SVN: r79722
2003-12-19cvt.c: Remove uses of "register" specifier in declarations of arguments and ↵Kazu Hirata1-1/+1
local... * cvt.c: Remove uses of "register" specifier in declarations of arguments and local variables. * decl.c: Likewise. * decl2.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * lex.c: Likewise. * name-lookup.c: Likewise. * repo.c: Likewise. * search.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. From-SVN: r74855
2003-11-22re PR c++/5369 (template member friend declaration not honored)Kriang Lerdsuwanakij1-34/+55
PR c++/5369 * friend.c (is_friend): Handle member function of a class template as template friend. (do_friend): Likewise. * decl2.c (check_classfn): Add template_header_p parameter. * decl.c (start_decl): Adjust check_classfn call. (grokfndecl): Likewise. * pt.c (is_specialization_of_friend): New function. (uses_template_parms_level): Likewise. (push_template_decl_real): Use uses_template_parms_level. (tsubst_friend_function): Adjust check_classfn call. * cp-tree.h (check_classfn): Adjust declaration. (uses_template_parms_level): Add declaration. (is_specialization_of_friend): Likewise. * g++.dg/template/memfriend1.C: New test. * g++.dg/template/memfriend2.C: Likewise. * g++.dg/template/memfriend3.C: Likewise. * g++.dg/template/memfriend4.C: Likewise. * g++.dg/template/memfriend5.C: Likewise. * g++.dg/template/memfriend6.C: Likewise. * g++.dg/template/memfriend7.C: Likewise. * g++.dg/template/memfriend8.C: Likewise. * g++.old-deja/g++.pt/friend44.C: Remove a bogus error. From-SVN: r73833
2003-11-12re PR c++/12735 (duplicate error messages for redeclaration errors)Mark Mitchell1-0/+3
PR c++/12735 * cp-tree.h (duplicate_decls): Return a tree. * decl.c (duplicate_decls): Clarify documentation. Return error_mark_node to indicate a failed redeclaration. * friend.c (do_friend): Handle that case. * name-lookup.c (pushdecl): Likewise. From-SVN: r73503
2003-11-05re PR c++/2019 (Wrong line number warning listing the previous declaration ↵Kriang Lerdsuwanakij1-6/+2
of a befriended function) PR c++/2019 * friend.c (add_friend): Don't display previous declaration in case of duplicate friend warning. From-SVN: r73268
2003-08-23PR c++/641, c++/11876Kriang Lerdsuwanakij1-17/+32
PR c++/641, c++/11876 * friend.c (add_friend): Add complain parameter. (make_friend_class): Likewise. (do_friend): Adjust add_friend call. * decl.c (grokdeclarator): Adjust make_friend_class call. * parser.c (cp_parser_member_declaration): Likewise. (cp_parser_template_declaration_after_exp): Likewise. * pt.c (instantiate_class_template): Adjust make_friend_class and add_friend call. * cp-tree.h (make_friend_class): Adjust declaration. (add_friend): Likewise. * g++.dg/template/friend22.C: New test. * g++.dg/template/friend23.C: Likewise. From-SVN: r70732
2003-07-17re PR c++/7809 (befriending inaccessible names)Kriang Lerdsuwanakij1-0/+3
PR c++/7809 * friend.c (add_friend): Check access for member functions and templates. * g++.dg/parse/access3.C: New test. From-SVN: r69513
2003-07-16re PR c++/5421 (friends+templates: ICE: expected identifier_node, have ↵Kriang Lerdsuwanakij1-0/+2
template_id_expr in grokfndecl, at cp/decl.c:8835) PR c++/5421 * decl.c (grokdeclarator): Handle TEMPLATE_ID_EXPR if friend is a member of other class. * friend.c (do_friend): Don't build TEMPLATE_DECL if friend is a specialization of function template. * g++.dg/template/friend21.C: New test. From-SVN: r69457
2003-07-16cp-tree.def (LOOKUP_EXPR): Remove.Mark Mitchell1-2/+0
* cp-tree.def (LOOKUP_EXPR): Remove. * cp-tree.h (cp_id_kind): Add CP_ID_KIND_UNQUALIFIED_DEPENDENT. (LOOKUP_EXPR_GLOBAL): Remove. (get_bindings): Remove. (is_aggr_type_2): Remove. * call.c (resolved_scoped_fn_name): Remove support for LOOKUP_EXPR. * decl.c (grokfndecl): Likewise. (grokdeclarator): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Likewise. * friend.c (do_friend): Likewise. * init.c (build_offset_ref): Likewise. * lex.c (unqualified_fn_lookup_error): Use pedwarn. Do not create LOOKUP_EXPRs * mangle.c (write_expression): Remove support for LOOKUP_EXPR. * parser.c (cp_parser_postfix_expression): Modify Koenig lookup test. * pt.c (get_bindings): Give it internal linkage. (check_explicit_specialization): Remove support for LOOKUP_EXPR. (lookup_template_function): Likewise. (for_each_tempalte_parm_r): Likewise. (tsubst_decl): Likewise. (tsubst_qualified_id): Handle template template parameters. (tsubst_copy): Remove support for LOOKUP_EXPR. (tsubst_copy_and_build): Likewise. (most_general_template): Likewise. (value_dependent_expression_p): Likewise. (type_dependent_expression_p): Note that IDENTIFIER_NODEs are always dependent. * semantics.c (perform_koenig_lookup): Do not create IDENTIFIER_NODEs. (finish_fname): Likewise. (finish_id_expression): Likewise. * tree.c (is_aggr_type_2): Remove. From-SVN: r69427
2003-07-07* friend.c: Convert to ISO C90 prototypes.Andreas Jaeger1-12/+6
From-SVN: r69052
2003-07-03re PR c++/9162 ([New parser] Problem with default argument in a friend function)Nathan Sidwell1-4/+1
cp: PR c++/9162 * decl.c (grokdeclarator): Return friend decls, not void_type_node. * decl2.c (grokfield): Alter friend decl check. * parser.c (struct cp_parser): Document default_arg chain on unparsed_functions_queue. (cp_parser_save_default_args): New. (cp_parser_init_declarator, cp_parser_function_definition, cp_parser_member_declaration): Call it. (cp_parser_class_specifier): Remove unused variable. Alter processing of unparsed_functions_queue. testsuite: PR c++/9162 * g++.dg/parse/defarg4.C: New. From-SVN: r68886
2003-06-24call.c (enforce_access): Assert we get a binfo.Nathan Sidwell1-11/+28
* call.c (enforce_access): Assert we get a binfo. (build_op_delete_call): Pass a binfo to perform_or_defer_access_check. * class.c (alter_access): Likewise. * decl.c (make_typename_type): Likewise. (make_unbound_class_template): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parser.c (cp_parser_lookup_name): Likewise. * search.c (lookup_member): Likewise. Move IDENTIFIER_CLASS_VALUE test. * semantics.c (finish_non_static_data_member): Likewise. (perform_or_defer_access_check): Expect a binfo. * typeck.c (comptypes): Expect types. * mangle.c (find_substitution): Don't pass a non-type to same_type_p * friend.c (make_friend_class): Likewise. * pt.c (check_default_tmpl_args): Likewise. (lookup_template_class): Likewise. From-SVN: r68424
2003-03-11re PR c++/8700 (unhelpful error message for binding temp to reference)Mark Mitchell1-2/+2
PR c++/8700 * call.c (convert_class_to_reference): Adjust usage of splice_viable. (any_viable): Remove. (splice_viable): Combine with any_viable. (print_z_candidates): Avoid printing duplicates. (build_user_type_conversion_1): Adjust usage of splice_viable. (build_new_function_call): Likewise. (build_operator_new_call): Likewise. (build_object_call): Likewise. (build_conditional_expr): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. (joust): Remove spurious comment. * cp-tree.h (DECL_FRIENDLIST): Correct documentation. * decl2.c (arg_assoc_class): Simplify. * friend.c (add_friend): Likewise. From-SVN: r64173
2003-01-02except.c, [...]: Fix Copyright years.Steven Bosscher1-1/+2
2003-01-02 Steven Bosscher <s.bosscher@student.tudelft.nl> * cp/except.c, cp/expr.c, cp/friend.c, cp/g++spec.c, cp/lang-options.h, cp/lang-specs.h, cp/lex.h, cp/ptree.c, cp/repo.c, java/jcf-reader.c, java/jvgenmain.c, java/keyword.gperf, java/lang-options.h, java/mangle.c, java/mangle_name.c, java/xref.c, java/zextract.c,java/zipfile.h, objc/Make-lang.in, objc/config-lang.in, objc/lang-specs.h, objc/objc-act.h: Fix Copyright years. From-SVN: r60783
2003-01-01call.c, [...]: Replace "GNU CC" with "GCC" in the copyright header.Steven Bosscher1-4/+4
* call.c, class.c, cp-lang.c, cp-tree.h, cvt.c, dump.c, error.c, except.c, expr.c friend.c, g++spec.c, init.c, lang-options.h, lang-specs.h, lex.c, mangle.c, method.c, optimize.c, parser.c, pt.c, ptree.c, repo.c, rtti.c, search.c, semantics.c, tree.c, typeck.c, typeck2.c: Replace "GNU CC" with "GCC" in the copyright header. * lex.h: parse.y is dead, so don't mention it. Also replace the copyright header with the default GNU copyright header. From-SVN: r60738