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]

Re: [c++ patch] Fix PR 28292


Hi Lee,

Just a couple of comments to your patch in
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00384.html

Index: gcc/testsuite/g++.dg/other/error12.C
===================================================================
--- gcc/testsuite/g++.dg/other/error12.C	(revision 0)
+++ gcc/testsuite/g++.dg/other/error12.C	(revision 0)
@@ -0,0 +1,9 @@
+//PR c++/28292
+
+extern "Java"
+{
+  struct A
+  {
+    void foo(void; // { dg-error "expected|incomplete type|invalid use" }

I don't think that checking for "expected" is a good idea.
Tree checking ICEs also contain "expected". (With Janis' check
for ICE on mainline that's probably not a big problem, but on
other branches we don't have this in place yet.) I'd check for
"before" instead.


Index: gcc/cp/decl2.c
===================================================================
--- gcc/cp/decl2.c	(revision 115296)
+++ gcc/cp/decl2.c	(working copy)
@@ -469,6 +469,9 @@ check_member_template (tree tmpl)
 static bool
 acceptable_java_type (tree type)
 {
+  if (type == error_mark_node)
+    return false;
+
   if (TREE_CODE (type) == VOID_TYPE || TYPE_FOR_JAVA (type))
     return 1;

While you are at it, you might want to change the "1" to "true".


   if (TREE_CODE (type) == POINTER_TYPE || TREE_CODE (type) == REFERENCE_TYPE)
@@ -526,8 +529,11 @@ check_java_method (tree method)
       tree type = TREE_VALUE (arg_types);
       if (!acceptable_java_type (type))
 	{
-	  error ("Java method %qD has non-Java parameter type %qT",
-		 method, type);
+          if (type != error_mark_node)
+            {
+	      error ("Java method %qD has non-Java parameter type %qT",
+		     method, type);
+            }

The braces are superfluous and should be removed.

Regards,
Volker



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