From patchwork Mon May 20 21:32:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 245119 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 8C0FD2C00D7 for ; Tue, 21 May 2013 07:32:59 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=JVc6aHC6ikfNQBFWeVR8oIYeQrGz5ZUTjIOEo/jyUTNs9S 3qZRBjwEqgm9efcOc5GP3YGiQb5DUI8JJwdO4MRPXoyi7ngCrpJNYIKxe/q9TWQg jwzHn7tkkWHrrj4nWwNie93SSdg69g/sAfzc4APn8mcAjFmkYADunAkeqU9oA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=VhLnmg2nLkC6Id8+5HvohVz5PGw=; b=qqHRm3CI2j5g+D1RRrw8 HJQhddUnEyCKAJlje6Y4yBtkiRpaGt1jMXJnuNTQL1Jg1gicDGLpTr6NekYAzoyV 8Ndz8HJakrYTLD2xiYF4arOdRysz0PofOR846RChUSX6Bz9UJ4gYu7te6xpVUIW1 8r5QpUXPT4xTSOWZ1mCZrD8= Received: (qmail 26469 invoked by alias); 20 May 2013 21:32:52 -0000 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 Received: (qmail 26460 invoked by uid 89); 20 May 2013 21:32:52 -0000 X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 20 May 2013 21:32:52 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4KLWoHY006807 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 20 May 2013 17:32:50 -0400 Received: from [10.3.113.45] (ovpn-113-45.phx2.redhat.com [10.3.113.45]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r4KLWnY7013300 for ; Mon, 20 May 2013 17:32:50 -0400 Message-ID: <519A9681.5010504@redhat.com> Date: Mon, 20 May 2013 17:32:49 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:23.0) Gecko/20100101 Thunderbird/23.0a2 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/57016 (ICE with __is_final trait) X-Virus-Found: No instantiation_dependent_r was treating a null trait type as dependent. Tested x86_64-pc-linux-gnu, applying to trunk. commit e0c77ebb435f3910ac533df1c7578e6fcb3ec306 Author: Jason Merrill Date: Mon May 20 14:48:52 2013 -0400 PR c++/57016 * pt.c (instantiation_dependent_r) [TRAIT_EXPR]: Only check type2 if there is one. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 35989a4..f861f4c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20207,7 +20207,8 @@ instantiation_dependent_r (tree *tp, int *walk_subtrees, case TRAIT_EXPR: if (dependent_type_p (TRAIT_EXPR_TYPE1 (*tp)) - || dependent_type_p (TRAIT_EXPR_TYPE2 (*tp))) + || (TRAIT_EXPR_TYPE2 (*tp) + && dependent_type_p (TRAIT_EXPR_TYPE2 (*tp)))) return *tp; *walk_subtrees = false; return NULL_TREE; diff --git a/gcc/testsuite/g++.dg/cpp0x/traits1.C b/gcc/testsuite/g++.dg/cpp0x/traits1.C new file mode 100644 index 0000000..9085b71 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/traits1.C @@ -0,0 +1,133 @@ +// PR c++/57016 +// { dg-require-effective-target c++11 } + +template < typename _Tp, _Tp __v > struct integral_constant +{ + static constexpr _Tp value = __v; +}; +template < bool, typename, typename > struct conditional; +template < typename ... >struct __and_; +template + < + typename + _B1, + typename + _B2 > struct __and_ <_B1, _B2 >:conditional < _B1::value, _B2, _B1 >::type +{}; +template < typename _Pp > struct __not_:integral_constant < bool, _Pp::value > +{}; +template < typename > struct add_rvalue_reference; +template + < typename _Tp > typename add_rvalue_reference < _Tp >::type declval (); +template < bool, typename _Iftrue, typename > struct conditional +{ + typedef _Iftrue type; +}; +template < class, class > struct pair; +template < typename > class allocator; +template < typename, typename, typename > struct binary_function; +template < typename _Tp > struct equal_to:binary_function < _Tp, _Tp, bool > +{}; +template < typename > struct hash; +template < >struct hash +{}; +template + < + typename, + typename, + typename, + typename, typename, typename, typename, typename > struct _Hashtable_base; +template + < + typename, + typename + > struct __is_noexcept_hash:integral_constant < bool, noexcept ((declval)) > +{} +; +struct _Identity; +template < bool, bool _Constant_iterators, bool > struct _Hashtable_traits + ; +struct _Mod_range_hashing; +struct _Default_ranged_hash; +struct _Prime_rehash_policy; +template + < + typename + _Tp, + typename + _Hash + > + using + __cache_default + = + __not_ + < + __and_ + < + integral_constant + < bool, __is_final (_Hash) >, __is_noexcept_hash < _Tp, _Hash > >>; +template < typename _Key, typename _Value, typename, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename, typename _RehashPolicy, typename _Traits > class _Hashtable: +_Hashtable_base + < _Key, _Value, _ExtractKey, _Equal, _H1, _H2, _RehashPolicy, _Traits > +{} +; +template + < + bool + _Cache > using __uset_traits = _Hashtable_traits < _Cache, true, true >; +template + < + typename + _Value, + typename + _Hash + = + hash + < + _Value + >, + typename + _Pred + = + equal_to + < + _Value + >, + typename + _Alloc + = + allocator + < + _Value + >, + typename + _Tr + = + __uset_traits + < + __cache_default + < + _Value, + _Hash + >::value + > + > + using + __uset_hashtable + = + _Hashtable + < + _Value, + _Value, + _Alloc, + _Identity, + _Pred, + _Hash, + _Mod_range_hashing, _Default_ranged_hash, _Prime_rehash_policy, _Tr >; +template < class _Value, class = hash < _Value > >class unordered_set +{ + typedef __uset_hashtable < _Value > iterator; + template < typename > pair < iterator, bool > emplace (); +} +; +template class unordered_set < int >;