Patchwork [C++,committed] PR c++/44039

login
register
mail settings
Submitter Paolo Carlini
Date July 2, 2010, 10:16 a.m.
Message ID <4C2DBC8A.4010105@oracle.com>
Download mbox | patch
Permalink /patch/57647/
State New
Headers show

Comments

Paolo Carlini - July 2, 2010, 10:16 a.m.
Hi,

tested x86_64-linux, committed mainline and 4_5-branch. Approved by
Jason on the audit trail.

Thanks,
Paolo.

////////////////
/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.

Patch

Index: testsuite/g++.dg/template/crash101.C
===================================================================
--- testsuite/g++.dg/template/crash101.C	(revision 0)
+++ testsuite/g++.dg/template/crash101.C	(revision 0)
@@ -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>(); }
Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 161691)
+++ cp/pt.c	(working copy)
@@ -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