This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH: PR 21352


PR 21352 is an ice-on-invalid (though the PR mistakenly claims it is
ice-on-valid).  (The code is invalid because it's trying to use a
non-static member function as something other than a
pointer-to-member.)  The fix is easy: when checking for all the ways
we represent a function, we should just use the function we have for
that purpose.

Although this is a 3.4 regression, I'm not applying the patch there;
it's just an ice-on-invalid, and I don't want to risk
destabilization.  Tested on x86_64-unknown-linux-gnu, applied on the
mainline and on the 4.0 branch.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-05-05  Mark Mitchell  <mark@codesourcery.com>

	PR c++/21352
	* pt.c (build_non_dependent_expr): Use is_overloaded_fn.

2005-05-05  Mark Mitchell  <mark@codesourcery.com>

	PR c++/21352
	* g++.dg/template/crash37.C: New test. 

Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.994
diff -c -5 -p -r1.994 pt.c
*** cp/pt.c	21 Apr 2005 09:18:15 -0000	1.994
--- cp/pt.c	5 May 2005 19:03:55 -0000
*************** build_non_dependent_expr (tree expr)
*** 12503,12516 ****
      return expr;
    /* Preserve OVERLOADs; the functions must be available to resolve
       types.  */
    inner_expr = (TREE_CODE (expr) == ADDR_EXPR ? 
  		TREE_OPERAND (expr, 0) : expr);
!   if (TREE_CODE (inner_expr) == OVERLOAD 
!       || TREE_CODE (inner_expr) == FUNCTION_DECL
!       || TREE_CODE (inner_expr) == TEMPLATE_DECL
!       || TREE_CODE (inner_expr) == TEMPLATE_ID_EXPR
        || TREE_CODE (inner_expr) == OFFSET_REF)
      return expr;
    /* There is no need to return a proxy for a variable.  */
    if (TREE_CODE (expr) == VAR_DECL)
      return expr;
--- 12503,12513 ----
      return expr;
    /* Preserve OVERLOADs; the functions must be available to resolve
       types.  */
    inner_expr = (TREE_CODE (expr) == ADDR_EXPR ? 
  		TREE_OPERAND (expr, 0) : expr);
!   if (is_overloaded_fn (inner_expr)
        || TREE_CODE (inner_expr) == OFFSET_REF)
      return expr;
    /* There is no need to return a proxy for a variable.  */
    if (TREE_CODE (expr) == VAR_DECL)
      return expr;
Index: testsuite/g++.dg/template/crash37.C
===================================================================
RCS file: testsuite/g++.dg/template/crash37.C
diff -N testsuite/g++.dg/template/crash37.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/template/crash37.C	5 May 2005 19:03:55 -0000
***************
*** 0 ****
--- 1,26 ----
+ // PR c++/21352
+ 
+ struct coperator_stack
+ {
+  template<class type>
+  void push3()
+  {
+  }
+ };
+ 
+ struct helper {};
+ 
+ template<class F>
+ void bla(F f)
+ {
+ }
+ 
+ template <typename ScannerT>
+ struct definition
+ {
+  definition()
+  {
+    bla(coperator_stack::push3<helper>); // { dg-error "" } 
+  }
+ };
+ 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]