From patchwork Sun Mar 4 00:55:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 144474 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]) by ozlabs.org (Postfix) with SMTP id C5924B6EEA for ; Sun, 4 Mar 2012 11:56:22 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331427383; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=YJYcIcw 9Lv/GzECFnI+zeqMJ3Cg=; b=sTAYUR99V4DuVN+S48L+ZqdXr4W7B4eAip+bdRa VJY1/mYxF8wExKiTfQEXdAfjbSlZoe4Yc/7EhjPQuuenP//U4zcRzISfzjtgxhJ5 w0pGfgOuAHfRmRLkEL6C/fIVo6aKsNL5amk31o3truPGuMVx51ML6w49oxqRpdNr horA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=aTt9cSgSH3Wo02D321sXs8Xxdufq4wQAL03Yp39UFUMbocZrknibUdNZKd2QTs R8Lm2y3agNMmx7g1+kaKq8IKrJd9zxBxQAfzTJ1WUiPFNmI9jOS9qHcvqrPzZpdp YAncxlRIaPRtcC6Ve62zufLCebyeFNyt24rAO6fUKvSLc=; Received: (qmail 18181 invoked by alias); 4 Mar 2012 00:56:14 -0000 Received: (qmail 18075 invoked by uid 22791); 4 Mar 2012 00:56:13 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 04 Mar 2012 00:56:00 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q240u0EA005833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 3 Mar 2012 19:56:00 -0500 Received: from [10.3.113.56] (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q240u0Di019179 for ; Sat, 3 Mar 2012 19:56:00 -0500 Message-ID: <4F52BD9F.1020801@redhat.com> Date: Sat, 03 Mar 2012 19:55:59 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/36797 (use of __is_empty in template signature) 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 Since we've decided not to mangle __is_empty and such, this patch provides a more helpful error message. Tested x86_64-pc-linux-gnu, applying to trunk. commit bdaa797823a9e45261cfe7a97e4f568decba790b Author: Jason Merrill Date: Thu Jan 12 12:42:07 2012 -0500 PR c++/36797 * mangle.c (write_expression): Improve diagnostic for TRAIT_EXPR. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 34f19ef..04f4344 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2808,7 +2808,17 @@ write_expression (tree expr) if (name == NULL) { - sorry ("mangling %C", code); + switch (code) + { + case TRAIT_EXPR: + error ("use of built-in trait %qE in function signature; " + "use library traits instead", expr); + break; + + default: + sorry ("mangling %C", code); + break; + } return; } else diff --git a/gcc/testsuite/g++.dg/ext/is_empty2.C b/gcc/testsuite/g++.dg/ext/is_empty2.C new file mode 100644 index 0000000..d1bf64c --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/is_empty2.C @@ -0,0 +1,11 @@ +// PR c++/36797 + +template struct A { }; + +template +int foo (A<__is_empty (T)>* = 0); // { dg-error "built-in trait" } + +int main () +{ + foo(); +}