]> gcc.gnu.org Git - gcc.git/commitdiff
semantics.c (begin_class_definition): Check we're not inside a template parm list.
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 18 Jan 2001 09:35:59 +0000 (09:35 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 18 Jan 2001 09:35:59 +0000 (09:35 +0000)
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

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.pt/crash65.C [new file with mode: 0644]

index 9b2d132634ae9694626ac7c7da1a9da8114be932..c020cfaf3d0bca05b1d6a3bf50bedfb220ed10ad 100644 (file)
@@ -1,3 +1,8 @@
+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
index 10e67c644634cb5067f8cdb44aa367bd3baf7601..0c4ed96e1e850c856987e1f7cde8bfc07cf37c9f 100644 (file)
@@ -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))
     {
index ff295af42de7a5a0c3ed5be1d99170a1e9909447..4b00c044efc05ada0969b03f21947e81f29ad06b 100644 (file)
@@ -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 (file)
index 0000000..7b632a6
--- /dev/null
@@ -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
This page took 0.108828 seconds and 5 git commands to generate.