===================================================================
@@ -0,0 +1,7 @@
+// { dg-options "-std=c++1z" }
+
+template<typename T>
+ concept auto C1() { return 0; } // { dg-error "deduced return type" }
+
+template<typename T>
+ concept int C2() { return 0; } // { dg-error "return type" }
===================================================================
@@ -280,11 +280,6 @@ check_function_concept (tree fn)
{
location_t loc = DECL_SOURCE_LOCATION (fn);
- // If fn was declared with auto, make sure the result type is bool.
- if (FNDECL_USED_AUTO (fn) && TREE_TYPE (fn) != boolean_type_node)
- error_at (loc, "deduced type of concept definition %qD is %qT and not %qT",
- fn, TREE_TYPE (fn), boolean_type_node);
-
// Check that the function is comprised of only a single
// return statement.
tree body = DECL_SAVED_TREE (fn);
===================================================================
@@ -7525,9 +7525,13 @@ check_concept_fn (tree fn)
if (DECL_ARGUMENTS (fn))
error ("concept %q#D declared with function parameters", fn);
- // The result type must be convertible to bool.
- if (!same_type_p (TREE_TYPE (TREE_TYPE (fn)), boolean_type_node))
- error ("concept %q#D result must be bool", fn);
+ // The declared return type of the concept shall be bool, and
+ // it shall not be deduced from it definition.
+ tree type = TREE_TYPE (TREE_TYPE (fn));
+ if (is_auto (type))
+ error ("concept %q#D declared with a deduced return type", fn);
+ else if (type != boolean_type_node)
+ error ("concept %q#D with return type %qT", fn, type);
}
/* Helper function. Replace the temporary this parameter injected