]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/43641 ([C++0x] internal compiler error: tree check: expected call_expr...
authorJason Merrill <jason@redhat.com>
Mon, 12 Apr 2010 19:58:49 +0000 (15:58 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 12 Apr 2010 19:58:49 +0000 (15:58 -0400)
PR c++/43641
* semantics.c (maybe_add_lambda_conv_op): Use build_call_a and tweak
return value directly.

From-SVN: r158241

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv4.C [new file with mode: 0644]

index 00aa53e4871fa5c303fa929bfed364d1fbf24655..0bb6cbb2c74ff2fa2a2632ad330e78b85f9d41a8 100644 (file)
@@ -1,5 +1,9 @@
 2010-04-12  Jason Merrill  <jason@redhat.com>
 
+       PR c++/43641
+       * semantics.c (maybe_add_lambda_conv_op): Use build_call_a and tweak
+       return value directly.
+
        * call.c (type_decays_to): Call cv_unqualified for non-class type.
 
 2010-04-12  Fabien Chene  <fabien.chene@gmail.com>
index 66d152de8b8bdbde255227d8ab406a362ba2c310..ea01eb313783d0c9ce57e789641eda59aaa55668 100644 (file)
@@ -5968,9 +5968,12 @@ maybe_add_lambda_conv_op (tree type)
   VEC_quick_push (tree, argvec, arg);
   for (arg = DECL_ARGUMENTS (statfn); arg; arg = TREE_CHAIN (arg))
     VEC_safe_push (tree, gc, argvec, arg);
-  call = build_cxx_call (callop, VEC_length (tree, argvec),
-                        VEC_address (tree, argvec));
+  call = build_call_a (callop, VEC_length (tree, argvec),
+                      VEC_address (tree, argvec));
   CALL_FROM_THUNK_P (call) = 1;
+  if (MAYBE_CLASS_TYPE_P (TREE_TYPE (call)))
+    call = build_cplus_new (TREE_TYPE (call), call);
+  call = convert_from_reference (call);
   finish_return_stmt (call);
 
   finish_compound_stmt (compound_stmt);
index b73eaa8695b261c0c7b387996fa721b420102d74..03bfcc0c23fa1d15b6f7b426da1b20ecdbaaa7b8 100644 (file)
@@ -1,5 +1,8 @@
 2010-04-12  Jason Merrill  <jason@redhat.com>
 
+       PR c++/43641
+       * g++.dg/cpp0x/lambda/lambda-conv4.C: New.
+
        * g++.dg/cpp0x/lambda/lambda-deduce2.C: New.
 
 2010-04-12  Fabien Chene  <fabien.chene@gmail.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv4.C
new file mode 100644 (file)
index 0000000..6584d28
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/43641
+// { dg-options "-std=c++0x" }
+
+struct B
+{
+  int i;
+};
+
+void func()
+{
+  [](const B& b) -> const int& { return b.i; };
+  [](const B& b) { return b; };
+}
This page took 0.082323 seconds and 5 git commands to generate.