diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-07-02 09:36:20 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-07-02 09:36:20 +0000 |
commit | 0c83a0fcff9df31e594bcf7d888c7842b940b003 (patch) | |
tree | f927c22a108518e58655292ad81f2de110d960d5 /gcc | |
parent | 1a8c4ca62da430aa2d8920b70f1614ab0755059b (diff) | |
download | gcc-0c83a0fcff9df31e594bcf7d888c7842b940b003.zip gcc-0c83a0fcff9df31e594bcf7d888c7842b940b003.tar.gz gcc-0c83a0fcff9df31e594bcf7d888c7842b940b003.tar.bz2 |
re PR c++/9779 (ICE in type_unknown_p when casting in static member)
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.
From-SVN: r68824
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/dependent-expr1.C | 29 |
5 files changed, 50 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c0480b9..c8bb893 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 c621793..c3b7cd0 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 6c17089..4900cbf 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 3d9914d..1a4d547 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 0000000..079f033 --- /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); + } + +} |