From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31715 invoked by alias); 23 Mar 2012 01:02:10 -0000 Received: (qmail 31706 invoked by uid 22791); 23 Mar 2012 01:02:09 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 23 Mar 2012 01:01:41 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q2N11c6f009515 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 23 Mar 2012 01:01:39 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q2N11bnv018655 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 23 Mar 2012 01:01:38 GMT Received: from abhmt110.oracle.com (abhmt110.oracle.com [141.146.116.62]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q2N11bmt019489; Thu, 22 Mar 2012 20:01:37 -0500 Received: from [192.168.1.4] (/79.43.235.150) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Mar 2012 18:01:37 -0700 Message-ID: <4F6BCABF.9000502@oracle.com> Date: Fri, 23 Mar 2012 01:02:00 -0000 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2 MIME-Version: 1.0 To: Jason Merrill CC: "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch] PR 52487 References: <4F689E3A.20805@oracle.com> <4F68D900.2000604@redhat.com> <4F68E506.3050200@oracle.com> <4F68E9F2.7070406@oracle.com> <4F6B3BF1.80806@redhat.com> <4F6B5A25.2020001@oracle.com> <4F6B6F69.8070609@redhat.com> In-Reply-To: <4F6B6F69.8070609@redhat.com> Content-Type: multipart/mixed; boundary="------------000201030902020103030307" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg01546.txt.bz2 This is a multi-part message in MIME format. --------------000201030902020103030307 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 447 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. /////////////////// --------------000201030902020103030307 Content-Type: text/plain; name="CL_52487_2" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="CL_52487_2" Content-length: 274 /cp 2012-03-22 Paolo Carlini PR c++/52487 * class.c (check_field_decls): Call literal_type_p only on complete types. /testsuite 2012-03-22 Paolo Carlini PR c++/52487 * g++.dg/cpp0x/lambda/lambda-ice7.C: New. --------------000201030902020103030307 Content-Type: text/plain; name="patch_52487_2b" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch_52487_2b" Content-length: 1123 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: --------------000201030902020103030307--