aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-20 17:34:35 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-05-20 17:34:35 -0400
commita31ed47cf034b86b88d1e8d6e76c708a8f695f63 (patch)
treeb147e4508ea94f0d360850c002643b026b5c6fa1
parent6e5fba0ef6cc1b784f0a11f89e362973e706c602 (diff)
downloadgcc-a31ed47cf034b86b88d1e8d6e76c708a8f695f63.zip
gcc-a31ed47cf034b86b88d1e8d6e76c708a8f695f63.tar.gz
gcc-a31ed47cf034b86b88d1e8d6e76c708a8f695f63.tar.bz2
re PR c++/57016 ([C++0x] ICE: unexpected expression '__is_final(hash<int>)' of kind trait_expr)
PR c++/57016 * pt.c (instantiation_dependent_r) [TRAIT_EXPR]: Only check type2 if there is one. From-SVN: r199126
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/traits1.C133
3 files changed, 139 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 27ab94e..30e277b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2013-05-20 Jason Merrill <jason@redhat.com>
+ PR c++/57016
+ * pt.c (instantiation_dependent_r) [TRAIT_EXPR]: Only check type2
+ if there is one.
+
PR c++/57102
* decl.c (fndecl_declared_return_type): Also look in
DECL_SAVED_FUNCTION_DATA.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7b80b91..903d529 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -20177,7 +20177,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 <int >
+{};
+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 >;