From patchwork Thu Oct 4 10:32:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 978731 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-486937-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="EKHAj7+u"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="w8QBG+Cb"; 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 42Qq3K3qB5z9s8T for ; Thu, 4 Oct 2018 20:32:59 +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=p2qjtdcTSoVhosVSDhyAnhHuBTcN07gzNNZNRFznZJ0X1tYnWk fF8QwfDj5xk5cWPg9eaARazUQmGhXozpWATVtH/p0gtjBe7qQsO2yLB3l4nBUvwS SvP9ti1xPHrO8T8J+eB+DFXVhDuBzgc3YlHveoEWE0f+3f8jMPe26qE5w= 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=Mk5lwb8W15HhynGMQqeDVRBgIsM=; b=EKHAj7+uJgaxWiZhv8ZO j69iDOxUTXfhIJLRjLnFrMembzmQw9nDOEIDaaT5x9gN9IXieXmie6M72csnU+aF BbyQNhigmQvkmTAfMjfLkLE2B4N4QbyldmsxPjiW1o7ewkAgR/eIQQb4NdiZDsoz PVtacaGS9/cvZ9Yewf8E9jA= Received: (qmail 97897 invoked by alias); 4 Oct 2018 10:32:51 -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 97885 invoked by uid 89); 4 Oct 2018 10:32:51 -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=recovery X-HELO: userp2120.oracle.com Received: from userp2120.oracle.com (HELO userp2120.oracle.com) (156.151.31.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Oct 2018 10:32:49 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w94ATCdK023932; Thu, 4 Oct 2018 10:32:48 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=6B1+wGT+eTBqD2nsFgqYx5lr0Kzz7j0ZyOJSnw166Gc=; b=w8QBG+Cbj7hzdzCC+8qri91BymuaXV/7Y/LF4aKmejyFTAOFRGD2bQj4jjrMkRmZHPHk VtYI97Gks911VVvn5TdGa8Asd5IGB3i0VV1AMcF5ympfswVN2G4CtjnD0U5x3fevt807 tHhRpV0HQ50p2IK4BsHEYNu2dQyMhDGnKrbi9ABDeFgKm79fikfMLHpPRuA8aj6dWKUU 9PBpSwsB1UJnniyDr4XEtZEi8VFwju8m4WMcDp5SKXwaOUCegWpFiEjKSqUoUyE4vlNt gyI2ymLMlUqefX8WaUDwzE77ZeLXF9qlpp7gdXO5ZXs0l9ly48Wy9hLvsyJxEsoLeKxe iQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2mt21rb63v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Oct 2018 10:32:47 +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 w94AWlEp020743 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Oct 2018 10:32:47 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w94AWkrZ006118; Thu, 4 Oct 2018 10:32:46 GMT Received: from [192.168.1.4] (/79.37.217.100) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 04 Oct 2018 10:32:46 +0000 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 71139 ("[concepts] ill-formed compound-requirement lacking a semicolon not rejected") Message-ID: Date: Thu, 4 Oct 2018 12:32:43 +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, yesterday I didn't notice that we have a separate bug for a similar issue affecting cp_parser_compound_requirement. Tested x86_64-linux. Thanks, Paolo. PS: while working on these issues, I noticed that somewhere else in the concepts parsing bits we check the return value of cp_parser_require and, in case, immediately return error_mark_node. That doesn't seem a good idea - and isn't what we do for all the other cp_parser_require semicolon calls - because it normally degrades error recovery when the only bug in the code is the missing semicolon. I mean to further look into that... /////////////////////// /cp 2018-10-04 Paolo Carlini PR c++/71140 * parser.c (cp_parser_compound_requirement): Require a terminating semicolon, per 7.5.7.3. /testsuite 2018-10-04 Paolo Carlini PR c++/71140 * g++.dg/concepts/pr71139.C: New. * g++.dg/concepts/pr67595.C: Adjust. * g++.dg/concepts/diagnostic1.C: Likewise. * g++.dg/concepts/disjunction1.C: Likewise. Index: cp/parser.c =================================================================== --- cp/parser.c (revision 264837) +++ cp/parser.c (working copy) @@ -26108,6 +26112,8 @@ cp_parser_compound_requirement (cp_parser *parser) return error_mark_node; } + cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON); + return finish_compound_requirement (expr, type, noexcept_p); } Index: testsuite/g++.dg/concepts/diagnostic1.C =================================================================== --- testsuite/g++.dg/concepts/diagnostic1.C (revision 264837) +++ testsuite/g++.dg/concepts/diagnostic1.C (working copy) @@ -6,7 +6,7 @@ concept bool SameAs = __is_same_as(T, U); template concept bool R1 = requires (T& t) { - { t.begin() } -> T + { t.begin() } -> T; { t.end() } -> SameAs; }; Index: testsuite/g++.dg/concepts/disjunction1.C =================================================================== --- testsuite/g++.dg/concepts/disjunction1.C (revision 264837) +++ testsuite/g++.dg/concepts/disjunction1.C (working copy) @@ -29,7 +29,7 @@ template concept bool Movable() { } template int Swappable_ = requires { 0; }; template int Swappable(); -template concept bool Dereferencable = requires{{0}}; +template concept bool Dereferencable = requires{{0};}; template using RvalueReferenceType = decltype(0); template int IsValueType; template struct value_type; @@ -39,7 +39,7 @@ requires IsValueType< _t>>; template concept bool Readable() { return Movable() && DefaultConstructible() && - Dereferencable && requires{{0}}; + Dereferencable && requires{{0};}; } template concept bool MoveWritable() { return Movable() && DefaultConstructible() && Index: testsuite/g++.dg/concepts/pr67595.C =================================================================== --- testsuite/g++.dg/concepts/pr67595.C (revision 264837) +++ testsuite/g++.dg/concepts/pr67595.C (working copy) @@ -1,9 +1,9 @@ // { dg-options "-std=c++17 -fconcepts" } -template concept bool allocatable = requires{{new X}->X * }; +template concept bool allocatable = requires{{new X}->X *;}; template concept bool semiregular = allocatable; template concept bool readable = requires{requires semiregular}; -template int weak_input_iterator = requires{{0}->readable}; +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}; template bool bidirectional_iterator{forward_iterator}; Index: testsuite/g++.dg/concepts/pr71139.C =================================================================== --- testsuite/g++.dg/concepts/pr71139.C (nonexistent) +++ testsuite/g++.dg/concepts/pr71139.C (working copy) @@ -0,0 +1,8 @@ +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +template +concept bool C = requires(T t) { + { +t } // { dg-error "expected .\;. before .\}. token" } +}; +static_assert(C, "");