Commit Graph

1001 Commits

Author SHA1 Message Date
Jason Merrill 4ad610c978 re PR c++/37208 (C++0x deleted functions and SFINAE)
PR c++/37208
        * call.c (build_over_call): Make =delete work with SFINAE.
        * class.c (resolve_address_of_overloaded_function): Likewise.

        * cp-tree.h (struct lang_decl_flags): Rename threadprivate_p to
        threadprivate_or_deleted_p.
        (CP_DECL_THREADPRIVATE_P): Adjust.
        (DECL_DELETED_FN): Likewise.
        (SD_UNINITIALIZED, SD_INITIALIZED, SD_DEFAULTED): New macros.
        (SD_DELETED): New macro.
        * parser.c (cp_parser_init_declarator): Use them.
        * decl.c (start_decl): Use them.

        * decl2.c (mark_used): Give =deleted error even in sizeof.

        * typeck2.c (check_narrowing): Downgrade narrowing error to
        permerror.

From-SVN: r139926
2008-09-03 00:10:27 -04:00
Aldy Hernandez a63068b6dd diagnostic.c (error_at): New.
* diagnostic.c (error_at): New.
        * toplev.h (error_at): New prototype.
        * c-typeck.c (build_array_ref): Call error_at instead of error.
        Pass location to pedwarn.
cp/
        * typeck.c (build_array_ref): Use new location argument.
        * class.c (build_vtbl_ref_1): Pass location to build_array_ref.
        * call.c (build_new_op): Same.
        * decl2.c (grok_array_decl): Same.
        * cp-tree.h (build_array_ref): Add location argument to prototype.

From-SVN: r139924
2008-09-03 01:00:04 +00:00
Manuel López-Ibáñez cbe5f3b371 diagnostics.c (permerror_at): Rename as permerror.
2008-08-18  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	* diagnostics.c (permerror_at): Rename as permerror.
	(permerror): Delete.
	* toplev.h: Likewise.
cp/	
	* typeck.c: Update all callers.
	* init.c: Likewise.
	* class.c: Likewise.
	* decl.c: Likewise.
	* call.c: Likewise.
	* except.c: Likewise.
	* cvt.c: Likewise.
	* typeck2.c: Likewise.
	* pt.c: Likewise.
	* semantics.c: Likewise.
	* name-lookup.c: Likewise.
	* lex.c: Likewise.
	* decl2.c: Likewise.
	* parser.c: Likewise.

From-SVN: r139193
2008-08-18 11:17:52 +00:00
Dodji Seketeli e44c800e35 re PR c++/36767 (Segmentation fault with -fprofile-arcs -O2)
2008-07-30  Dodji Seketeli  <dseketel@redhat.com>

	PR c++/36767
	* decl2.c (fix_temporary_vars_context_r): New function.
	 (one_static_initialization_or_destruction): Make sure temporary
	 variables part of the initialiser have their DECL_CONTEXT()
	 properly set.

From-SVN: r138308
2008-07-30 15:07:50 +02:00
Jan Hubicka 9935551810 optimize.c (maybe_clone_body): Remove DECL_INLINE.
* optimize.c (maybe_clone_body): Remove DECL_INLINE.
	* decl.c (duplicate_decls): Likewise.
	(grokfndecl): Likewise.
	(start_method): Likewise.
	* method.c (make_thunk, make_alias_for, implicitly_declare_fn):
	Likewise.
	* pt.c (register_specialization, regenerate_decl_from_template):
	Likewise.
	* decl2.c (grokfield): Likewise.

From-SVN: r138236
2008-07-29 10:49:30 +00:00
Richard Biener 726a989a8b backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch.
2008-07-28  Richard Guenther  <rguenther@suse.de>

	Merge from gimple-tuples-branch.

	* ChangeLog.tuples: ChangeLog from gimple-tuples-branch.
	* gimple.def: New file.
	* gsstruct.def: Likewise.
	* gimple-iterator.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* tree-gimple.c: Removed.  Merged into ...
	* gimple.c: ... here.  New file.
	* tree-gimple.h: Removed.  Merged into ...
	* gimple.h: ... here.  New file.

	* Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h.
	* configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the
	--enable-checking=gimple flag.
	* config.in: Likewise.
	* configure: Regenerated.

	* tree-ssa-operands.h: Tuplified.
	* tree-vrp.c: Likewise.
	* tree-loop-linear.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-complex.c: Likewise.
	* cgraphbuild.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tracer.c: Likewise.
	* gengtype.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-ssa-loop-unswitch.c: Likewise.
	* cgraph.c: Likewise.
	* cgraph.h: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* value-prof.c: Likewise.
	* tree-ssa-loop-ch.c: Likewise.
	* tree-tailcall.c: Likewise.
	* value-prof.h: Likewise.
	* tree.c: Likewise.
	* tree.h: Likewise.
	* tree-pass.h: Likewise.
	* ipa-cp.c: Likewise.
	* tree-scalar-evolution.c: Likewise.
	* tree-scalar-evolution.h: Likewise.
	* target.h: Likewise.
	* lambda-mat.c: Likewise.
	* tree-phinodes.c: Likewise.
	* diagnostic.h: Likewise.
	* builtins.c: Likewise.
	* tree-ssa-alias-warnings.c: Likewise.
	* cfghooks.c: Likewise.
	* fold-const.c: Likewise.
	* cfghooks.h: Likewise.
	* omp-low.c: Likewise.
	* tree-ssa-dse.c: Likewise.
	* ipa-reference.c: Likewise.
	* tree-ssa-uncprop.c: Likewise.
	* toplev.c: Likewise.
	* tree-gimple.c: Likewise.
	* tree-gimple.h: Likewise.
	* tree-chrec.c: Likewise.
	* tree-chrec.h: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-sccvn.h: Likewise.
	* cgraphunit.c: Likewise.
	* tree-ssa-copyrename.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-nomudflap.c: Likewise.
	* tree-call-cdce.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* c-format.c: Likewise.
	* tree-stdarg.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-dom.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* ipa-utils.c: Likewise.
	* tree-ssa-propagate.h: Likewise.
	* tree-ssa-alias.c: Likewise.
	* gimple-low.c: Likewise.
	* tree-ssa-sink.c: Likewise.
	* ipa-inline.c: Likewise.
	* c-semantics.c: Likewise.
	* dwarf2out.c: Likewise.
	* expr.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* predict.c: Likewise.
	* tree-ssa-loop.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-ssa-address.c: Likewise.
	* tree-ssa-ifcombine.c: Likewise.
	* matrix-reorg.c: Likewise.
	* c-decl.c: Likewise.
	* tree-eh.c: Likewise.
	* c-pretty-print.c: Likewise.
	* lambda-trans.c: Likewise.
	* function.c: Likewise.
	* langhooks.c: Likewise.
	* ebitmap.h: Likewise.
	* tree-vectorizer.c: Likewise.
	* function.h: Likewise.
	* langhooks.h: Likewise.
	* tree-vectorizer.h: Likewise.
	* ipa-type-escape.c: Likewise.
	* ipa-type-escape.h: Likewise.
	* domwalk.c: Likewise.
	* tree-if-conv.c: Likewise.
	* profile.c: Likewise.
	* domwalk.h: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-data-ref.h: Likewise.
	* tree-flow-inline.h: Likewise.
	* tree-affine.c: Likewise.
	* tree-vect-analyze.c: Likewise.
	* c-typeck.c: Likewise.
	* gimplify.c: Likewise.
	* coretypes.h: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* calls.c: Likewise.
	* tree-ssa-coalesce.c: Likewise.
	* tree.def: Likewise.
	* tree-dfa.c: Likewise.
	* except.c: Likewise.
	* except.h: Likewise.
	* cfgexpand.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-ssa-pre.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-live.h: Likewise.
	* tree-predcom.c: Likewise.
	* lambda.h: Likewise.
	* tree-mudflap.c: Likewise.
	* ipa-prop.c: Likewise.
	* print-tree.c: Likewise.
	* tree-ssa-copy.c: Likewise.
	* ipa-prop.h: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* ggc-page.c: Likewise.
	* c-omp.c: Likewise.
	* tree-ssa-dce.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-ssa-ter.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-ssa.c: Likewise.
	* lambda-code.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-inline.h: Likewise.
	* tree-iterator.c: Likewise.
	* tree-optimize.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-vect-transform.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* cfgloop.c: Likewise.
	* system.h: Likewise.
	* tree-profile.c: Likewise.
	* cfgloop.h: Likewise.
	* c-gimplify.c: Likewise.
	* c-common.c: Likewise.
	* tree-vect-generic.c: Likewise.
	* tree-flow.h: Likewise.
	* c-common.h: Likewise.
	* basic-block.h: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* tree-ssa-structalias.h: Likewise.
	* tree-cfg.c: Likewise.
	* passes.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa-struct-reorg.h: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* cfgrtl.c: Likewise.
	* varpool.c: Likewise.
	* stmt.c: Likewise.
	* tree-ssanames.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* langhooks-def.h: Likewise.
	* tree-ssa-operands.c: Likewise.
	* config/alpha/alpha.c: Likewise.
	* config/frv/frv.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/m32c/m32c.c: Likewise.
	* config/m32c/m32c-protos.h: Likewise.
	* config/spu/spu.c: Likewise.
	* config/sparc/sparc.c: Likewise.
	* config/i386/i386.c: Likewise.
	* config/sh/sh.c: Likewise.
	* config/xtensa/xtensa.c: Likewise.
	* config/stormy16/stormy16.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/pa/pa.c: Likewise.
	* config/mips/mips.c: Likewise.

