From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30329 invoked by alias); 29 Sep 2014 15:07:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 30308 invoked by uid 89); 29 Sep 2014 15:07:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 29 Sep 2014 15:07:38 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8TF7VcO015497 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 29 Sep 2014 11:07:31 -0400 Received: from [10.10.116.29] ([10.10.116.29]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8TF7Ul9001111; Mon, 29 Sep 2014 11:07:30 -0400 Message-ID: <542975AE.8070701@redhat.com> Date: Mon, 29 Sep 2014 15:07:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: Andrew Sutton , gcc-patches , Roland Bock Subject: Re: [c++-concepts] Check function concept definitions References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2014-09/txt/msg02532.txt.bz2 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 > + 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