summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-02 09:36:20 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-02 09:36:20 +0000
commite4dd7d1a6fde4f6292fb4c47c34dd4e9b787dfa5 (patch)
treef927c22a108518e58655292ad81f2de110d960d5
parent74878f86c8e599ce62202c57d0ea3ad48bbf8abd (diff)
downloadppe42-gcc-e4dd7d1a6fde4f6292fb4c47c34dd4e9b787dfa5.tar.gz
ppe42-gcc-e4dd7d1a6fde4f6292fb4c47c34dd4e9b787dfa5.zip
cp:
PR c++/9779 * decl2.c (arg_assoc_class): Don't die on NULL type. * typeck.c (type_unknown_p): Don't die on untyped expressions. testsuite: PR c++/9779 * g++.dg/template/dependent-expr1.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68824 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl2.c5
-rw-r--r--gcc/cp/typeck.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/dependent-expr1.C29
5 files changed, 50 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c0480b97c56..c8bb8930c70 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2003-07-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9779
+ * decl2.c (arg_assoc_class): Don't die on NULL type.
+ * typeck.c (type_unknown_p): Don't die on untyped expressions.
+
2003-07-01 Mark Mitchell <mark@codesourcery.com>
PR c++/6949
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index c6217936918..c3b7cd0d518 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4057,6 +4057,11 @@ arg_assoc_class (struct arg_lookup *k, tree type)
static bool
arg_assoc_type (struct arg_lookup *k, tree type)
{
+ /* As we do not get the type of non-type dependent expressions
+ right, we can end up with such things without a type. */
+ if (!type)
+ return false;
+
switch (TREE_CODE (type))
{
case ERROR_MARK:
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 6c17089192d..4900cbffb17 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -183,7 +183,11 @@ type_unknown_p (exp)
return (TREE_CODE (exp) == OVERLOAD
|| TREE_CODE (exp) == TREE_LIST
|| TREE_TYPE (exp) == unknown_type_node
- || (TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE
+ /* Until we get the type of non type-dependent expressions
+ correct, we can have non-type dependent expressions with
+ no type. */
+ || (TREE_TYPE (exp)
+ && TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE
&& TREE_TYPE (TREE_TYPE (exp)) == unknown_type_node));
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3d9914d8dfb..1a4d547818b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-07-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9779
+ * g++.dg/template/dependent-expr1.C: New.
+
2003-07-01 Mark Mitchell <mark@codesourcery.com>
PR c++/6949
diff --git a/gcc/testsuite/g++.dg/template/dependent-expr1.C b/gcc/testsuite/g++.dg/template/dependent-expr1.C
new file mode 100644
index 00000000000..079f033611b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dependent-expr1.C
@@ -0,0 +1,29 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 30 Jun 2003 <nathan@codesourcery.com>
+
+// PR c++ 9779. ICE
+
+struct I
+{
+};
+
+void Foo (int);
+namespace std
+{
+ template <typename X>
+ void Baz (I *x)
+ {
+ Foo (sizeof (I));
+ Foo (sizeof (x));
+ Foo (__alignof__ (I));
+ Foo (__alignof__ (x));
+ Foo (x->~I ());
+ // Foo (typeid (I));
+ Foo (delete x);
+ Foo (delete[] x);
+ Foo (throw x);
+ }
+
+}
OpenPOWER on IntegriCloud