diff options
author | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-03 11:58:17 +0000 |
---|---|---|
committer | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-03 11:58:17 +0000 |
commit | 50a0654444825108f445422abbcd801610910db4 (patch) | |
tree | b893f0428bd352d3c90aa934e3f96d8e3104ce5e | |
parent | 6a86d77be5228db61e09377e418a4d579dd93b2f (diff) | |
download | gcc-50a0654444825108f445422abbcd801610910db4.tar.gz |
PR c++/9364, c++/10553, c++/10586
* decl.c (make_typename_type): Don't crash on illegal code.
* g++.dg/parse/typename4.C: New test.
* g++.dg/parse/typename5.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66424 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/typename4.C | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/typename5.C | 12 |
5 files changed, 35 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 80da208226e..07e5a655a4c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2003-05-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/9364, c++/10553, c++/10586 + * decl.c (make_typename_type): Don't crash on illegal code. + 2003-05-03 Nathan Sidwell <nathan@codesourcery.com> * class.c (finish_struct): Use location_t and input_location diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d090d2da13b..6cbcd3f9c4b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5418,6 +5418,11 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) { tree fullname; + if (name == error_mark_node + || context == NULL_TREE + || context == error_mark_node) + return error_mark_node; + if (TYPE_P (name)) { if (!(TYPE_LANG_SPECIFIC (name) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f0db700e25..3109c755614 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2003-05-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/9364, c++/10553, c++/10586 + * g++.dg/parse/typename4.C: New test. + * g++.dg/parse/typename5.C: Likewise. + 2003-05-03 Richard Sandiford <rsandifo@redhat.com> * gcc.c-torture/compile/20030503-1.c: New test. diff --git a/gcc/testsuite/g++.dg/parse/typename4.C b/gcc/testsuite/g++.dg/parse/typename4.C new file mode 100644 index 00000000000..529889df60c --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/typename4.C @@ -0,0 +1,7 @@ +// { dg-do compile } + +// Origin: Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de> + +// PR c++/9364: ICE processing typename with name error. + +void find(typename int&); // { dg-error "typename|void|expected" } diff --git a/gcc/testsuite/g++.dg/parse/typename5.C b/gcc/testsuite/g++.dg/parse/typename5.C new file mode 100644 index 00000000000..70a2814a44f --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/typename5.C @@ -0,0 +1,12 @@ +// { dg-do compile } + +// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de> + +// PR c++/10553: ICE processing typename with context error. + +template <typename> struct A {}; + +template <typename> struct B +{ + typedef A<typename X::Y> C; // { dg-error "not a class-name|invalid|no type" } +}; |