18803 – [3.4 regression] rejects access to operator() in template (original) (raw)

| Description Wolfgang Bangerth 2004-12-02 23:42:23 UTC Here's a recent regression (within the last 6 weeks or so): ----------------------- struct A { int operator() (); }; template void foo () { A &a = *new A(); const int i = a(); } ----------------------- deal.II/lac> c++ -c x.cc x.cc: In function 'void foo()': x.cc:8: error: 'a' cannot be used as a function That's clearly bogus. Of course the error goes away once the function is made a nontemplate. This error triggers about a dozen times in my code... W. Comment 1 Drea Pinski 2004-12-02 23:44:42 UTC : Search converges between 2004-11-25-014001-trunk (#656) and 2004-11-25-161001-trunk (#657). Confirmed. Comment 2 Wolfgang Bangerth 2004-12-02 23:57:31 UTC I would venture a guess that it was this patch: 2004-11-25 Mark Mitchell <mark@codesourcery.com> PR c++/18445 * class.c (instantiate_type): Treat NON_DEPENDENT_EXPRs with unknown_type as non matching. Tidy up. * pt.c (build_non_dependent_expr): Do not build a NON_DEPENDENT_EXPR for a VAR_DECL. W. Comment 4 Nathan Sidwell 2004-12-08 08:40:47 UTC 2004-12-08 Nathan Sidwell <nathan@codesourcery.com> PR c++/18803 * cp-tree.h (REFERENCE_REF_P): New. (CPTI_TYPE_INFO_TYPE): Rename to ... (CPTI_CONST_TYPE_INFO_TYPE): ... here. (CPTI_TYPE_INFO_REF_TYPE): Remove. (type_info_type_node): Rename to ... (const_type_info_type_node): ... here. (type_info_ref_type): Remove. * call.c (build_user_type_conversion): Reformat. (resolve_args): Do not convert_from_reference. (build_object_call): Call convert_from_reference. (prep_operand): Do not convert_from_reference. (build_new_method_call): Likewise. * class.c (build_vfield_ref): Likewise. * cvt.c (convert_to_reference): Likewise. (convert_from_reference): Build INDIRECT_REF here, not with build_indirect_ref. (convert_force): Do not convert_from_reference. (build_expr_type_conversion): Likewise. * decl.c (grok_reference_init): Likewise. * decl2.c (delete_sanity): Likewise. * except.c (initialize_handler_parm): Use POINTER_TYPE_P. * init.c (build_dtor_call): Do not convert_from_reference. * parser.c (cp_parser_template_argument): Unwrap indirected reference. Allow TEMPLATE_PARM_INDEX as an object parm. * pt.c (tsubst_copy_and_build) <case INDIRECT_REF>: Use convert_from_reference, if indicated. <case CALL_EXPR>: Do not convert_from_reference. <case PARM_DECL, VAR_DECL>: Convert_from_reference if needed. (tsubst_initializer_list): Do not convert_from_reference. * rtti.c (init_rtti_processing): Adjust node creation. (throw_bad_typeid): Use const_type_info_type_node. Do not convert_from_reference. (typeid_ok_p): Use const_type_info_type_node. (build_typeid, get_typeid): Always return type_info typed node. (build_dynamic_cast_1): Dont convert_from_reference. Refactor. * semantics.c (finish_stmt_expr_expr): Do not convert_from_reference. (finish_id_expression): Convert_from_reference as appropriate. * typeck.c (decay_conversion): Do not convert_from_reference. (finish_class_member_access_expr): Likewise. (build_indirect_ref): Use POINTER_TYPE_P. (convert_arguments): Do not convert_from_reference. (build_modify_expr): Likewise. (convert_for_initialization): Likewise. * typeck2.c (build_x_arrow): Likewise. Comment 5 Wolfgang Bangerth 2005-09-12 01🔞42 UTC Folks, I find that this bug is now present on the 3.4.x branch. I don't know for how long, but believe that it broke somewhere between 5 and 15 days ago. It would be good if we could fix this before 3.4.5 finally comes out. Note that both 4.0.x and mainline seem to be unaffected, so it may be one of the patches that were backported that caused this... W. Comment 6 Nathan Sidwell 2005-09-15 11:36:52 UTC I haven't backported anything recently. Comment 7 Volker Reichelt 2005-09-16 20:34:38 UTC The backport of the fix for PR 18445 caused this. I'll try to backport the fix for PR18803, too. If that fails, reverting the patch for PR 18445 seems like the right thing to me, because this was only an ice-on-invalid-code. Comment 8 Nathan Sidwell 2005-09-16 20:57:26 UTC IMHO reverting 18445 would be the most prudent thing to do. The combination of 18845+18803 are touching too many things for my liking. Comment 9 Volker Reichelt 2005-09-16 21:04:28 UTC On 16 Sep, nathan at gcc dot gnu dot org wrote: > IMHO reverting 18445 would be the most prudent thing to do. The combination > of 18845+18803 are touching too many things for my liking. Gaby, would that be OK with you? I'd revert the patch for PR 18445 on the 3.4 branch, add the testcase for PR18803 to the 3.4 branch (bootstrapped and regtested, of course), and close PR 18445 as fixed in 4.0.0 and WONTFIX in 3.4. Comment 10 Gabriel Dos Reis 2005-09-16 22:40:53 UTC Subject: Re: [3.4 regression] rejects access to operator() in template "reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes: | On 16 Sep, nathan at gcc dot gnu dot org wrote: | > IMHO reverting 18445 would be the most prudent thing to do. The combination | > of 18845+18803 are touching too many things for my liking. | | Gaby, would that be OK with you? Yes -- fixes for ice-on-invalid are nice to have but they are not critical, especially if their fixing introduces more potential for regression. | I'd revert the patch for PR 18445 on the 3.4 branch, add the testcase | for PR18803 to the 3.4 branch (bootstrapped and regtested, of course), | and close PR 18445 as fixed in 4.0.0 and WONTFIX in 3.4. Thanks! -- Gaby Comment 12 Volker Reichelt 2005-09-17 20:53:17 UTC Reverted patch for PR 18445, which broke this. Fixed on the 3.4 branch, thusly. Comment 13 Paul Thomas 2006-04-16 03:45:35 UTC Subject: Bug 18803 Author: pault Date: Sun Apr 16 03:45:24 2006 New Revision: 112981 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112981 Log: 2006-04-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/26822 * intrinsic.c (add_functions): Mark LOGICAL as elemental. PR fortran/26787 * expr.c (gfc_check_assign): Extend scope of error to include assignments to a procedure in the main program or, from a module or internal procedure that is not that represented by the lhs symbol. Use VARIABLE rather than l-value in message. PR fortran/27096 * trans-array.c (gfc_trans_deferred_array): If the backend_decl is not a descriptor, dereference and then test and use the type. PR fortran/25597 * trans-decl.c (gfc_trans_deferred_vars): Check if an array result, is also automatic character length. If so, process the character length. PR fortran/18803 PR fortran/25669 PR fortran/26834 * trans_intrinsic.c (gfc_walk_intrinsic_bound): Set data.info.dimen for bound intrinsics. * trans_array.c (gfc_conv_ss_startstride): Pick out LBOUND and UBOUND intrinsics and supply their shape information to the ss and the loop. PR fortran/27124 * trans_expr.c (gfc_trans_function_call): Add a new block, post, in to which all the argument post blocks are put. Add this block to se->pre after a byref call or to se->post, otherwise. 2006-04-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/26787 * gfortran.dg/proc_assign_1.f90: New test. * gfortran.dg/procedure_lvalue.f90: Change message. * gfortran.dg/namelist_4.f90: Add new error. PR fortran/27096 * gfortran.dg/auto_pointer_array_result_1.f90 PR fortran/27089 * gfortran.dg/specification_type_resolution_1.f90 PR fortran/18803 PR fortran/25669 PR fortran/26834 * gfortran.dg/bounds_temporaries_1.f90: New test. PR fortran/27124 * gfortran.dg/array_return_value_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/array_return_value_1.f90 trunk/gcc/testsuite/gfortran.dg/auto_char_pointer_array_result_1.f90 trunk/gcc/testsuite/gfortran.dg/auto_pointer_array_result_1.f90 trunk/gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90 trunk/gcc/testsuite/gfortran.dg/proc_assign_1.f90 trunk/gcc/testsuite/gfortran.dg/specification_type_resolution_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/expr.c trunk/gcc/fortran/intrinsic.c trunk/gcc/fortran/resolve.c trunk/gcc/fortran/trans-array.c trunk/gcc/fortran/trans-decl.c trunk/gcc/fortran/trans-expr.c trunk/gcc/fortran/trans-intrinsic.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/namelist_4.f90 trunk/gcc/testsuite/gfortran.dg/procedure_lvalue.f90 Comment 14 Paul Thomas 2006-04-23 05:33:26 UTC Subject: Bug 18803 Author: pault Date: Sun Apr 23 05:33:16 2006 New Revision: 113191 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113191 Log: 2006-04-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/27122 * resolve.c (resolve_function): Remove general restriction on auto character length function interfaces. (gfc_resolve_uops): Check restrictions on defined operator procedures. (resolve_types): Call the check for defined operators. PR fortran/27113 * trans-array.c (get_array_ctor_var_strlen): Remove typo in enum. Part of the fix in 4.2, which does not work in 4.1 because the divergence is now too great. PR fortran/26822 * intrinsic.c (add_functions): Mark LOGICAL as elemental. PR fortran/26787 * expr.c (gfc_check_assign): Extend scope of error to include assignments to a procedure in the main program or, from a module or internal procedure that is not that represented by the lhs symbol. Use VARIABLE rather than l-value in message. PR fortran/25597 * trans-decl.c (gfc_trans_deferred_vars): Check if an array result, is also automatic character length. If so, process the character length. Note that this fixes the bug in 4.2 but not here in 4.1 because the trees have diverged too much. Manifestly correct, so applied anyway. PR fortran/18803 PR fortran/25669 PR fortran/26834 * trans_intrinsic.c (gfc_walk_intrinsic_bound): Set data.info.dimen for bound intrinsics. * trans_array.c (gfc_conv_ss_startstride): Pick out LBOUND and UBOUND intrinsics and supply their shape information to the ss and the loop. PR fortran/27124 * trans_expr.c (gfc_trans_function_call): Add a new block, post, in to which all the argument post blocks are put. Add this block to se->pre after a byref call or to se->post, otherwise. 2006-04-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/27122 * gfortran.dg/defined_operators_1.f90: New test. * gfortran.dg/assumed_charlen_function_1.f90: Add new error and remove old ones associated, incorrectly, with Note 5.46. PR fortran/26787 * gfortran.dg/proc_assign_1.f90: New test. * gfortran.dg/procedure_lvalue.f90: Change message. * gfortran.dg/namelist_4.f90: Add new error. PR fortran/27089 * gfortran.dg/specification_type_resolution_1.f90 PR fortran/18803 PR fortran/25669 PR fortran/26834 * gfortran.dg/bounds_temporaries_1.f90: New test. PR fortran/27124 * gfortran.dg/array_return_value_1.f90: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/array_return_value_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/defined_operators_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/proc_assign_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/specification_type_resolution_1.f90 Modified: branches/gcc-4_1-branch/gcc/fortran/ChangeLog branches/gcc-4_1-branch/gcc/fortran/expr.c branches/gcc-4_1-branch/gcc/fortran/intrinsic.c branches/gcc-4_1-branch/gcc/fortran/resolve.c branches/gcc-4_1-branch/gcc/fortran/trans-array.c branches/gcc-4_1-branch/gcc/fortran/trans-decl.c branches/gcc-4_1-branch/gcc/fortran/trans-expr.c branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_4.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/procedure_lvalue.f90 | | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------ | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |