From patchwork Mon May 23 14:54:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 96965 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 B6805B6FA2 for ; Tue, 24 May 2011 00:55:20 +1000 (EST) Received: (qmail 12903 invoked by alias); 23 May 2011 14:55:10 -0000 Received: (qmail 12832 invoked by uid 22791); 23 May 2011 14:55:09 -0000 X-SWARE-Spam-Status: No, hits=-6.3 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; Mon, 23 May 2011 14:54:55 +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 p4NEst2C028235 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 May 2011 10:54:55 -0400 Received: from [127.0.0.1] ([10.3.113.3]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4NEsscQ020355 for ; Mon, 23 May 2011 10:54:54 -0400 Message-ID: <4DDA753E.3040809@redhat.com> Date: Mon, 23 May 2011 10:54:54 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/48617 (wrong error with decltype as template type argument) 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 Just a missing case. Tested x86_64-pc-linux-gnu, applying to trunk. commit 047661c30a4c6174fc8b994fcdd3eb344d10609c Author: Jason Merrill Date: Sun May 22 15:06:19 2011 -0400 PR c++/48617 * pt.c (invalid_nontype_parm_type_p): Allow DECLTYPE_TYPE. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d72596f..380b21e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18089,6 +18089,8 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) return 0; else if (TREE_CODE (type) == TYPENAME_TYPE) return 0; + else if (TREE_CODE (type) == DECLTYPE_TYPE) + return 0; if (complain & tf_error) error ("%q#T is not a valid type for a template constant parameter", type); diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype27.C b/gcc/testsuite/g++.dg/cpp0x/decltype27.C new file mode 100644 index 0000000..cb962ad --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype27.C @@ -0,0 +1,9 @@ +// PR c++/48617 +// { dg-options -std=c++0x } + +template // # +struct A {}; + +A a; + +int main() {}