diff mbox series

[C++] PR 84330 ("[6/7/8 Regression] [concepts] ICE with broken constraint")

Message ID 727ee55c-b5ec-e502-3c49-4ded00f11e3d@oracle.com
State New
Headers show
Series [C++] PR 84330 ("[6/7/8 Regression] [concepts] ICE with broken constraint") | expand

Commit Message

Paolo Carlini Feb. 15, 2018, 2:29 p.m. UTC
Hi,

we have been accumulating quite a few bugs under the [concepts] 
meta-bug, most of which of course aren't regressions. This one is a low 
hanging fruit, an error recovery issue where, after some meaningful 
diagnostic, tsubst_constraint doesn't know how to handle an 
error_mark_node. I believe that ideally we should do better, we should 
be able to issue only the first error - I think a TODO in 
diagnose_constraint hints at that too - but the below should do for now 
(well, in 6.1.0 we issued *3* errors ;-)

Thanks, Paolo.

////////////////////
/cp
2018-02-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84330
	* constraint.cc (tsubst_constraint_info): Handle an error_mark_node
	as first argument.

/testsuite
2018-02-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84330
	* g++.dg/concepts/pr84330.C: New.

Comments

Jason Merrill Feb. 15, 2018, 5:57 p.m. UTC | #1
OK.

On Thu, Feb 15, 2018 at 9:29 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> we have been accumulating quite a few bugs under the [concepts] meta-bug,
> most of which of course aren't regressions. This one is a low hanging fruit,
> an error recovery issue where, after some meaningful diagnostic,
> tsubst_constraint doesn't know how to handle an error_mark_node. I believe
> that ideally we should do better, we should be able to issue only the first
> error - I think a TODO in diagnose_constraint hints at that too - but the
> below should do for now (well, in 6.1.0 we issued *3* errors ;-)
>
> Thanks, Paolo.
>
> ////////////////////
>
diff mbox series

Patch

Index: cp/constraint.cc
===================================================================
--- cp/constraint.cc	(revision 257682)
+++ cp/constraint.cc	(working copy)
@@ -1918,7 +1918,7 @@  tsubst_constraint_info (tree t, tree args,
 tree
 tsubst_constraint (tree t, tree args, tsubst_flags_t complain, tree in_decl)
 {
-  if (t == NULL_TREE)
+  if (t == NULL_TREE || t == error_mark_node)
     return t;
   switch (TREE_CODE (t))
   {
Index: testsuite/g++.dg/concepts/pr84330.C
===================================================================
--- testsuite/g++.dg/concepts/pr84330.C	(nonexistent)
+++ testsuite/g++.dg/concepts/pr84330.C	(working copy)
@@ -0,0 +1,12 @@ 
+// PR c++/84330
+// { dg-options "-fconcepts" }
+
+struct A
+{
+  template<typename T> requires sizeof(T) >> 0 void foo(T);  // { dg-error "predicate constraint" }
+
+  void bar()
+  {
+    foo(0);  // { dg-error "no matching" }
+  }
+};