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]

[PATCH] Fix PR C++/17797, ICE in build_reinterpret_cast


A simple error checking problem in build_reinterpret_cast.

OK? Tested on powerpc-darwin with no regressions.

Thanks,
Andrew Pinski

Testcase:
typedef int PyObject;
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
template<class T> int _clear(PyObject* self);
void _typeInfo()
{
  reinterpret_cast<PyCFunction>(_clear);
}

ChangeLog:

	* typeck.c (build_reinterpret_cast): Return if the inner type
	is error_mark_node.

Index: typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.579
diff -u -p -r1.579 typeck.c
--- typeck.c	28 Sep 2004 02:56:07 -0000	1.579
+++ typeck.c	2 Oct 2004 22:11:21 -0000
@@ -4711,6 +4711,9 @@ build_reinterpret_cast (tree type, tree

intype = TREE_TYPE (expr);

+  if (intype == error_mark_node)
+    return error_mark_node;
+
   if (TREE_CODE (type) == REFERENCE_TYPE)
     {
       if (! real_lvalue_p (expr))


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