public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Carlini <paolo.carlini@oracle.com>
To: Jason Merrill <jason@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ Patch] PR 52487
Date: Fri, 23 Mar 2012 01:02:00 -0000	[thread overview]
Message-ID: <4F6BCABF.9000502@oracle.com> (raw)
In-Reply-To: <4F6B6F69.8070609@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

On 03/22/2012 07:28 PM, Jason Merrill wrote:
> On 03/22/2012 12:58 PM, Paolo Carlini wrote:
>> Anyway, I also think not calling literal_type_p from check_field_decls
>> if the type is incomplete is pretty ugly, but I'm not sure which is the
>> best way to make progress
> I guess that's OK.  Just add a comment explaining that we'll get an 
> error later.
Done: I applied the below to mainline and 4_7-branch.

Thanks!
Paolo.

///////////////////

[-- Attachment #2: CL_52487_2 --]
[-- Type: text/plain, Size: 274 bytes --]

/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.

[-- Attachment #3: patch_52487_2b --]
[-- Type: text/plain, Size: 1123 bytes --]

Index: testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C
===================================================================
--- testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C	(revision 0)
@@ -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" }
+}
Index: cp/class.c
===================================================================
--- cp/class.c	(revision 185715)
+++ cp/class.c	(working copy)
@@ -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:

      reply	other threads:[~2012-03-23  1:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20 15:15 Paolo Carlini
2012-03-20 19:22 ` Jason Merrill
2012-03-20 20:17   ` Paolo Carlini
2012-03-20 20:38     ` Paolo Carlini
2012-03-22 14:49       ` Jason Merrill
2012-03-22 17:01         ` Paolo Carlini
2012-03-22 17:16           ` Gabriel Dos Reis
2012-03-22 18:29           ` Jason Merrill
2012-03-23  1:02             ` Paolo Carlini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F6BCABF.9000502@oracle.com \
    --to=paolo.carlini@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).