Patchwork [C++] PR 58481

login
register
mail settings
Submitter Paolo Carlini
Date Sept. 20, 2013, 8:01 p.m.
Message ID <523CA990.6040702@oracle.com>
Download mbox | patch
Permalink /patch/276707/
State New
Headers show

Comments

Paolo Carlini - Sept. 20, 2013, 8:01 p.m.
Hi,

this bug looks superficially similar to the already fixed c++/50089: an 
ICE on valid in build_base_path for a qualified-id call in a lambda, 
which can be worked around by qualifying with this->. It seems to me 
that in this case too a fix may boil down to simply using 
current_nonlambda_class_type () instead of current_class_type: here too 
its return value ends up as the third argument of 
adjust_result_of_qualified_name_lookup.

Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////////////
/cp
2013-09-20

	PR c++/58481
	* pt.c (tsubst_copy): Use current_nonlambda_class_type to
	call tsubst_baselink.

/testsuite
2013-09-20

	PR c++/58481
	* g++.dg/cpp0x/lambda/lambda-this17.C: New.
Jason Merrill - Sept. 20, 2013, 8:14 p.m.
OK.

Jason

Patch

Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 202785)
+++ cp/pt.c	(working copy)
@@ -12434,7 +12438,8 @@  tsubst_copy (tree t, tree args, tsubst_flags_t com
       return t;
 
     case BASELINK:
-      return tsubst_baselink (t, current_class_type, args, complain, in_decl);
+      return tsubst_baselink (t, current_nonlambda_class_type (),
+			      args, complain, in_decl);
 
     case TEMPLATE_DECL:
       if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
Index: testsuite/g++.dg/cpp0x/lambda/lambda-this17.C
===================================================================
--- testsuite/g++.dg/cpp0x/lambda/lambda-this17.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/lambda/lambda-this17.C	(working copy)
@@ -0,0 +1,21 @@ 
+// PR c++/58481
+// { dg-require-effective-target c++11 }
+
+struct Test {
+  template<typename... Args> inline void triggerTest (Args&&... fargs) { } 
+};
+
+struct TestPickled : Test {  
+  template<typename... Args> void triggerTest (Args&&... fargs) { 
+    [=](Args... as) {
+      Test::triggerTest (as...);
+    } ();		
+  }
+};
+
+int main()
+{
+  TestPickled test;
+  test.triggerTest ();
+  return 0;
+}