From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22562 invoked by alias); 20 Mar 2012 15:15:17 -0000 Received: (qmail 22531 invoked by uid 22791); 20 Mar 2012 15:15:13 -0000 X-SWARE-Spam-Status: No, hits=-6.2 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; Tue, 20 Mar 2012 15:14:50 +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 q2KFEmqw018610 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 20 Mar 2012 15:14:49 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q2KFElsl011559 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Mar 2012 15:14:48 GMT Received: from abhmt117.oracle.com (abhmt117.oracle.com [141.146.116.69]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q2KFElKd026199; Tue, 20 Mar 2012 10:14:47 -0500 Received: from [192.168.1.4] (/79.25.197.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Mar 2012 08:14:47 -0700 Message-ID: <4F689E3A.20805@oracle.com> Date: Tue, 20 Mar 2012 15:15: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: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 52487 Content-Type: multipart/mixed; boundary="------------000301020003080807080907" 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/msg01359.txt.bz2 This is a multi-part message in MIME format. --------------000301020003080807080907 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 690 Hi, this regression is about literal_type_p ICEing for types which cannot be completed. Indeed, for the testcase, complete_type cannot complete the type but doesn't error out either, just returns the type as-is, and the gcc_assert triggers. We could imagine handling such types in the caller - check_field_decls - but in my opinion makes more sense to just allow such types and return false. I also considered changing literal_type_p to use complete_type_or_else but then it's easy to produce duplicate diagnostics, for example. What do you think? Tested x86_64-linux. Thanks, Paolo. PS: eventually I guess we want to fix this in mainline and 4.7.1. /////////////////////////// --------------000301020003080807080907 Content-Type: text/plain; name="CL_52487" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="CL_52487" Content-length: 288 /cp 2012-03-20 Paolo Carlini PR c++/52487 * semantics.c (literal_type_p): Simply return false for types which cannot be completed. /testsuite 2012-03-20 Paolo Carlini PR c++/52487 * g++.dg/cpp0x/lambda/lambda-ice7.C: New. --------------000301020003080807080907 Content-Type: text/plain; name="patch_52487" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch_52487" Content-length: 977 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/semantics.c =================================================================== --- cp/semantics.c (revision 185571) +++ cp/semantics.c (working copy) @@ -5610,8 +5610,7 @@ literal_type_p (tree t) if (CLASS_TYPE_P (t)) { t = complete_type (t); - gcc_assert (COMPLETE_TYPE_P (t) || errorcount); - return CLASSTYPE_LITERAL_P (t); + return COMPLETE_TYPE_P (t) && CLASSTYPE_LITERAL_P (t); } if (TREE_CODE (t) == ARRAY_TYPE) return literal_type_p (strip_array_types (t)); --------------000301020003080807080907--