From patchwork Sat Dec 17 03:26:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 131974 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 6CF5A1007D7 for ; Sat, 17 Dec 2011 14:27:03 +1100 (EST) Received: (qmail 29672 invoked by alias); 17 Dec 2011 03:26:59 -0000 Received: (qmail 29657 invoked by uid 22791); 17 Dec 2011 03:26:58 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Sat, 17 Dec 2011 03:26:34 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pBH3QXT4001639 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Dec 2011 22:26:34 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pBH3QXA0005967 for ; Fri, 16 Dec 2011 22:26:33 -0500 Received: from [0.0.0.0] (ovpn-113-21.phx2.redhat.com [10.3.113.21]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id pBH3QWjl001560 for ; Fri, 16 Dec 2011 22:26:32 -0500 Message-ID: <4EEC0BE7.3020602@redhat.com> Date: Fri, 16 Dec 2011 22:26:31 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111112 Thunderbird/8.0 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/51416 (ICE on invalid auto) 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 When there are no arguments for a parameter pack, an expansion between parens in a variable initializer reduces to value-initialization. This isn't valid for auto. Fixed by checking for incomplete type. Tested x86_64-pc-linux-gnu, applying to trunk. commit 380724b25cd317ea8b6434cdd1215e831ac2dcde Author: Jason Merrill Date: Fri Dec 16 18:31:01 2011 -0500 PR c++/51416 * init.c (build_value_init_noctor): Check for incomplete type. diff --git a/gcc/testsuite/g++.dg/cpp0x/auto31.C b/gcc/testsuite/g++.dg/cpp0x/auto31.C new file mode 100644 index 0000000..26a6560 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto31.C @@ -0,0 +1,12 @@ +// PR c++/51416 +// { dg-do compile { target c++11 } } + +template void foo(T, U... u) +{ + auto foo(u...); // { dg-error "auto" } +} + +void bar() +{ + foo(0); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic103.C b/gcc/testsuite/g++.dg/cpp0x/variadic103.C index 6d12331..9d6b5ea 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic103.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic103.C @@ -5,7 +5,7 @@ T&& create(); template void test() { - T t(create()...); // { dg-error "unknown bound" } + T t(create()...); // { dg-error "incomplete" } (void) t; }