From patchwork Thu May 8 11:42:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 347009 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9275714008D for ; Thu, 8 May 2014 21:44:22 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=nfSMvj5uun/7qlRrF +aRlnAH4uzJGHAnPMxLVNiUZqdWN0MGCD0s+GvYs50SbUTab/jyRteKW9nt6hSxU 9/AH3DqRh/8NNpXx3aMs82Jo/WKunKL3xfFDXEnSVqkFPn6KseLC49rB2A69lyrk m5VyZFAY1kfZlDdzseLgLU5pZw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=AvtgJjrG3DssOYdToLc7dEp yZi0=; b=M3/GMWZ8PiDt2GtXaC1YUfZ0xQRIKzsJ9HAlZ2knSkLU6fNw1JZkiG2 G16FNifiouZJeIGNW6r2el9QoRCjDVwwHh8jb0IbxUJ5dnznmRWyh6XR+4wkdJMe 02ZMXPijnEak4WP17KjBS8LnN4wH0Kjnc6n2zbFq6mF1U18T4DFI= Received: (qmail 23171 invoked by alias); 8 May 2014 11:44:15 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 23151 invoked by uid 89); 8 May 2014 11:44:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: userp1040.oracle.com Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 08 May 2014 11:44:13 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s48BiA5W003966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 May 2014 11:44:11 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s48Bi9lS010750 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 8 May 2014 11:44:10 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s48Bi9Ih024694; Thu, 8 May 2014 11:44:09 GMT Received: from [192.168.1.4] (/79.33.94.231) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 08 May 2014 04:44:08 -0700 Message-ID: <536B6D92.6010206@oracle.com> Date: Thu, 08 May 2014 13:42:10 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: Re: [C++ Patch] PR 13981 (resend) References: <536B6541.2050302@oracle.com> In-Reply-To: <536B6541.2050302@oracle.com> X-IsSubscribed: yes ... Manuel suggested to also use DECL_SOURCE_LOCATION, while we are at it. Thus I'm retesting the below. Thanks, Paolo. ////////////////// Index: cp/typeck.c =================================================================== --- cp/typeck.c (revision 210205) +++ cp/typeck.c (working copy) @@ -8094,6 +8094,14 @@ convert_for_assignment (tree type, tree rhs, default: gcc_unreachable(); } + if (TYPE_PTR_P (rhstype) + && TYPE_PTR_P (type) + && CLASS_TYPE_P (TREE_TYPE (rhstype)) + && CLASS_TYPE_P (TREE_TYPE (type)) + && !COMPLETE_TYPE_P (TREE_TYPE (rhstype))) + inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL + (TREE_TYPE (rhstype))), + "class type %qT is incomplete", TREE_TYPE (rhstype)); } return error_mark_node; } Index: testsuite/g++.dg/diagnostic/pr13981.C =================================================================== --- testsuite/g++.dg/diagnostic/pr13981.C (revision 0) +++ testsuite/g++.dg/diagnostic/pr13981.C (working copy) @@ -0,0 +1,12 @@ +// PR c++/13981 + +struct A {}; +struct B; // { dg-message "is incomplete" } + +void func( A *a ); + +int main() +{ + B *b = 0; + func(b); // { dg-error "cannot convert" } +}