From-SVN: r138207
2008-07-28 14:33:56 +00:00
Jan Hubicka 4847609e48 typeck.c (inline_conversion): Remove.
* typeck.c (inline_conversion): Remove.
	(cp_build_function_call): Do not use inline_conversion.
	* decl.c (duplicate_decls): Do not insist on inline being declared
	early.
	(start_cleanup_fn): Do not assume that INLINE flags prevent function
	from being output.  We now remove static functions always.
	(finish_function): Do return warning on all static functions.
	* call.c (build_over_call): Do not use inline_conversion.
	* cp-tree.h (possibly_inlined_p): Declare.
	(inline_conversion): Remove.
	* pt.c (instantiate_decl): Use possibly_inlined_p predicate.
	* decl2.c (cp_write_global_declarations): Likewise.
	(mark_used): Likewise.
	(possibly_inlined_p): New functions.

From-SVN: r138150
2008-07-25 21:03:34 +00:00
Jason Merrill b87d79e640 Implement defaulted/deleted functions as per N2346
Implement defaulted/deleted functions as per N2346
        * cp-tree.h (struct lang_decl_flags): Add defaulted_p bitfield.
        (DECL_DELETED_FN): New macro.
        (DECL_DEFAULTED_FN): New macro.
        * class.c (user_provided_p): New fn.
        (defaultable_fn_p): New fn.
        (type_has_user_provided_constructor): New fn.
        (type_has_user_provided_default_constructor): New fn.
        (check_methods): A defaulted fn is still trivial.
        (check_bases_and_members): Likewise.
        * decl.c (grok_special_member_properties): Likewise.
        (duplicate_decls): Complain about redeclaring a function as deleted.
        (start_decl): initialized==2 means deleted.
        (cp_finish_decl): Handle deleted/defaulted semantics.
        * decl2.c (grokfield): Likewise.
        (mark_used): Check DECL_DEFAULTED_FN instead of DECL_ARTIFICIAL.
        Complain about using a deleted fn.
        * init.c (build_value_init_1): Use type_has_user_provided_constructor.
        (perform_member_init): Check for a user-provided default constructor
        even if TYPE_NEEDS_CONSTRUCTING.
        (build_new_1): Likewise.
        * call.c (build_over_call): Don't call mark_used twice.
        * method.c (implicitly_declare_fn): Set DECL_DEFAULTED_FN.
        * search.c (check_final_overrider): Check for deleted mismatch.
        * parser.c (cp_parser_init_declarator): Tell start_decl about =delete.
        (cp_parser_pure_specifier): Handle =default and =delete.

        * error.c (maybe_warn_cpp0x): Suggest -std=gnu++0x as well.

From-SVN: r138123
2008-07-24 15:15:00 -04:00
Julian Brown 711b299844 decl2.c (determine_visibility): Allow target to override visibility of class data.
gcc/cp/
    * decl2.c (determine_visibility): Allow target to override
    visibility of class data.

    gcc/
    * config/arm/arm.c (arm_cxx_determine_class_data_visibility): Make
    no-op for targets which don't use DLLs.

    gcc/testsuite/
    * g++.dg/ext/visibility/arm3.C: Add explanatory text. Skip on
    non-DLL targets.
    * g++.dg/ext/visibility/arm1.C: Skip on non-DLL targets.


Co-Authored-By: Mark Mitchell <mark@codesourcery.com>

From-SVN: r137922
2008-07-17 14:03:50 +00:00
Jakub Jelinek b2febff9b7 re PR c++/36662 (vector vs template)
PR c++/36662
	* decl2.c (is_late_template_attribute): If the first attribute
	argument is IDENTIFIER_NODE, don't consider it when checking
	if arguments are value or type dependent.

	* g++.dg/ext/altivec-16.C: New test.

From-SVN: r137287
2008-06-30 22:41:29 +02:00
Jonathan Wakely 37ec60ed2c typeck.c (composite_pointer_type_r, [...]): Change pedwarn to permerror.
* 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-06-21 11:36:27 +01:00
Simon Martin a6d9bc9dda re PR c++/35320 (ICE with invalid friend declaration)
gcc/cp/

2008-06-14  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/35320
	* decl2.c (grokbitfield): Receive the list of attributes, pass it to
	grokdeclarator and apply it to the created declaration.
	* cp-tree.h (grokbitfield): Update prototype.
	* parser.c (cp_parser_member_declaration): Don't apply the attributes
	since they are now applied in grokbitfield. Adjusted the call to
	grokbitfield.
	(cp_parser_objc_class_ivars): Likewise.

