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]

Re: 19980525 ICE; templates; const


The patch below fixes this problem.

Martin

1998-05-31  Martin von Löwis  <loewis@informatik.hu-berlin.de>

	* typeck.c (convert_arguments): Strip all TREE_LIST nodes before
	complaining about ambiguous address of overloaded function.
 
Index: typeck.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/typeck.c,v
retrieving revision 1.74
diff -c -p -r1.74 typeck.c
*** typeck.c	1998/05/25 10:28:15	1.74
--- typeck.c	1998/05/31 19:10:28
*************** convert_arguments (return_loc, typelist,
*** 2955,2960 ****
--- 2961,2969 ----
  	  /* Strip the `&' from an overloaded FUNCTION_DECL.  */
  	  if (TREE_CODE (val) == ADDR_EXPR)
  	    val = TREE_OPERAND (val, 0);
+ 	  /* Strip all list nodes to get down to OVERLOAD node if present. */
+ 	  while (val && TREE_CODE (val) == TREE_LIST)
+ 	    val = TREE_VALUE (val);
  	  if (really_overloaded_fn (val))
  	    cp_error ("insufficient type information to resolve address of overloaded function `%D'",
  		      DECL_NAME (get_first_fn (val)));

--- /dev/null	Mon Jul 18 01:46:18 1994
+++ g++.pt/overload2.C	Sun May 31 21:13:15 1998
@@ -0,0 +1,16 @@
+//Build don't link:
+template<class T>
+class C
+{
+public:
+	C<T*> O();
+	C<T*> O() const;
+};
+
+
+int
+main()
+{
+	C<char*>	c;
+	char*		p = Z(c.O); //ERROR - ambiguous c.O
+}


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