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.carl...@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.carl...@oracle.com>

        PR c++/84330
        * g++.dg/concepts/pr84330.C: New.
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" }
+  }
+};

Reply via email to