On 09/29/2014 10:55 AM, Andrew Sutton wrote:
Jason, do you want to review this before I commit? This is a pretty small patch.

No need to wait for review before committing to the branch.

+  // 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 not %qT",
+              fn, boolean_type_node);

This should say what the deduced type is.

+  // Check that the function is comprised of only a single
+  // return statements.

*statement

+template<typename T>
+  concept bool Tuple() { // { dg-error "multiple statements" }
+    static_assert(T::value, "");
+    return true;
+  }

Hmm, have we actually discussed this in core review? I'm not seeing it on the wiki. Constexpr started out this way too, and allowing static_assert was added pretty fast. C++11 said

its function-body shall be = delete, = default, or a compound-statement that contains only
— null statements,
— static_assert-declarations
— typedef declarations and alias-declarations that do not define classes or enumerations,
— using-declarations,
— using-directives,
— and exactly one return statement;

Is there a reason we want to be more strict than this for concept functions?

Jason

Reply via email to