]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/42083 ([C++0x] ICE on invalid with "tree check: expected aggr_init_expr...
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 15 Dec 2010 17:35:04 +0000 (17:35 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 15 Dec 2010 17:35:04 +0000 (17:35 +0000)
/cp
2010-12-15  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/42083
* init.c (build_value_init): Check build_special_member_call return
value for error_mark_node.

/testsuite
2010-12-15  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/42083
* g++.dg/cpp0x/lambda/lambda-ice2.C: New.

From-SVN: r167862

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

index 142dd533ac725ca20d775751a1ce5afbcc6d3064..6dd121a91d6ab6a2670e0781de66b452aca2f702 100644 (file)
@@ -1,3 +1,9 @@
+2010-12-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/42083
+       * init.c (build_value_init): Check build_special_member_call return
+       value for error_mark_node.
+
 2010-12-14  Jason Merrill  <jason@redhat.com>
 
        PR c++/46930
index 5a4f91cfb2b06bd72d62947c2bc398b61695488d..9c3dd327fb6c090279818fa0a390e886f400e060 100644 (file)
@@ -314,9 +314,11 @@ build_value_init (tree type, tsubst_flags_t complain)
          tree ctor = build_special_member_call
            (NULL_TREE, complete_ctor_identifier,
             NULL, type, LOOKUP_NORMAL, complain);
-
-         ctor = build_aggr_init_expr (type, ctor);
-         AGGR_INIT_ZERO_FIRST (ctor) = 1;
+         if (ctor != error_mark_node)
+           {
+             ctor = build_aggr_init_expr (type, ctor);
+             AGGR_INIT_ZERO_FIRST (ctor) = 1;
+           }
          return ctor;
        }
     }
index 9c71bba1d1033051daabc2f1debb6e29b9c887d2..1d865c6dd91d18ca2eaa4c1066ccb69c6f229d22 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/42083
+       * g++.dg/cpp0x/lambda/lambda-ice2.C: New.
+
 2010-12-15  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gfortran.dg/debug/pr46756.f: Correct PR number.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C
new file mode 100644 (file)
index 0000000..352137a
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/42083
+// { dg-options "-std=c++0x" }
+
+template<typename F>
+decltype(F()) run(F f) // { dg-message "note" }
+{
+  return f();
+}
+
+int main()
+{
+  auto l = []() { return 5; };
+
+  run(l); // { dg-error "no match" }
+  // { dg-message "candidate" "candidate note" { target *-*-* } 14 }
+}