From patchwork Wed Oct 3 12:18:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 978279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-486871-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="G4AHUwM8"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="y5/nuHqK"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QFRp4HTVz9s8J for ; Wed, 3 Oct 2018 22:18:44 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=tJfKJtSrBDM+h7n0R7ivmRRTmmefK0HDJya+HuRvwosJR+GvMO tVPXDerHeyMjABY0Fyi/GcH7mQPgPurMMkjbCgvE1VBYOao9wm1aTDPiTUZO2HO1 ozIjo9oZcXltU/jV/rQBhULjU4iYcPYUXJPmfr46gXBIn48ugjZaS8Vok= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=syLCbAQkayNXrBNBc0vuNTy2ax0=; b=G4AHUwM8uZYwHAa5oWqf MR/MLphSgEdUxxgWmLRFT+7yAq72aUSzHH0mMOTcMY1+IKPypXbtwI1p7K6B7Mi5 WDF6+h4q/5xRr53gDFT/jfDU5Gvr1tijY9GbD+4rYySGY+usTMAcqai4ZVi6Zp/A w1HS2RXdmc2d3OEvDJGYq3Q= Received: (qmail 7362 invoked by alias); 3 Oct 2018 12:18:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 7353 invoked by uid 89); 3 Oct 2018 12:18:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:finish_ X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 Oct 2018 12:18:35 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w93CEd4j152373; Wed, 3 Oct 2018 12:18:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=CYchXp8GWNR3MP/aAJnNtwZc/9/Ka88VpDn8i/be0qw=; b=y5/nuHqK8uZ14cPO/eztfTIPvrxw+vWvBsFESk5REmrHYBkeAsS9rm1xFHtstpXPAbY6 RLmGiT71d6/b/aY15dIbX7gvdfu8rmaGa8P62On3ui85fgq9sERR4et3G9IoCNtHzaUL cfwoyncgs7F9o+jN98Y+/bqNibOM8POc5rfuZprcoNeJSN4oqMfVzMpNErY+IEvfEEs3 yyoGFAYdKkqziNMt5mFpFx6SqKaPMuhIRvMi2rfzAwVei5RJYJ6hLR606gumNBdhWRxy br78jDuHiufTD2BqmPQr+xF29/Sq56DlUVcJncX3yomw9FB0hAzs1l8/HkNn1k5igmnG lg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2mt0ttuh01-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 Oct 2018 12:18:33 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w93CIWmt028815 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 3 Oct 2018 12:18:32 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w93CIWk3029730; Wed, 3 Oct 2018 12:18:32 GMT Received: from [192.168.1.4] (/79.36.221.66) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 03 Oct 2018 12:18:31 +0000 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 71140 ("[concepts] ill-formed nested-requirement lacking a semicolon not rejected") Message-ID: Date: Wed, 3 Oct 2018 14:18:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, a simple issue, we weren't correctly implementing 7.5.7.4 on the terminating semicolon. Tested x86_64-linux. Thanks, Paolo. /////////////////// /cp 2018-10-03 Paolo Carlini PR c++/71140 * parser.c (cp_parser_compound_requirement): Require a terminating semicolon, per 7.5.7.4. /testsuite 2018-10-03 Paolo Carlini PR c++/71140 * g++.dg/concepts/pr71140.C: New. * g++.dg/concepts/pr67595.C: Adjust. Index: cp/parser.c =================================================================== --- cp/parser.c (revision 264805) +++ cp/parser.c (working copy) @@ -26110,10 +26114,11 @@ cp_parser_compound_requirement (cp_parser *parser) return finish_compound_requirement (expr, type, noexcept_p); } -/* Parse a nested requirement. This is the same as a requires clause. +/* Parse a nested requirement. This is the same as a requires clause followed + by a semicolon. nested-requirement: - requires-clause */ + requires-clause ';' */ static tree cp_parser_nested_requirement (cp_parser *parser) { @@ -26121,6 +26126,9 @@ cp_parser_nested_requirement (cp_parser *parser) tree req = cp_parser_requires_clause (parser); if (req == error_mark_node) return error_mark_node; + + cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON); + return finish_nested_requirement (req); } Index: testsuite/g++.dg/concepts/pr67595.C =================================================================== --- testsuite/g++.dg/concepts/pr67595.C (revision 264805) +++ testsuite/g++.dg/concepts/pr67595.C (working copy) @@ -2,7 +2,7 @@ template concept bool allocatable = requires{{new X}->X * }; template concept bool semiregular = allocatable; -template concept bool readable = requires{requires semiregular}; +template concept bool readable = requires{requires semiregular;}; template int weak_input_iterator = requires{{0}->readable}; template bool input_iterator{weak_input_iterator}; // { dg-warning "narrowing conversion" } template bool forward_iterator{input_iterator}; Index: testsuite/g++.dg/concepts/pr71140.C =================================================================== --- testsuite/g++.dg/concepts/pr71140.C (nonexistent) +++ testsuite/g++.dg/concepts/pr71140.C (working copy) @@ -0,0 +1,8 @@ +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +template +concept bool C = requires(T t) { + requires true // { dg-error "expected .\;. before .\}. token" } +}; +static_assert(C, "");