+2020-04-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/67825
+ * constraint.cc (diagnose_valid_expression): Check convert_to_void here
+ as well as in tsubst_valid_expression_requirement.
+
2020-04-21 Patrick Palka <ppalka@redhat.com>
PR c++/94549
diagnose_valid_expression (tree expr, tree args, tree in_decl)
{
tree result = tsubst_expr (expr, args, tf_none, in_decl, false);
- if (result != error_mark_node)
+ if (result != error_mark_node
+ && convert_to_void (result, ICV_STATEMENT, tf_none) != error_mark_node)
return result;
location_t loc = cp_expr_loc_or_input_loc (expr);
{
/* Replay the substitution error. */
inform (loc, "the required expression %qE is invalid, because", expr);
- tsubst_expr (expr, args, tf_error, in_decl, false);
+ if (result == error_mark_node)
+ tsubst_expr (expr, args, tf_error, in_decl, false);
+ else
+ convert_to_void (result, ICV_STATEMENT, tf_error);
}
else
inform (loc, "the required expression %qE is invalid", expr);
+2020-04-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/67825
+ * g++.dg/concepts/diagnostic10.C: New test.
+ * g++.dg/cpp2a/concepts-pr67178.C: Adjust dg-message.
+
2020-04-21 Patrick Palka <ppalka@redhat.com>
PR c++/94549
* g++.dg/concepts/inherit-ctor3.C: Adjust expected diagnostics.
- * g++.dg/cpp2a/concepts-inherit-ctor4.C: New test.
+ * g++.dg/cpp2a/concepts-inherit-ctor4.C: Likewise.
* g++.dg/cpp2a/concepts-inherit-ctor8.C: New test.
2020-04-21 Jonathan Wakely <jwakely@redhat.com>
--- /dev/null
+// PR c++/67825
+// { dg-do compile { target concepts } }
+// { dg-additional-options "-fconcepts-diagnostics-depth=2" }
+
+template<typename T>
+ requires requires (T t) { t.f; } // { dg-error "invalid use of non-static member function" }
+void foo() { }
+
+struct S
+{
+ int f();
+};
+
+void
+bar()
+{
+ foo<S>(); // { dg-error "unsatisfied constraints" }
+}
template<typename T>
concept C1 = requires (C1 auto x) { // { dg-error "not been declared|placeholder|two or more|in requirements" }
x; // { dg-error "not declared" }
- { x } -> c; // { dg-message "not declared|does not satisfy" }
+ { x } -> c; // { dg-message "is invalid" }
};
template<typename T>