re PR c++/47242 ([C++0x] ICE: tree check: expected field_decl, have error_mark in...
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 23 Feb 2011 00:37:43 +0000 (00:37 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 23 Feb 2011 00:37:43 +0000 (00:37 +0000)
/cp
2011-02-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/47242
* semantics.c (build_lambda_object): Bail out if a field is
error_mark_node.

/testsuite
2011-02-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/47242
* g++.dg/cpp0x/lambda/lambda-ice4.C: New.

From-SVN: r170423

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

index b5323718b7cb62e4b38a12bd1d1e00071e7a1dac..291f09b6be0fd038bc0d9fb3a9a5727873653d8b 100644 (file)
@@ -1,3 +1,9 @@
+2011-02-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/47242
+       * semantics.c (build_lambda_object): Bail out if a field is
+       error_mark_node.
+
 2011-02-22  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/47666
index 6a9c6a08d18a1f6ad8aea7d5c229be22b9f273ee..4af007dfb7f5c9371d0f43f9315b81c237db8a88 100644 (file)
@@ -7795,6 +7795,12 @@ build_lambda_object (tree lambda_expr)
       tree field = TREE_PURPOSE (node);
       tree val = TREE_VALUE (node);
 
+      if (field == error_mark_node)
+       {
+         expr = error_mark_node;
+         goto out;
+       }
+
       if (DECL_P (val))
        mark_used (val);
 
@@ -7830,6 +7836,7 @@ build_lambda_object (tree lambda_expr)
   expr = finish_compound_literal (type, expr);
   CLASSTYPE_NON_AGGREGATE (type) = 1;
 
+ out:
   input_location = saved_loc;
   return expr;
 }
index aa53085b3a074e867de48351f3cd654fc2cbbeda..f64735eb17a6afd958092295b9156447e70d8643 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/47242
+       * g++.dg/cpp0x/lambda/lambda-ice4.C: New.
+
 2011-02-23  Jie Zhang  <jie@codesourcery.com>
 
        PR rtl-optimization/47763
        PR objc/47784
        * objc.dg/property/dotsyntax-22.m: New.
        * obj-c++.dg/property/dotsyntax-22.mm: New.
-       
+
 2011-02-20  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/46394
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice4.C
new file mode 100644 (file)
index 0000000..77c773b
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/47242
+// { dg-options "-std=c++0x" }
+
+template < typename > void
+bar ()
+{
+  [i]{}; // { dg-error "declared|invalid" }
+}
+
+void
+foo ()
+{
+  bar<int>();
+}