* pt.c
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 22 Jul 2004 14:57:09 +0000 (14:57 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 22 Jul 2004 14:57:09 +0000 (14:57 +0000)
cp:
        * pt.c  (get_template_base): Check type is completable.
testsuite:
        * g++.dg/template/crash20.c: New.

From-SVN: r85050

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

index 080de524c4f42950d08050f3dad2bed6676effe6..ce91f8965edfbb42e99ba1023b79d8fb61adb9f2 100644 (file)
@@ -1,3 +1,7 @@
+2004-07-22  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * pt.c (get_template_base): Check type is completable.
+
 2004-07-21  Eric Christopher  <echristo@redhat.com>
 
        * decl.c (poplevel): Inline unused variable checking.
index b30bd5772b83e01812132c6e3dacb6e4eeebf08b..ca84b39442376c3eda8beffffca773bcb8953eee 100644 (file)
@@ -9458,6 +9458,10 @@ get_template_base (tree tparms, tree targs, tree parm, tree arg)
   my_friendly_assert (IS_AGGR_TYPE_CODE (TREE_CODE (arg)), 92);
   
   arg_binfo = TYPE_BINFO (complete_type (arg));
+  if (!arg_binfo)
+    /* The type could not be completed.  */
+    return NULL_TREE;
+  
   rval = get_template_base_recursive (tparms, targs,
                                      parm, arg_binfo, 
                                      NULL_TREE,
index 871b1560d6a4dcfaa8677353aeb5cd4a51170e4a..9e20ccc21b4c209c0de11af25ce25f676f328f88 100644 (file)
@@ -1,3 +1,7 @@
+2004-07-22  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.dg/template/crash20.c: New.
+
 2004-07-22  David Billinghurst (David.Billinghurst@riotinto.com)
 
        * gfortran.dg/g77/970625-2.f Copy from g77.f-torture/execute. 
diff --git a/gcc/testsuite/g++.dg/template/crash20.C b/gcc/testsuite/g++.dg/template/crash20.C
new file mode 100644 (file)
index 0000000..0492b72
--- /dev/null
@@ -0,0 +1,20 @@
+// { dg-do compile }
+
+// Copyright (C) 2004 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 22 Jul 2004 <nathan@codesourcery.com>
+
+// ICE with incompletable type.
+
+class INC;
+
+template <typename T> class B {};
+
+template<typename T> void Foo (B<T> &);
+
+void Foo (INC &);
+
+void Baz (INC *p)
+{
+  Foo (*p);
+}
+