public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++/68724] ICE with TRAIT_EXPR
@ 2016-08-05 12:24 Nathan Sidwell
  2016-08-05 16:06 ` Jason Merrill
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Sidwell @ 2016-08-05 12:24 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

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

[-- Attachment #2: 68724.patch --]
[-- Type: text/x-patch, Size: 1223 bytes --]

2016-08-05  Nathan Sidwell  <nathan@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 "" }
+{
+};
+

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [C++/68724] ICE with TRAIT_EXPR
  2016-08-05 12:24 [C++/68724] ICE with TRAIT_EXPR Nathan Sidwell
@ 2016-08-05 16:06 ` Jason Merrill
  2016-08-05 20:05   ` Nathan Sidwell
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Merrill @ 2016-08-05 16:06 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: GCC Patches

On Fri, Aug 5, 2016 at 8:24 AM, Nathan Sidwell <nathan@acm.org> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [C++/68724] ICE with TRAIT_EXPR
  2016-08-05 16:06 ` Jason Merrill
@ 2016-08-05 20:05   ` Nathan Sidwell
  0 siblings, 0 replies; 3+ messages in thread
From: Nathan Sidwell @ 2016-08-05 20:05 UTC (permalink / raw)
  To: Jason Merrill; +Cc: GCC Patches

On 08/05/16 12:06, Jason Merrill wrote:
> On Fri, Aug 5, 2016 at 8:24 AM, Nathan Sidwell <nathan@acm.org> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-05 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-05 12:24 [C++/68724] ICE with TRAIT_EXPR Nathan Sidwell
2016-08-05 16:06 ` Jason Merrill
2016-08-05 20:05   ` Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).