I've committed this patch to fix a failed assertion. unify's (pt.c) default case asserts EXPR_P(parm), but TRAIT_EXPR is tcc_exceptional, so fails. However from unify's POV it's no more exceptional than, say, SIZEOF_EXPR, so should be allowed at that point.

nathan
2016-08-05  Nathan Sidwell  <nat...@acm.org>

	PR c++/68724
	* pt.c (unify): TRAIT_EXPR is an expr.

	PR c++/68724
	* g++.dg/cpp0x/pr68724.C: New.

Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 239166)
+++ cp/pt.c	(working copy)
@@ -20269,7 +20269,7 @@ unify (tree tparms, tree targs, tree par
       /* An unresolved overload is a nondeduced context.  */
       if (is_overloaded_fn (parm) || type_unknown_p (parm))
 	return unify_success (explain_p);
-      gcc_assert (EXPR_P (parm));
+      gcc_assert (EXPR_P (parm) || TREE_CODE (parm) == TRAIT_EXPR);
     expr:
       /* We must be looking at an expression.  This can happen with
 	 something like:
Index: testsuite/g++.dg/cpp0x/pr68724.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr68724.C	(nonexistent)
+++ testsuite/g++.dg/cpp0x/pr68724.C	(working copy)
@@ -0,0 +1,15 @@
+// PR 68724 ICE in  unificiation
+// { dg-do compile { target c++11 } }
+
+template <typename _Tp, _Tp>
+struct integral_constant
+{
+};
+
+integral_constant<bool, true> inst;
+
+template <typename _Tp>
+struct integral_constant<bool, __is_enum(_Tp)> // { dg-error "" }
+{
+};
+

Reply via email to