Re: [C++/68724] ICE with TRAIT_EXPR

2016-08-05 Thread Nathan Sidwell

On 08/05/16 12:06, Jason Merrill wrote:

On Fri, Aug 5, 2016 at 8:24 AM, Nathan Sidwell  wrote:

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.


Please also apply this to the relevant release branches.


committed to 5 & 6 branches.

nathan


Re: [C++/68724] ICE with TRAIT_EXPR

2016-08-05 Thread Jason Merrill
On Fri, Aug 5, 2016 at 8:24 AM, Nathan Sidwell  wrote:
> 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.

Please also apply this to the relevant release branches.

Thanks,
Jason


[C++/68724] ICE with TRAIT_EXPR

2016-08-05 Thread Nathan Sidwell
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  

	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 
+struct integral_constant
+{
+};
+
+integral_constant inst;
+
+template 
+struct integral_constant // { dg-error "" }
+{
+};
+