From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id AA5773858C51 for ; Tue, 3 May 2022 20:46:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AA5773858C51 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-610-d8rF1ktpNNa5HeDK7C8Pzw-1; Tue, 03 May 2022 16:46:19 -0400 X-MC-Unique: d8rF1ktpNNa5HeDK7C8Pzw-1 Received: by mail-qv1-f70.google.com with SMTP id kd30-20020a056214401e00b0045a96ed0d4aso3799840qvb.17 for ; Tue, 03 May 2022 13:46:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=ZqFvVroSOOF79gbGokljkvmsJxCZQtiU26wAtbYR9tM=; b=dIhxQsK91HoB+VLZ1d/lLyCztSARswW8lHARexigqH6o3EWlGltVKgye59sQRWJGNg eClsdGlJG986aV3r71pNCUUdsPgWsUZmE8LYoMIovSurnH8QS6T13c3X42YghVCS2r/l pg502+aVM7MGSeO9oyt8gdLxiVY7NRwfOL24agJtYlUrHti1OaYWuSwt4UyvJ9kJ6wQw Stl0fb+xRUSH2Lgnc3TxasMOoYAP1e68Y3jggTq4FUUSLp2fUyxumQ4kEDxoQMF3nuYS IkAMNz6EVCJ86P8Pj9oF61PvbcbRKjq7psrDWRSC2/I1CC4lF07ekTCpEcQQLcb+g9Pr t5MQ== X-Gm-Message-State: AOAM530BU6Lza1XFvxV9d5VuCN+/zgXHewLxGKEtLkL03g3RrHbx0GUR KOzqD25bKwPsQ7IqW/qobalhtV+yc6M/T0UqLkCu3Pg8lLlcB0lLie7hYH+ilK417bkx44Xg0Ue VgpeZH16+tboi8ppw5w== X-Received: by 2002:ad4:5cc8:0:b0:45a:8a4c:9d1e with SMTP id iu8-20020ad45cc8000000b0045a8a4c9d1emr9930980qvb.97.1651610773588; Tue, 03 May 2022 13:46:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXud4oTle8uC8USRSCVNPEfZ2yt+XC84vzW2oiZs/GXK3VuOHbDohtmsYOgEIwc0adufGy4g== X-Received: by 2002:ad4:5cc8:0:b0:45a:8a4c:9d1e with SMTP id iu8-20020ad45cc8000000b0045a8a4c9d1emr9930963qvb.97.1651610773247; Tue, 03 May 2022 13:46:13 -0700 (PDT) Received: from [192.168.1.100] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id b19-20020a05620a089300b0069fc13ce22dsm6166556qka.94.2022.05.03.13.46.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 May 2022 13:46:12 -0700 (PDT) Message-ID: Date: Tue, 3 May 2022 16:46:11 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH] c++: parse error with >= in template argument list [PR105436] To: Jakub Jelinek Cc: Marek Polacek , GCC Patches References: <20220502161903.30922-1-polacek@redhat.com> <0fecc83e-6765-6fc9-bb8c-13e0c147f3af@redhat.com> From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2022 20:46:22 -0000 On 5/3/22 16:43, Jakub Jelinek wrote: > On Tue, May 03, 2022 at 04:26:51PM -0400, Jason Merrill wrote: >> On 5/2/22 12:19, Marek Polacek wrote: >>> This patch fixes an oversight whereby we treated >= as the end of >>> a template argument. This causes problems in C++14, because in >>> cp_parser_template_argument we go different ways for C++14 and C++17: >>> >>> /* It must be a non-type argument. In C++17 any constant-expression is >>> allowed. */ >>> if (cxx_dialect > cxx14) >>> goto general_expr; >>> >>> so in this testcase in C++14 we get "N" as the template argument but in >>> C++17 it is the whole "N >= 5" expression. So in C++14 the remaining >>> ">= 5" triggered the newly-added diagnostic. >> >> Hmm, I think >>= is questionable as well, as it could resolve to a constexpr >> operator>>=. Seems like the two calls to > > The template argument is a constant-expression and >>= can't appear non-nested > in constant-expression non-terminal, can it? Ah, true, a constant-expression is a conditional-expression, which can't involve an assignment operator. Jason