gcc/testsuite/

2008-06-14  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/35320
	* g++.dg/parse/bitfield3.C: New test.

From-SVN: r136778
2008-06-14 05:21:30 +00:00
Jakub Jelinek 5dc1195440 re PR c++/35758 (vector_size attribute lost in function arguments for templates)
PR c++/35758
	* c-common.c (handle_vector_size_attribute): Call
	lang_hooks.types.reconstruct_complex_type instead of
	reconstruct_complex_type.
	* config/rs6000/rs6000.c (rs6000_handle_altivec_attribute): Likewise.
	* config/spu/spu.c (spu_handle_vector_attribute): Likewise.
	* langhooks.h (struct lang_hooks_for_types): Add
	reconstruct_complex_type hook.
	* langhooks-def.h (LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE): Define.
	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it.

	* cp-tree.h (cp_reconstruct_complex_type): New prototype.
	* cp-objcp-common.h (LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE): Define.
	* decl2.c (is_late_template_attribute): Only make vector_size
	late tmpl attribute if argument is type or value dependent.
	(cp_reconstruct_complex_type): New function.

	* g++.dg/ext/vector14.C: New test.

From-SVN: r134639
2008-04-24 18:29:40 +02:00
Douglas Gregor 5ade1ed2c0 typeck.c (composite_pointer_type_r): Add SFINAE support.
2008-03-25  Douglas Gregor  <doug.gregor@gmail.com>

       * typeck.c (composite_pointer_type_r): Add SFINAE support.
       (composite_pointer_type): Ditto.
       (common_type): Fix call to composite_pointer_type.
       (cxx_sizeof_nowarn): New; used to be a macro.
       (cxx_sizeof_expr): Add SFINAE support.
       (cxx_alignof_expr): Ditto.
       (decay_conversion): Fix calls for SFINAE support.
       (rationalize_conditional_expr): Add SFINAE support.
       (build_class_member_access_expr): Ditto.
       (finish_class_member_access_expr): Ditto.
       (build_x_indirect_ref): Ditto.
       (build_indirect_ref): Original version renamed to
       cp_build_indirect_ref; new version provides a bridge from
       c-common.
       (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE
       support.
       (get_member_function_from_ptrfunc): Fix calls for SFINAE support.
       (build_function_call): Original version renamed to
       cp_build_function_call; new version provides a bridge from
       c-common.
       (cp_build_function_call): Was build_function_call; added SFINAE
       support.
       (convert_arguments): Add SFINAE support.
       (build_x_binary_op): Ditto.
       (build_binary_op): Original version renamed to cp_build_binary_op;
       new version provides a bridge from c-common.
       (cp_build_binary_op): Was build_binary_op; added SFINAE support.
       (pointer_diff): Fix calls for SFINAE.
       (build_x_unary_op): Add SFINAE support.
       (condition_conversion): Fix calls for SFINAE.
       (build_unary_op): Original version renamed to cp_build_unary_op;
       new version provides a bridge from c-common.
       (cp_build_unary_op): Was build_unary_op; added SFINAE support.
       (unary_complex_lvalue): Fix calls for SFINAE.
       (build_x_conditional_expr): Add SFINAE support.
       (build_x_compound_expr_from_list): Fix calls for SFINAE.
       (build_x_compound_expr): Add SFINAE support.
       (convert_ptrmem): Fix calls for SFINAE.
       (build_static_cast_1): Add SFINAE support.
       (build_static_cast): Ditto.
       (build_reinterpret_cast_1): Ditto.
       (build_reinterpret_cast): Ditto.
       (build_const_cast_1): Ditto.
       (build_const_cast): Ditto.
       (build_c_cast): Ditto.
       (build_modify_expr): Original version renamed to
       cp_build_modify_expr; new version provides a bridge from c-common.
       (cp_build_modify_expr): Was build_modify_expr; added SFINAE
       support.
       (build_x_modify_expr): Add SFINAE support.
       (build_ptrmemfunc): Fix calls for SFINAE.
       (convert_for_assignment): Add SFINAE support.
       (convert_for_initialization): Ditto.
       (check_return_expr): Fix calls for SFINAE.
       (lvalue_or_else): Add SFINAE support.
       * init.c (perform_member_init): Fix calls for SFINAE.
       (emit_mem_initializers): Ditto.
       (expand_virtual_init): Ditto.
       (expand_cleanup_for_base): Ditto.
       (build_aggr_init): Add SFINAE support.
       (expand_default_init): Ditto.
       (expand_aggr_init_1): Fix calls for SFINAE.
       (build_offset_ref): Ditto.
       (build_new_1): Add SFINAE support.
       (build_new): Ditto.
       (build_vec_delete_1): Fix calls for SFINAE.
       (get_temp_regvar): Ditto.
       (build_vec_init): Add SFINAE support.
       (build_dtor_call): Fix calls for SFINAE.
       (build_delete): Ditto.
       (push_base_cleanups): Ditto.
       (build_vec_delete_1): Ditto.
       * class.c (build_base_path): Fix calls for SFINAE.
       (build_simple_base_path): Ditto.
       (convert_to_base_statically): Ditto.
       (build_vfn_ref): Ditto.
       (resolve_address_of_overloaded_function): Ditto.
       * decl.c (check_initializer): Fix calls for SFINAE.
       (register_dtor_fn): Ditto.
       (compute_array_index_type): Ditto.
       (finish_enum): Ditto.
       (start_preparsed_function): Ditto.
       (cxx_maybe_build_cleanup): Ditto.
       * call.c (convert_like): Add COMPLAIN argument.
       (convert_like_with_context): Ditto.
       (build_this): Fix calls for SFINAE.
       (build_user_type_conversion): Ditto.
       (resolve_args): Ditto.
       (build_new_function_call): Add SFINAE support.
       (build_operator_new_call): Fix calls for SFINAE.
       (build_object_call): Add SFINAE support.
       (build_conditional_expr): Ditto.
       (build_new_op): Ditto.
       (build_op_delete_call): Fix calls for SFINAE.
       (build_temp): Ditto.
       (convert_like_real): Add SFINAE support.
       (build_x_va_arg): Fix calls for SFINAE.
       (convert_default_arg): Ditto.
       (build_over_call): Add SFINAE support.
       (build_java_interface_fn_ref): Fix calls for SFINAE.
       (build_special_member_call): Add SFINAE support.
       (build_new_method_call): Ditto.
       (perform_implicit_conversion): Ditto.
       (perform_direct_initialization_if_possible): Ditto.
       (initialize_reference): Fix calls for SFINAE.
       * method.c (do_build_assign_ref): Fix calls for SFINAE.
       * rtti.c (build_headof): Fix calls for SFINAE.
       (get_tinfo_decl_dynamic): Ditto.
       (get_typeid): Ditto.
       (build_dynamic_cast_1): Add SFINAE support.
       (build_dynamic_cast): Ditto.
       (tinfo_base_init): Fix calls for SFINAE.
       * except.c (do_get_exception_ptr): Fix calls for SFINAE.
       (do_end_catch): Ditto.
       (initialize_handler_parm): Ditto.
       (expand_start_catch_block): Ditto.
       (do_allocate_exception): Ditto.
       (do_free_exception): Ditto.
       (build_throw): Ditto.
       * cvt.c (build_up_reference): Fix calls for SFINAE.
       (convert_to_reference): Ditto.
       (ocp_convert): Ditto.
       (convert_to_void): Add SFINAE support.
       * tree.c (build_dummy_object): Fix calls for SFINAE.
       (stabilize_expr): Ditto.
       * cp-tree.h (build_conditional_expr): Add tsubst_flags_t
       parameter.
       (build_new_method_call): Ditto.
       (build_special_member_call): Ditto.
       (build_new_op): Ditto.
       (perform_implicit_conversion): Ditto.
       (perform_direct_initialization_if_possible): Ditto.
       (convert_to_void): Ditto.
       (build_aggr_init): Ditto.
       (build_new): Ditto.
       (build_vec_init): Ditto.
       (build_dynamic_cast): Ditto.
       (finish_call_expr): Ditto
       (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter.
       (cxx_sizeof_nowarn): Remove macro; add function declaration.
       (build_class_member_access_expr): Add tsubst_flags_t parameter.
       (finish_class_member_access_expr): Ditto.
       (build_x_indirect_ref): Ditto.
       (cp_build_indirect_ref): New.
       (cp_build_function_call): Add tsubst_flags_t parameter.
       (build_x_unary_op): Ditto.
       (cp_build_unary_op): New.
       (build_x_conditional_expr): Add tsubst_flags_t parameter.
       (build_x_compound_expr): Ditto.
       (build_compound_expr): Ditto.
       (build_static_cast): Ditto.
       (build_reinterpret_cast): Ditto.
       (build_const_cast): Ditto.
       (build_c_cast): Ditto.
       (build_x_modify_expr): Ditto.
       (cp_build_modify_expr): New.
       (convert_for_initialization): Add tsubst_flags_t parameter.
       (cp_build_binary_op): Remove macro; add function declaration.
       (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter.
       (lvalue_or_else): Ditto.
       (build_functional_cast): Ditto.
       * typeck2.c (digest_init): Fix calls for SFINAE.
       (process_init_constructor_array): Ditto.
       (process_init_constructor_record): Ditto.
       (build_x_arrow): Ditto.
       (build_m_component_ref): Ditto.
       (build_functional_cast): Add SFINAE support.
       * pt.c (tsubst_copy_and_build): Add (more) SFINAE support.
       * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE.
       (finish_expr_stmt): Ditto.
       (finish_for_expr): Ditto.
       (finish_asm_stmt): Ditto.
       (finish_non_static_data_member): Ditto.
       (finish_qualified_id_expr): Ditto.
       (finish_call_expr): Add SFINAE support.
       (finish_increment_expr): Fix calls for SFINAE.
       (finish_unary_op_expr): Ditto.
       (simplify_aggr_init_expr): Ditto.
       (finish_omp_clauses): Ditto.
       (finish_omp_for): Ditto.
       (finish_omp_barrier): Ditto.
       (finish_omo_flush): Ditto.
       * decl2.c (grok_array_decl): Fix calls or SFINAE.
       (build_anon_union_vars): Ditto.
       (get_guard_cond): Ditto.
       (set_guard): Ditto.
       (one_static_initialization_or_destruction): Ditto.
       (do_static_initialization_or_destruction): Ditto.
       (generate_ctor_or_dtor_function): Ditto.
       (build_offset_ref_call_from_tree): Ditto.
       * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE.
       (cp_parser_postfix_dot_deref_expression): Ditto.
       (cp_parser_unary_expression): Ditto.
       (cp_parser_new_expression): Ditto.
       (cp_parser_cast_expression): Ditto.
       (cp_parser_binary_expression): Ditto.
       (cp_parser_question_colon_clause): Ditto.
       (cp_parser_assignment_expression): Ditto.
       (cp_parser_expression): Ditto.
       (cp_parser_builtin_offsetof): Ditto.
       (cp_parser_template_argument): Ditto.
       (cp_parser_functional_cast): Ditto.

2008-03-25  Douglas Gregor  <doug.gregor@gmail.com>

       * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to
       complain when we hit an error, return ERROR_MARK_NODE.

2008-03-25  Douglas Gregor  <doug.gregor@gmail.com>

       * g++.dg/template/sfinae4.C: New.
       * g++.dg/template/sfinae5.C: New.
       * g++.dg/template/sfinae6.C: New.
       * g++.dg/template/sfinae6_neg.C: New.
       * g++.dg/template/sfinae7.C: New.
       * g++.dg/template/sfinae8.C: New.
       * g++.dg/template/sfinae9.C: New.
       * g++.dg/template/sfinae10.C: New.
       * g++.dg/template/sfinae11.C: New.
       * g++.dg/template/sfinae12.C: New.
       * g++.dg/template/sfinae13.C: New.
       * g++.dg/template/sfinae14C: New.

From-SVN: r133519
2008-03-25 13:53:58 +00:00
Paolo Carlini 9e1e64ec2b cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P.
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-03-21 18:56:51 +00:00
Tom Tromey 2d593c86cf system.h (USE_MAPPED_LOCATION): Poison.
gcc
	* system.h (USE_MAPPED_LOCATION): Poison.
	* Makefile.in (GTFILES): Put CPP_ID_DATA_H first.
	* tree-cfg.c (make_cond_expr_edges): Remove old location code.
	(make_goto_expr_edges): Likewise.
	(remove_bb): Likewise.
	(execute_warn_function_return): Likewise.
	* basic-block.h (struct edge_def) <goto_locus>: Change type to
	location_t.
	* c-common.c (fname_decl): Remove old location code.
	* tree-vect-transform.c (vect_finish_stmt_generation): Remove old
	location code.
	* rtl.h (ASM_OPERANDS_SOURCE_LOCATION): Remove old-location
	variant.
	(ASM_INPUT_SOURCE_LOCATION): Likewise.
	(gen_rtx_ASM_INPUT): Likewise.
	(gen_rtx_ASM_INPUT_loc): Likewise.
	(get_rtx_asm_OPERANDS): Remove.
	* cfglayout.c (insn_locators_alloc): Remove old location code.
	(set_curr_insn_source_location): Likewise.
	(curr_insn_locator): Likewise.
	* print-tree.c (print_node): Remove old location code.
	* tree-mudflap.c (mf_varname_tree): Remove old location code.
	(mf_file_function_line_tree): Remove test of USE_MAPPED_LOCATION.
	* cfgexpand.c (expand_gimple_cond_expr): Don't use
	location_from_locus.
	(construct_exit_block): Remove old location code.
	* emit-rtl.c (force_next_line_note): Remove old location code.
	* profile.c (branch_prob): Remove old location code.
	* tree-vectorizer.h (LOC, UNKNOWN_LOC, EXPR_LOC, LOC_FILE,
	LOC_LINE): Remove old-location variants.
	* langhooks.c (lhd_print_error_function): Remove old location
	code.
	* configure, config.in: Rebuilt.
	* configure.ac (--enable-mapped-location): Remove.
	* c-decl.c (c_init_decl_processing): Remove old location code.
	(finish_function): Likewise.
	* recog.c (decode_asm_operands): Remove old location code.
	* c-pch.c (c_common_read_pch): Remove old location code.
	* rtl.def (ASM_INPUT, ASM_OPERANDS): Remove old location
	variants.
	* gimple-low.c (lower_function_body): Remove old location code.
	* toplev.c (unknown_location): Remove.
	(push_srcloc): Remove old-location variant.
	(process_options): Remove old location code.
	(lang_dependent_init): Likewise.
	* input.h (UNKNOWN_LOCATION): Move definition.
	(location_t): Undeprecate.
	(source_locus): Remove.
	(location_from_locus): Remove.
	(struct location_s): Remove.
	Remove all old-location code.
	(input_line, input_filename): Remove.
	* final.c (final_scan_insn): Remove old location code.
	* diagnostic.c (diagnostic_build_prefix): Remove
	USE_MAPPED_LOCATION test.
	* tree.h (gimple_stmt) <locus>: Now a location_t.
	(tree_exp) <locus>: Likewise.
	(DECL_IS_BUILTIN): Remove old-location variant.
	(annotate_with_file_line, annotate_with_locus): Likewise.
	(expr_locus, set_expr_locus): Update.
	* tree.c (build1_stat): Remove old location code.
	(last_annotated_node): Remove.
	(annotate_with_file_line): Remove old-location variant.
	(annotate_with_locus): Likewise.
	(expr_location): Remove old location code.
	(set_expr_location): Likewise.
	(expr_has_location): Likewise.
	(expr_locus): Likewise.
	(set_expr_locus): Likewise.
	(expr_filename): Don't use location_from_locus.
	(expr_lineno): Likewise.
	* rtl-error.c (location_for_asm): Remove old location code.
	* c-lex.c (cb_line_change): Remove old location code.
	(fe_file_change): Likewise.
	(cb_def_pragma): Likewise.
	(c_lex_with_flags): Likewise.
	* gengtype.c (do_typedef): Don't special-case location types.
	(define_location_structures): Remove.
	(main): Don't call define_location_structures.
	* tree-pretty-print.c (dump_implicit_edges): Remove old location
	code.
gcc/ada
	* misc.c (internal_error_function): Remove test of
	USE_MAPPED_LOCATION.
	* trans.c (gigi): Remove test of USE_MAPPED_LOCATION.
	(Sloc_to_locus): Remove old location code.
gcc/cp
	* parser.c (eof_token): Remove old location code.
	(check_empty_body): Remove test of USE_MAPPED_LOCATION.
	* decl2.c (generate_ctor_or_dtor_function): Remove old location
	code.
	(cp_write_global_declarations): Likewise.
	* lex.c (cxx_init): Remove old location code.
	(handle_pragma_implementation): Remove test of
	USE_MAPPED_LOCATION.
	* pt.c (tsubst): Remove old location code.
	* error.c (cp_print_error_function): Remove test of
	USE_MAPPED_LOCATION.
	* decl.c (pop_label): Remove old location code.
	(finish_function): Likewise.
gcc/fortran
	* trans-io.c (set_error_locus): Remove old location code.
	* trans-decl.c (gfc_set_decl_location): Remove old location code.
	* f95-lang.c (gfc_init): Remove test of USE_MAPPED_LOCATION.
	* scanner.c (gfc_gobble_whitespace): Remove old location code.
	(get_file): Likewise.
	(preprocessor_line): Likewise.
	(load_file): Likewise.
	(gfc_new_file): Likewise.
	* trans.c (gfc_trans_runtime_check): Remove old location code.
	(gfc_get_backend_locus): Likewise.
	(gfc_set_backend_locus): Likewise.
	* data.c (gfc_assign_data_value): Remove old location code.
	* error.c (show_locus): Remove old location code.
	* gfortran.h (gfc_linebuf): Remove old location code.
	(gfc_linebuf_linenum): Remove old-location variant.
gcc/java
	* lang.c (java_post_options): Remove conditional.
	* expr.c (expand_byte_code): Remove old location code.
	* jcf-parse.c (set_source_filename): Remove old location code.
	(give_name_to_class): Likewise.
	(jcf_parse): Likewise.
	(duplicate_class_warning): Likewise.
	(parse_class_file): Likewise.
	(java_parse_file): Likewise.
	* decl.c (finish_method): Remove old location code.
	* class.c (push_class): Remove old location code.
gcc/objc
	* objc-act.c (objc_init): Remove old location code.
gcc/treelang
	* tree1.c (treelang_init): Remove old location code.
	(treelang_parse_file): Likewise.
	* lex.l (LINEMAP_POSITION_FOR_COLUMN): Remove.
	(update_lineno_charno): Remove old location code.

From-SVN: r132679
2008-02-26 16:05:24 +00:00
Jason Merrill 8d2eb30433 PR c++/34962, c++/34937, c++/34939
PR c++/34962, c++/34937, c++/34939
        * decl2.c (is_late_template_attribute): Always defer attributes
        vector_size and weak.

From-SVN: r132297
2008-02-13 16:27:16 -05:00
Jason Merrill 6c5613b043 re PR c++/34094 (Undefined static data member in anonymous namespace can acquire a definition anyway)
PR c++/34094
        * decl2.c (cp_write_global_declarations): Don't write out static
        data members with DECL_IN_AGGR_P set.

From-SVN: r132218
2008-02-10 13:12:01 -05:00
Douglas Gregor 1db54f4e49 re PR c++/35074 (ICE with attribute "aligned" for template classes)
2008-02-05  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/35074
	* decl2.c (save_template_attributes): When we're modifying the
	TYPE_MAIN_VARIANT to add new attributes, be sure to also modify
	all of the other variants to add those same attributes. Otherwise,
	the main variant will be inconsistent with those other variants.
	
2008-02-05  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/35074
	* g++.dg/ext/attrib30.C: New.

From-SVN: r132120
2008-02-05 13:29:43 +00:00
Douglas Gregor 7b3e2d465d re PR c++/34055 (ICE with invalid specialization of variadic template)
2008-01-29  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/34055
	PR c++/34103
	PR c++/34219
	PR c++/34606
	PR c++/34753
	PR c++/34754
	PR c++/34755
	PR c++/34919
	PR c++/34961
	* c-pretty-print.c (pp_c_type_qualifier_list): Don't try to print
	qualifiers for an ERROR_MARK_NODE or a NULL_TREE.


2008-01-29  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/34055
	PR c++/34103
	PR c++/34219
	PR c++/34606
	PR c++/34753
	PR c++/34754
	PR c++/34755
	PR c++/34919
	PR c++/34961
	* typeck.c (check_return_expr): Tweak call to
	check_for_bare_parameter_packs.
	* class.c (add_method): Be careful with error_mark_nodes.
	* cp-tree.h (check_for_bare_parameter_packs): Remove "*" from
	signature.
	* pt.c (struct find_parameter_pack_data): Remove
	SET_PACKS_TO_ERROR.
	(find_parameter_packs_r): Don't use SET_PACKS_TO_ERROR.
	(uses_parameter_packs): Don't set SET_PACKS_TO_ERROR.
	(make_pack_expansion): Ditto.
	(check_for_bare_parameter_packs): Parameter is now a tree, not a
	tree*.
	(process_template_parm): Tweak call to
	check_for_bare_parameter_packs.  
	(push_template_decl_real): Tweak calls to
	check_for_bare_parameter_packs. If bare parameter packs are found
	in the list of exceptions, clear out that list after giving an
	error.
	* semantics.c (finish_cond): Tweak call to
	check_for_bare_parameter_packs.
	(finish_expr_stmt): Ditto.
	(finish_for_expr): Ditto.
	(finish_switch_cond): Ditto.
	(finish_mem_initializers): Ditto.
	(finish_member_declaration): Ditto.
	(finish_static_assert): Check for bare parameter packs in the
	condition.
	* decl2.c (cplus_decl_attributes): Check for bare parameter packs in the
	attributes of a declaration.
	* parser.c (cp_parser_using_declaration): Tweak call to
	check_for_bare_parameter_packs.
	(cp_parser_base_clause): Ditto.
	

2008-01-29  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/34055
	PR c++/34103
	PR c++/34219
	PR c++/34606
	PR c++/34753
	PR c++/34754
	PR c++/34755
	PR c++/34919
	PR c++/34961
	* g++.dg/cpp0x/vt-34219-2.C: New.
	* g++.dg/cpp0x/pr32126.C: Tweak expected error messages.
	* g++.dg/cpp0x/vt-34961.C: New.
	* g++.dg/cpp0x/vt-34055.C: Tweak error messages; add new test
	cases from the re-opened PR.
	* g++.dg/cpp0x/vt-34753.C: New.
	* g++.dg/cpp0x/vt-34919.C: New.
	* g++.dg/cpp0x/vt-34754.C: New.
	* g++.dg/cpp0x/vt-34606.C: New.
	* g++.dg/cpp0x/vt-34219.C: New.
	* g++.dg/cpp0x/pr32125.C: Tweak expected error messages.
	* g++.dg/cpp0x/vt-34755.C: New.
	* g++.dg/cpp0x/pr31438.C: Ditto.
	* g++.dg/cpp0x/variadic81.C: Ditto.

From-SVN: r131938
2008-01-29 13:59:59 +00:00
Jason Merrill 1d555e2632 decl2.c (is_late_template_attribute): Don't defer attribute visibility just because the type is dependent.
* decl2.c (is_late_template_attribute): Don't defer attribute
        visibility just because the type is dependent.

From-SVN: r131833
2008-01-25 14:47:28 -05:00
Jason Merrill 160b8b8014 re PR c++/34913 (ICE vector in template)
PR c++/34913
        * decl2.c (is_late_template_attribute): Defer any attribute with
        dependent args.  Also defer type attributes if the type is dependent.

From-SVN: r131779
2008-01-24 09:41:32 -05:00
Jakub Jelinek 5b767b9d0c re PR c++/34238 ("static data member used, but not defined" error on member definition)
PR c++/34238
	* decl2.c (cp_write_global_declarations): Revert 2007-11-22 change.

	* g++.dg/ext/visibility/anon7.C: Add xfail.
	* g++.dg/ext/visibility/anon9.C: New test.
	* g++.dg/ext/visibility/anon10.C: New test.

From-SVN: r130771
2007-12-11 09:22:10 +01:00
Jakub Jelinek 23372b3faa re PR c++/34178 (Compilation using -frepo fails)
PR c++/34178
	PR c++/34340
	* repo.c (repo_emit_p): Return 2 for DECL_INTEGRAL_CONSTANT_VAR_P
	in class scope rather than DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
	Return 2 also if DECL_EXPLICIT_INSTANTIATION.
	* decl2.c (import_export_decl): Don't make VAR_DECLs import_p when
	flag_use_repository and repo_emit_p returned 2.

	* g++.dg/template/repo6.C: New test.
	* g++.dg/template/repo7.C: New test.
	* g++.dg/template/repo8.C: New test.

From-SVN: r130727
2007-12-09 22:26:29 +01:00
Jakub Jelinek 6d1f904c2e re PR c++/34094 (Undefined static data member in anonymous namespace can acquire a definition anyway)
PR c++/34094
	* decl2.c (cp_write_global_declarations): Issue error about static
	data members in anonymous namespace which are declared and used,
	but not defined.

	* g++.dg/ext/visibility/anon7.C: New test.

From-SVN: r130351
2007-11-22 15:06:06 +01:00
H.J. Lu 565603f84a re PR c++/33871 (typeinfo name referenced in ... defined in discarded section)
2007-11-05  H.J. Lu  <hongjiu.lu@intel.com>

	PR c++/33871
	* decl2.c (constrain_visibility): Clear DECL_ONE_ONLY if marked
	local.

From-SVN: r129911
2007-11-05 15:11:57 -08:00
Diego Novillo c4e622b658 langhooks.h (struct lang_hooks_for_callgraph): Remove third argument from function pointer ANALYZE_EXPR.
* langhooks.h (struct lang_hooks_for_callgraph): Remove third
	argument from function pointer ANALYZE_EXPR.  Update all
	users.
	* cgraph.c (debug_cgraph_node): New.
	(debug_cgraph): New.

From-SVN: r129845
2007-11-02 07:12:30 -04:00
Jakub Jelinek 4c38e99eb4 re PR c++/33616 ("lvalue required as unary '&' operand" with template pmf)
PR c++/33616
	* decl2.c (build_offset_ref_call_from_tree): Call
	build_non_dependent_expr on object prior to building ADDR_EXPR from it
	if FN is DOTSTAR_EXPR.

	* g++.dg/template/ptrmem18.C: New test.

From-SVN: r129784
2007-10-30 23:37:53 +01:00
Paolo Carlini 07021f8c63 re PR c++/31988 (new operator should not permit default first parameter)
cp/
2007-10-26  Paolo Carlini  <pcarlini@suse.de>

	PR c++/31988
	* decl2.c (coerce_new_type): Do not allow a default argument for
	the first parameter.

testsuite/
2007-10-26  Paolo Carlini  <pcarlini@suse.de>

	PR c++/31988
	* g++.dg/init/new25.C: New.

From-SVN: r129657
2007-10-26 18:32:41 +00:00
Jason Merrill dc472c59a5 re PR c++/33094 (ICE on valid C++ virtual template static member in anonymous namespace)
PR c++/33094
        * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
        constant to not have DECL_EXTERNAL if it's file-local.

From-SVN: r128890
2007-09-29 22:41:39 -04:00
Jason Merrill 533007c1e9 decl2.c (is_late_template_attribute): Don't crash on unknown attribute.
* decl2.c (is_late_template_attribute): Don't crash on unknown
        attribute.

From-SVN: r128844
2007-09-27 14:54:06 -04:00
Jason Merrill a7f6bc8c74 re PR c++/19407 (vector keyword in typedef inside template struct ignored)
PR c++/19407
        * cp/cp-tree.h (ATTR_IS_DEPENDENT): New macro.
        (MAYBE_TAGGED_TYPE_P): Remove.
        * cp/pt.c (apply_late_template_attributes): Check ATTR_IS_DEPENDENT
        instead of calling is_late_template_attribute again.
        (tsubst_decl) [TYPE_DECL]: Just check if the name is the tag.
        (tsubst): A typedef is a TYPE_NAME != TYPE_MAIN_DECL.
        Don't crash on typedefs from non-template classes.
        * cp/decl2.c (grokfield): Don't sorry about attrs on template parms.
        (is_late_template_attribute): All attributes applied to template
        parms or typename types are dependent.  Static, take decl.
        (splice_template_attributes): Pass decl through.
        (save_template_attributes): Likewise.
        * attribs.c (lookup_attribute_spec): Split out...
        (decl_attributes): From here.
        * tree.h: Declare it.

From-SVN: r128681
2007-09-22 22:36:34 -04:00
Jason Merrill 5044ab0e64 re PR c++/17743 (dependent expressions in attributes)
PR c++/17743
        * pt.c (apply_late_template_attributes): Set processing_template_decl.
        (tsubst_decl) [TYPE_DECL]: Preserve naming typedef, pass
        ATTR_FLAG_TYPE_IN_PLACE.
        (tsubst): Do unqualified lookup to find typedefs from current class.
        [ARRAY_TYPE]: Propagate alignment info.
        * decl2.c (is_late_template_attribute): Only defer handling of
        attribute aligned if the expression is dependent.
        (save_template_attributes): If we're deferring any attributes,
        make this a naming typedef.

From-SVN: r128590
2007-09-18 18:50:03 -04:00
Jason Merrill 4f4141ffe2 PR c++/17743, c++/19163
PR c++/17743, c++/19163
        * decl2.c (is_late_template_attribute): New fn.
        (splice_template_attributes, save_template_attributes): New fns.
        (cplus_decl_attributes): Call save_template_attributes.
        * pt.c (apply_late_template_attributes): New fn.
        (instantiate_class_template, tsubst_decl): Use it.
        * cp-tree.h: Declare is_late_template_attribute.

From-SVN: r128488
2007-09-14 02:07:25 -04:00
Jason Merrill 3fd406847c * decl2.c (get_guard): Copy visibility from the guarded variable.
From-SVN: r128226
2007-09-06 23:56:41 -04:00
Jason Merrill 6117220672 re PR c++/29365 (Unnecessary anonymous namespace warnings)
PR c++/29365
        * pt.c (outermost_tinst_level): New function.
        * lex.c (in_main_input_context): New function.
        * decl2.c (constrain_class_visibility): Use it to avoid warning
        about uses of the anonymous namespace in the main input file.

From-SVN: r127711
2007-08-22 13:23:37 -04:00
Richard Guenther 145881069e tree.c (WALK_SUBTREE): Call walk_tree_1.
2007-08-20  Richard Guenther  <rguenther@suse.de>

	* tree.c (WALK_SUBTREE): Call walk_tree_1.
	(walk_type_fields): Take lh parameter.
	(walk_tree): Rename to ...
	(walk_tree_1): ... this.  Do not call the walk_subtrees
	langhook but the now passed callback.  Pass lh on recursion.
	(walk_tree_without_duplicates): Rename to ...
	(walk_tree_without_duplicates_1): ... this.  Take lh parameter
	and call walk_tree_1.
	* tree.h (walk_tree_lh): New typedef.
	(walk_tree_1): Declare.
	(walk_tree_without_duplicates_1): Likewise.
	(walk_tree): New define to walk_tree_1 with NULL lh parameter.
	(walk_tree_without_duplicates): New define to
	walk_tree_without_duplicates_1 with NULL lh parameter.
	* langhooks.c (lhd_tree_inlining_walk_subtrees): Remove.
	* langhooks.h (lang_hooks_for_tree_inlining): Remove walk_subtrees
	langhook.
	* langhooks-def.h (lhd_tree_inlining_walk_subtrees): Remove.
	(LANG_HOOKS_TREE_INLINING_WALK_SUBTREES): Likewise.
	(LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove walk_subtrees
	initializer.

	java/
	* lang.c (java_tree_inlining_walk_subtrees): Remove.
	(LANG_HOOKS_TREE_INLINING_WALK_SUBTREES): Remove.

	cp/
	* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_WALK_SUBTREES):
	Remove define.
	* tree.h (cp_walk_tree): New define to walk_tree_1 with
	cp_walk_subtrees lh parameter.
	(cp_walk_tree_without_duplicates): New define to
	walk_tree_without_duplicates_1 with cp_walk_subtrees lh parameter.
	* tree.c (count_trees): Call
	cp_walk_tree_without_duplicates.
	(verify_stmt_tree): Call cp_walk_tree.
	(break_out_target_exprs): Likewise.
	(WALK_SUBTREE): Likewise.
	* cp-gimplify.c (cp_genericize): Likewise.
	* cp-pt.c (find_parameter_packs_r): Likewise.
	(uses_parameter_packs): Likewise.
	(make_pack_expansion): Likewise.
	(check_for_bare_parameter_packs): Likewise.
	(for_each_template_parm): Likewise.
	* decl.c (check_default_argument): Call
	cp_walk_tree_without_duplicates.
	* except.c (build_throw): Likewise.
	* decl2.c (type_visibility): Likewise.
	* semantics.c (expand_or_defer_fn): Likewise.
	(finalize_nrv): Call cp_walk_tree.

From-SVN: r127642
2007-08-20 11:19:22 +00:00
Paolo Carlini f8c3b097ed re PR c++/27211 (Bogus error "template definition of non-template" when there is no non-template)
/cp
2007-08-14  Paolo Carlini  <pcarlini@suse.de>

	PR c++/27211
	* decl2.c (check_classfn): Return error_mark_node in case of error;
	in that case, do not call add_method.
	* decl.c (start_decl): Deal with check_classfn returning
	error_mark_node.
	(grokfndecl): Likewise.
	* pt.c (tsubst_friend_function): Likewise.

/testsuite
2007-08-14  Paolo Carlini  <pcarlini@suse.de>

	PR c++/27211
	* g++.dg/template/error27.C: New.
	* g++.dg/template/error28.C: New.
	* g++.dg/other/pr28304.C: Adjust.
	* g++.old-deja/g++.mike/p811.C: Likewise.

From-SVN: r127492
2007-08-14 22:07:31 +00:00
Nick Clifton e77f031de8 typeck.c: Change copyright header to refer to version 3 of the GNU General 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-08-02 10:36:13 +00:00
Geoffrey Keating ddbfd28de9 Index: gcc/ChangeLog
2007-06-21  Geoffrey Keating  <geoffk@apple.com>

	* doc/invoke.texi (C++ Dialect Options): Document
	fvisibility-ms-compat.
	* c.opt (fvisibility-ms-compat): New.

Index: gcc/cp/ChangeLog
2007-06-21  Geoffrey Keating  <geoffk@apple.com>

	* decl2.c (determine_visibility): Implement
	flag_visibility_ms_compat effect on type info.
	* decl.c (cxx_init_decl_processing): Implement
	global effect of flag_visibility_ms_compat.

Index: gcc/testsuite/ChangeLog
2007-06-26  Geoffrey Keating  <geoffk@apple.com>

	* g++.dg/ext/visibility/ms-compat-1.C: New.

From-SVN: r126088
2007-06-28 19:31:45 +00:00
Geoffrey Keating 32d4913401 decl2.c (start_objects): Mark constructor-runnning function as artificial.
* decl2.c (start_objects): Mark constructor-runnning function
	as artificial.

From-SVN: r126080
2007-06-28 18:31:53 +00:00
Mark Mitchell 3a687f8bbb extend.texi: Document that dllimport and dllexport imply default visibility.
2007-06-23  Mark Mitchell  <mark@codesourcery.com>

	* doc/extend.texi: Document that dllimport and dllexport imply
	default visibility.
	* tree.c (handle_dll_attribute): Set DECL_VISIBILITY on the
	imported or exported declaration, including type declarations.
	* c-common.c (handle_visibility_attribute): Check for conflicts
	with dllimport/dllexport.
	(c_determine_visibility): Handle dllimport/dllexport as an
	explicit visibility atttribute.

2007-06-23  Mark Mitchell  <mark@codesourcery.com>

	* decl2.c (determine_visibility): Don't look for dllexport here.
	(determine_visibility_from_class): Tidy.

2007-06-23  Mark Mitchell  <mark@codesourcery.com>

	* gcc.dg/visibility-12.c: New test.
	* gcc.dg/visibility-13.c: Likewise.
	* g++.dg/ext/visibility-9.C: Likewise.
	* g++.dg/ext/visibility-10.C: Likewise.

From-SVN: r125975
2007-06-23 19:17:04 +00:00
Mark Mitchell 555551c24b cp-tree.h (DECL_VAR_MARKED_P): Remove.
* cp-tree.h (DECL_VAR_MARKED_P): Remove.
	(DECL_ANON_UNION_VAR_P): New macro.
	* class.c (fixed_type_or_null): Tidy.  Use a hash table, rather
	than DECL_VAR_MARKED_P, to keep track of which variables we have
	seen.
	* decl.c (redeclaration_error_message): Complain about redeclaring
	anonymous union members at namespace scope.
	* decl2.c (build_anon_union_vars): Set DECL_ANON_UNION_VAR_P.
	* g++.dg/lookup/anon6.C: New test.

From-SVN: r125745
2007-06-15 16:58:29 +00:00
Geoffrey Keating c96f00012b decl2.c (determine_visibility): Ensure that functions with hidden types as parameters are hidden.
* decl2.c (determine_visibility): Ensure that functions with
	hidden types as parameters are hidden.

From-SVN: r125722
2007-06-14 21:04:10 +00:00
Geoffrey Keating 7dbd86a541 re PR libgcj/31093 (Multicast PromiscuousTraffic)
PR 31093
	* decl2.c (determine_visibility): Remove duplicate code for
	handling type info.

From-SVN: r125721
2007-06-14 20:56:25 +00:00
Mark Mitchell 46a9e52178 decl.c (get_atexit_fn_ptr_type): New function.
* decl.c (get_atexit_fn_ptr_type): New function.
	(get_atexit_node): Use it.
	(start_cleanup_fn): Likewise.
	(register_dtor_fn): Use the object's destructor, instead of a
	separate cleanup function, where possible.
	* cp-tree.h (CPTI_ATEXIT_FN_PTR_TYPE): New enumerator.
	(atexit_fn_ptr_type_node): New macro.
	* decl2.c (build_cleanup): Use build_address.
	* g++.dg/init/cleanup3.C: New test.

From-SVN: r125253
2007-06-01 00:44:36 +00:00
Jan Hubicka 7be8227904 semantics.c (expand_or_defer_fn): Do not call c_record_cdtor_fn.
* semantics.c (expand_or_defer_fn): Do not call c_record_cdtor_fn.
	* decl2.c (start_objects): ctors and dtors are no longer public.
	(cp_write_global_declarations): Do not call c_build_cdtor_fns.

	* cgraphunit.c: Include gt-cgraphunit.h
	(static_ctors, static_dtors): New static vars.
	(record_cdtor_fn, build_cdtor, cgraph_build_cdtor_fns): New functions,
	based on implementation in c-common.c
	(cgraph_finalize_function): Call record_cdtor_fn.
	(cgraph_optimize): Call cgraph_build_cdtor_fns.
	* decl.c (finish_function): Do not call c_record_cdtor_fn.
	(c_write_global_declarations): Do not call c_build_cdtor_fns.
	* c-common.c (static_ctors, static_dtors, c_record_cdtor_fn,
	build_cdtor, c_build_cdtor_fns): Remove.
	* c-common.h (static_ctors, static_dtors, c_record_cdtor_fn,
	c_build_cdtor_fns): Remove prototype.

From-SVN: r124618
2007-05-11 12:18:17 +00:00
Seongbae Park ba99296704 re PR c++/31663 (Segfault in constrain_class_visibility with anonymous namespace)
gcc/ChangeLog:
2007-05-02  Seongbae Park  <seongbae.park@gmail.com>

	PR c++/31663
	* c-common.c (strip_pointer_or_array_types): New function.
	* c-common.h (strip_pointer_or_array_types): New function declaration.

gcc/cp/ChangeLog:
2007-05-02  Seongbae Park  <seongbae.park@gmail.com>

	PR c++/31663
	* decl2.c (constrain_class_visibility): 
	Use strip_pointer_or_array_types instead of strip_array_types.

gcc/testsuite/ChangeLog:
2007-05-02  Seongbae Park  <seongbae.park@gmail.com>

	PR C++/31663
	* g++.dg/warn/anonymous-namespace-2.C: New. 
	* g++.dg/warn/anonymous-namespace-2.h: New.

From-SVN: r124363
2007-05-02 23:11:13 +00:00
Jan Hubicka 09191b7e58 decl2.c (finish_objects): Do not call target constructor/destructor bits dirrectly.
* cp/decl2.c (finish_objects): Do not call target constructor/destructor
	bits dirrectly.

From-SVN: r124062
2007-04-23 10:10:20 +00:00
Seongbae Park 8fff206014 re PR c++/29365 (Unnecessary anonymous namespace warnings)
gcc/ChangeLog:

2007-04-16  Seongbae Park <seongbae.park@gmail.com>

	PR c++/29365

	* cp/decl2.c (constrain_class_visibility):
	Do not warn about the use of anonymous namespace in the main input file.

gcc/testsuite/ChangeLog:

2007-04-16  Seongbae Park <seongbae.park@gmail.com>

	PR c++/29365
	Testcase for c++ anonymous namespace warning

	* g++.dg/warn/anonymous-namespace-1.C: New test
	* g++.dg/warn/anonymous-namespace-1.h: New test

From-SVN: r123879
2007-04-16 16:49:02 +00:00