diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2001-01-18 09:35:59 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2001-01-18 09:35:59 +0000 |
commit | 522d6614c50ecd386854d7e46010d1b74672f42d (patch) | |
tree | f6125caaf95f3c7b4fbbf88a49dc9578450fc081 /gcc | |
parent | 7f805b8ffc444141ae01003de9bab522cddcae0a (diff) | |
download | gcc-522d6614c50ecd386854d7e46010d1b74672f42d.zip gcc-522d6614c50ecd386854d7e46010d1b74672f42d.tar.gz gcc-522d6614c50ecd386854d7e46010d1b74672f42d.tar.bz2 |
semantics.c (begin_class_definition): Check we're not inside a template parm list.
cp:
* semantics.c (begin_class_definition): Check we're not inside a
template parm list.
testsuite:
* g++.old-deja/g++.pt/crash65.C: New test.
From-SVN: r39113
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/crash65.C | 12 |
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9b2d132..c020cfa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2001-01-18 Nathan Sidwell <nathan@codesourcery.com> + * semantics.c (begin_class_definition): Check we're not inside a + template parm list. + +2001-01-18 Nathan Sidwell <nathan@codesourcery.com> + * tree.c (walk_tree, TREE_LIST): Don't walk the TREE_PURPOSE of BASELINK_P. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 10e67c6..0c4ed96 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1720,6 +1720,11 @@ tree begin_class_definition (t) tree t; { + if (processing_template_parmlist) + { + cp_error ("definition of `%#T' inside template parameter list", t); + return error_mark_node; + } if (t == error_mark_node || ! IS_AGGR_TYPE (t)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ff295af..4b00c04 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-01-18 Nathan Sidwell <nathan@codesourcery.com> + + * g++.old-deja/g++.pt/crash65.C: New test. + 2001-01-18 Neil Booth <neil@daikokuya.demon.co.uk> * gcc.dg/cpp/assembl2.S: New test case. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash65.C b/gcc/testsuite/g++.old-deja/g++.pt/crash65.C new file mode 100644 index 0000000..7b632a6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash65.C @@ -0,0 +1,12 @@ +// Build don't link: + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 11 Jan 2001 <nathan@codesourcery.com> + +// Bug 1506. We ICE'd on a struct definition inside a template parms. +// This is still not completely fixed, but now issues a diagnostic + +// crash test - XFAIL *-*-* + +template<class T = +struct W {}; // ERROR - inside template parms |