From patchwork Wed Apr 11 17:48:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 151835 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 B5C52B705E for ; Thu, 12 Apr 2012 03:49:30 +1000 (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=1334771371; 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=CGnsTdu 3uwZxe02261vuRFAFgcQ=; b=uzvtSKv46hgbJsq89AvDKPiLRRdqyS+rW6Q6UIu p3OMtj2elreogi1+kj4FIdlW84JEavOwg2LvPLhaNTCpQl3g1gPBJ6gielSPBXdu h96CmFnvjdK5QfXv8v420hJfWU+NIZI+buYlF2CbfmWEqYCKIibMbVfBdF9zjcni dA1I= 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=BOwee7E6HVjGwD5TGElHvTWbg98JVjtr68BT+b5CDnmjfl4Hrl/rhLmV+VkP01 8FDVIiIs4Kbt7zJUbdNfvwV0vzmXnRTafHWfB4RisEmlbmrBzOQVgTOnsKKujYZ+ OqjJG5OmEwO7FHUgNkYMK4y4v7QK/sYoQXoSgW1DFcHWU=; Received: (qmail 18443 invoked by alias); 11 Apr 2012 17:49:20 -0000 Received: (qmail 18432 invoked by uid 22791); 11 Apr 2012 17:49:18 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, 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; Wed, 11 Apr 2012 17:48:58 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3BHmv6b019055 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 11 Apr 2012 13:48:57 -0400 Received: from [10.3.113.125] (ovpn-113-125.phx2.redhat.com [10.3.113.125]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3BHmvu1028073 for ; Wed, 11 Apr 2012 13:48:57 -0400 Message-ID: <4F85C409.6080305@redhat.com> Date: Wed, 11 Apr 2012 13:48:57 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/52906 (ICE with attribute by itself) 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 We can't talk about the type if there is no type. Tested x86_64-pc-linux-gnu, applying to trunk. commit bc94f519583cdfc705c1bde750a06bbd42537193 Author: Jason Merrill Date: Wed Apr 11 10:08:37 2012 -0400 PR c++/52906 * decl.c (check_tag_decl): Don't complain about attributes if we don't even have a type. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e2f01d5..8b22192 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4224,7 +4224,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs) error ("% cannot be used for type declarations"); } - if (declspecs->attributes && warn_attributes) + if (declspecs->attributes && warn_attributes && declared_type) { location_t loc; if (!CLASS_TYPE_P (declared_type) diff --git a/gcc/testsuite/g++.dg/ext/attrib45.C b/gcc/testsuite/g++.dg/ext/attrib45.C new file mode 100644 index 0000000..0be1322 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib45.C @@ -0,0 +1,3 @@ +// PR c++/52906 + +__attribute__ ((__deprecated__)); // { dg-error "does not declare anything" }