diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2012-03-23 00:35:33 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2012-03-23 00:35:33 +0000 |
commit | 48d261d20a1588698f9aa4f92dfd151791c4e8e1 (patch) | |
tree | e35f92911cddee26b212d45467cb513da73dc185 | |
parent | d7bdd048edd2ec5ab950e87d3991ff487b467269 (diff) | |
download | gcc-48d261d20a1588698f9aa4f92dfd151791c4e8e1.zip gcc-48d261d20a1588698f9aa4f92dfd151791c4e8e1.tar.gz gcc-48d261d20a1588698f9aa4f92dfd151791c4e8e1.tar.bz2 |
re PR c++/52487 ([C++11] ICE at cp/semantics.c:5613 with lambda capturing reference to incomplete type by value)
/cp
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.
/testsuite
2012-03-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/52487
* g++.dg/cpp0x/lambda/lambda-ice7.C: New.
From-SVN: r185722
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C | 9 |
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7da7f59..0fc0bd8 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 6ed4cde6..bc17c82 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 36bb18b..bf3c5d1 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 0000000..946377e --- /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" } +} |