re PR c++/44039 (ICE: Segmentation fault on error recovery)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 2 Jul 2010 10:13:21 +0000 (10:13 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 2 Jul 2010 10:13:21 +0000 (10:13 +0000)
/cp
2010-07-02  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/44039
* pt.c (tsubst_baselink): Return error_mark_node if lookup_fnfields
returns NULL_TREE.

/testsuite
2010-07-02  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/44039
* g++.dg/template/crash101.C: New.

From-SVN: r161698

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

index 27e7f7a..3b2764d 100644 (file)
@@ -1,3 +1,9 @@
+2010-07-02  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/44039
+       * pt.c (tsubst_baselink): Return error_mark_node if lookup_fnfields
+       returns NULL_TREE.
+
 2010-07-01  Richard Guenther  <rguenther@suse.de>
 
        * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs
index 09d077a..79142b9 100644 (file)
@@ -10737,6 +10737,8 @@ tsubst_baselink (tree baselink, tree object_type,
     if (IDENTIFIER_TYPENAME_P (name))
       name = mangle_conv_op_name_for_type (optype);
     baselink = lookup_fnfields (qualifying_scope, name, /*protect=*/1);
+    if (!baselink)
+      return error_mark_node;
 
     /* If lookup found a single function, mark it as used at this
        point.  (If it lookup found multiple functions the one selected
index b4dc10b..c1a291d 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-02  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/44039
+       * g++.dg/template/crash101.C: New.
+
 2010-07-02  Iain Sandoe  <iains@gcc.gnu.org>
 
        * obj-c++.dg/cxx-ivars-3.mm: Make the test require OSX <= 10.4.
diff --git a/gcc/testsuite/g++.dg/template/crash101.C b/gcc/testsuite/g++.dg/template/crash101.C
new file mode 100644 (file)
index 0000000..38059fc
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/44039
+
+struct locale {  };
+
+template<class charT>
+  void
+  foo()
+  { locale::locale(); } // // { dg-error "cannot call|function-style" }
+
+void
+bar()
+{ foo<char>(); }