re PR c++/5125 (both g++ 3.0.1 and 2.95.3 crash with internal error when trying compi...
authorNathan Sidwell <nathan@codesourcery.com>
Sat, 29 Dec 2001 17:12:55 +0000 (17:12 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Sat, 29 Dec 2001 17:12:55 +0000 (17:12 +0000)
cp:
PR c++/5125
* pt.c (push_template_decl_real): Make sure DECL has
DECL_LANG_SPECIFIC.
testsuite:
* g++.dg/template/crash1.C: New test.

From-SVN: r48370

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash1.C [new file with mode: 0644]

index 77d4c5dcff3688e2f2e732f81bcf3ccc17870f91..b9101957bfc82c84d70349463614211dfe991a57 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-29  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/5125
+       * pt.c (push_template_decl_real): Make sure DECL has
+       DECL_LANG_SPECIFIC.
+
 2001-12-29  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/335
index cd43d4cabd6889bf8317e718887217342914c182..de24a05f6198fe6204ec3371c65eb0ceaee5fd88 100644 (file)
@@ -2627,7 +2627,7 @@ push_template_decl_real (decl, is_friend)
              return decl;
            }
        }
-      else if (! DECL_TEMPLATE_INFO (decl))
+      else if (!DECL_LANG_SPECIFIC (decl) || !DECL_TEMPLATE_INFO (decl))
        {
          error ("template definition of non-template `%#D'", decl);
          return decl;
index 89cf0251068cdf24a15ac1d4e2388843b47027b3..91fd37d2756e1dc87b26f06389ffd66ab37bd8aa 100644 (file)
@@ -1,3 +1,7 @@
+2001-12-29  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.dg/template/crash1.C: New test.
+
 2001-12-29  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.dg/other/const1.C: New test.
diff --git a/gcc/testsuite/g++.dg/template/crash1.C b/gcc/testsuite/g++.dg/template/crash1.C
new file mode 100644 (file)
index 0000000..27e8964
--- /dev/null
@@ -0,0 +1,17 @@
+// { dg-do compile }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Dec 2001 <nathan@nathan@codesourcery.com>
+
+// PR 5125. ICE
+
+class S
+{
+  public:
+  template <class I> void Foo(int (*f)(S& o) ); // { dg-error "candidate" "" }
+};
+
+template <class I>
+void S::Foo(int (*f)(TYPO&o) )
+{ // { dg-error "template definition of non-template|prototype" "" }
+}