Patchwork C++ PATCH for c++/50089 (ICE with qualified-id call in lambda)

login
register
mail settings
Submitter Jason Merrill
Date Aug. 30, 2011, 9:33 p.m.
Message ID <4E5D5712.6070301@redhat.com>
Download mbox | patch
Permalink /patch/112387/
State New
Headers show

Comments

Jason Merrill - Aug. 30, 2011, 9:33 p.m.
Just needed to correct current_class_type to current_nonlambda_class 
type here.

Tested x86_64-pc-linux-gnu, applying to trunk and 4.6.

Patch

commit 159563fe81e80fd23ff6252e17c86012a20b169b
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Aug 30 15:46:31 2011 -0400

    	PR c++/50089
    	* semantics.c (finish_id_expression): Use
    	current_nonlambda_class_type for qualified-ids.

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index dd7c013..ce84062 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3251,7 +3251,7 @@  finish_id_expression (tree id_expression,
       if (scope)
 	{
 	  decl = (adjust_result_of_qualified_name_lookup
-		  (decl, scope, current_class_type));
+		  (decl, scope, current_nonlambda_class_type()));
 
 	  if (TREE_CODE (decl) == FUNCTION_DECL)
 	    mark_used (decl);
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C
new file mode 100644
index 0000000..ef041c2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C
@@ -0,0 +1,17 @@ 
+// PR c++/50089
+// { dg-options -std=c++0x }
+
+struct TestBase
+{
+  void foo() {}
+};
+
+struct Test : TestBase
+{
+  void foo()
+  {
+    [this]{
+      /*this->*/TestBase::foo(); // ICE without this->
+    }();
+  }
+};