From patchwork Wed Sep 14 12:56:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 114676 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 D1543B70C2 for ; Wed, 14 Sep 2011 22:57:18 +1000 (EST) Received: (qmail 29391 invoked by alias); 14 Sep 2011 12:57:16 -0000 Received: (qmail 29382 invoked by uid 22791); 14 Sep 2011 12:57:15 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Sep 2011 12:56:41 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8ECuZ3F001779 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 14 Sep 2011 12:56:38 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8ECuYBD015828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 14 Sep 2011 12:56:34 GMT Received: from abhmt113.oracle.com (abhmt113.oracle.com [141.146.116.65]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8ECuTlD006504; Wed, 14 Sep 2011 07:56:29 -0500 Received: from [192.168.1.4] (/79.33.217.31) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 14 Sep 2011 05:56:28 -0700 Message-ID: <4E70A470.3060901@oracle.com> Date: Wed, 14 Sep 2011 14:56:16 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 50391 X-IsSubscribed: yes 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 Hi, here I'm just avoiding calling build_exception_variant when specs is an error_mark_node. Tested x86_64-linux. Ok for mainline? Thanks, Paolo. ///////////////////// /cp 2011-09-14 Paolo Carlini PR c++/50391 * pt.c (regenerate_decl_from_template): Don't pass an error_mark_node to build_exception_variant. /testsuite 2011-09-14 Paolo Carlini PR c++/50391 * g++.dg/cpp0x/noexcept15.C: New. Index: testsuite/g++.dg/cpp0x/noexcept15.C =================================================================== --- testsuite/g++.dg/cpp0x/noexcept15.C (revision 0) +++ testsuite/g++.dg/cpp0x/noexcept15.C (revision 0) @@ -0,0 +1,34 @@ +// PR c++/50391 +// { dg-options -std=c++0x } + +#include + +template + struct single + { + Tp elem; // { dg-error "incomplete type" } + + constexpr single(const Tp& e) + : elem(e) { } // { dg-error "invalid field" } + + single(single&& s) // { dg-error "not a member" } + noexcept(std::is_nothrow_move_constructible::value) + : elem(s.elem) { } // { dg-error "invalid field|no member" } + }; + +template + constexpr single::type> + make_single(Tp&& x) + { + return single::type>(x); + } + +class Blob; // { dg-error "forward declaration" } + +void +foo(Blob *b) +{ + make_single(*b); +} + +// { dg-prune-output "include" } Index: cp/pt.c =================================================================== --- cp/pt.c (revision 178845) +++ cp/pt.c (working copy) @@ -17729,7 +17729,7 @@ regenerate_decl_from_template (tree decl, tree tmp specs = tsubst_exception_specification (TREE_TYPE (code_pattern), args, tf_error, NULL_TREE, /*defer_ok*/false); - if (specs) + if (specs && specs != error_mark_node) TREE_TYPE (decl) = build_exception_variant (TREE_TYPE (decl), specs);