OSDN Git Service

1998-12-22 Mark Mitchell <mark@markmitchell.com>
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Dec 1998 10:33:17 +0000 (10:33 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Dec 1998 10:33:17 +0000 (10:33 +0000)
* cp-tree.h (TYPE_RAISES_EXCEPTIONS): Improve documentation.
* tree.c (build_exception_variant): Don't crash on empty throw
specs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24394 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/tree.c
gcc/testsuite/g++.old-deja/g++.eh/spec5.C [new file with mode: 0644]

index ca7bc01..e4b724c 100644 (file)
@@ -1,3 +1,9 @@
+1998-12-22  Mark Mitchell  <mark@markmitchell.com>
+
+       * cp-tree.h (TYPE_RAISES_EXCEPTIONS): Improve documentation.
+       * tree.c (build_exception_variant): Don't crash on empty throw
+       specs. 
+
 1998-12-18  DJ Delorie  <dj@cygnus.com>
 
        * cvt.c (convert_to_reference): Check for both error_mark_node
index cb55b06..f4399e7 100644 (file)
@@ -1143,7 +1143,9 @@ struct lang_type
 #define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
 
 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
-   this type can raise.  */
+   this type can raise.  Each TREE_VALUE is a _TYPE.  The TREE_VALUE
+   will be NULL_TREE to indicate a throw specification of `(...)', or,
+   equivalently, no throw specification.  */
 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
 
 /* The binding level associated with the namespace.  */
index 8bb750a..8777a11 100644 (file)
@@ -1476,7 +1476,9 @@ build_exception_variant (type, raises)
       for (t = TYPE_RAISES_EXCEPTIONS (v), u = raises;
           t != NULL_TREE && u != NULL_TREE;
           t = TREE_CHAIN (t), u = TREE_CHAIN (v))
-       if (!same_type_p (TREE_VALUE (t), TREE_VALUE (u)))
+       if (((TREE_VALUE (t) != NULL_TREE) 
+            != (TREE_VALUE (u) != NULL_TREE))
+           || !same_type_p (TREE_VALUE (t), TREE_VALUE (u)))
          break;
 
       if (!t && !u)
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec5.C b/gcc/testsuite/g++.old-deja/g++.eh/spec5.C
new file mode 100644 (file)
index 0000000..56154f9
--- /dev/null
@@ -0,0 +1,3 @@
+// Build don't link:
+
+extern void *f(unsigned int k) throw();