public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 84980 ("[concepts] ICE with missing typename in concept")
@ 2018-08-31  9:33 Paolo Carlini
  2018-08-31 20:35 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2018-08-31  9:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill, Nathan Sidwell

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

Hi,

another straightforward ICE on invalid.  I spent however quite a bit of 
time on it, because I tried to catch the error_mark_node as early as 
possible, but that doesn't seem to work well error-recovery-wise: if, 
say, we catch it in deduce_constrained_parameter we end-up emitting a 
second redundant "‘C’ is not a type" error message because we skip 'C' 
completely. Thus, at least for the time being, I propose to simply catch 
the problem in finish_shorthand_constraint (which likely avoids more 
ICEs already in Bugzilla...). Tested x86_64-linux.

Thanks, Paolo.

////////////////////////


[-- Attachment #2: CL_84980 --]
[-- Type: text/plain, Size: 283 bytes --]

/cp
2018-08-31  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84980
	* constraint.cc (finish_shorthand_constraint): Early return if the
	constraint is erroneous.

/testsuite
2018-08-31  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84980
	* g++.dg/concepts/pr84980.C: New.

[-- Attachment #3: patch_84980 --]
[-- Type: text/plain, Size: 919 bytes --]

Index: cp/constraint.cc
===================================================================
--- cp/constraint.cc	(revision 264009)
+++ cp/constraint.cc	(working copy)
@@ -1259,6 +1259,9 @@ finish_shorthand_constraint (tree decl, tree const
   if (!constr)
     return NULL_TREE;
 
+  if (error_operand_p (constr))
+    return NULL_TREE;
+
   tree proto = CONSTRAINED_PARM_PROTOTYPE (constr);
   tree con = CONSTRAINED_PARM_CONCEPT (constr);
   tree args = CONSTRAINED_PARM_EXTRA_ARGS (constr);
Index: testsuite/g++.dg/concepts/pr84980.C
===================================================================
--- testsuite/g++.dg/concepts/pr84980.C	(nonexistent)
+++ testsuite/g++.dg/concepts/pr84980.C	(working copy)
@@ -0,0 +1,6 @@
+// { dg-do compile { target c++14 } }
+// { dg-additional-options "-fconcepts" }
+
+template<T> concept bool C = true;  // { dg-error "has not been declared" }
+
+template<C...> struct A;

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

* Re: [C++ Patch] PR 84980 ("[concepts] ICE with missing typename in concept")
  2018-08-31  9:33 [C++ Patch] PR 84980 ("[concepts] ICE with missing typename in concept") Paolo Carlini
@ 2018-08-31 20:35 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2018-08-31 20:35 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches, Nathan Sidwell

OK.  And I'd say that this sort of error recovery qualifies as obvious.

Jason


On Fri, Aug 31, 2018 at 5:32 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> another straightforward ICE on invalid.  I spent however quite a bit of time
> on it, because I tried to catch the error_mark_node as early as possible,
> but that doesn't seem to work well error-recovery-wise: if, say, we catch it
> in deduce_constrained_parameter we end-up emitting a second redundant "‘C’
> is not a type" error message because we skip 'C' completely. Thus, at least
> for the time being, I propose to simply catch the problem in
> finish_shorthand_constraint (which likely avoids more ICEs already in
> Bugzilla...). Tested x86_64-linux.
>
> Thanks, Paolo.
>
> ////////////////////////
>

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

end of thread, other threads:[~2018-08-31 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-31  9:33 [C++ Patch] PR 84980 ("[concepts] ICE with missing typename in concept") Paolo Carlini
2018-08-31 20:35 ` Jason Merrill

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).