summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/class.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C9
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7da7f59872f..0fc0bd8a7f6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/52487
+ * class.c (check_field_decls): Call literal_type_p only
+ on complete types.
+
2012-03-22 Jakub Jelinek <jakub@redhat.com>
PR c++/52671
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 6ed4cde6b51..bc17c82c6a0 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3149,8 +3149,9 @@ check_field_decls (tree t, tree *access_decls,
CLASSTYPE_NON_AGGREGATE (t) = 1;
/* If at least one non-static data member is non-literal, the whole
- class becomes non-literal. */
- if (!literal_type_p (type))
+ class becomes non-literal. Note: if the type is incomplete we
+ will complain later on. */
+ if (COMPLETE_TYPE_P (type) && !literal_type_p (type))
CLASSTYPE_LITERAL_P (t) = false;
/* A standard-layout class is a class that:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 36bb18b96e5..bf3c5d10bdb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/52487
+ * g++.dg/cpp0x/lambda/lambda-ice7.C: New.
+
2012-03-22 Jakub Jelinek <jakub@redhat.com>
PR c++/52671
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C
new file mode 100644
index 00000000000..946377e550a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C
@@ -0,0 +1,9 @@
+// PR c++/52487
+// { dg-options "-std=c++0x" }
+
+struct A; // { dg-error "forward declaration" }
+
+void foo(A& a)
+{
+ [=](){a;}; // { dg-error "invalid use of incomplete type" }
+}
OpenPOWER on IntegriCloud