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 241283858C53 for ; Wed, 4 May 2022 15:55:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 241283858C53 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-614-W1pFas7mMA6sLGNZOYUDog-1; Wed, 04 May 2022 11:55:31 -0400 X-MC-Unique: W1pFas7mMA6sLGNZOYUDog-1 Received: by mail-qk1-f199.google.com with SMTP id bk23-20020a05620a1a1700b0067b32f93b90so1167979qkb.16 for ; Wed, 04 May 2022 08:55:31 -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=QicVsM3GqlRlZOt1jOVV6YjbIqJ2O9whu7wuJC+VifQ=; b=hGk1ayBsKGrkUfVsRBYGjUcOhwf8jrPld5rv5khgr3bc2xf0XOtGROlc7PGgzmw+kE OyfgudUyVWukGqM+aL/rS7G/KOUBWmAShZZt2y7GCN3ch0t/2MoGSfDwttQGW2Fku1Di 4vSjShFzEvVPxlQ4yIaVWMOU+rBjoPHZhvRPCUrBtJzOeuvzNav6jMwtRcY9QOw+9wUu pUvib9qNdHil7F77Zh/N62gQEkgyPyC+C8RNbp9+w6cElEOpY5PMjCdKJRH5CmAdV7JS GCzzep3FPzPgFClkM70mOZRGlsPI1iG+tbQenrcLKH87uRcGMztZc5gch5ETW+REsOmc 31ng== X-Gm-Message-State: AOAM5312ATV/IQxQzw8MYGqE51bTaslNGJoJiz+ugcXMoxqHzm+oLMVx o813+jCJlMmkq3DURRRYJW3l+b57KPVI+3awUXA3CVH3oNPWRf8LVL2jlMW4t70YzSQbIFSze3t uT79vmUmGXuwvsPKyvQ== X-Received: by 2002:ad4:5de7:0:b0:45a:b6b0:67c with SMTP id jn7-20020ad45de7000000b0045ab6b0067cmr2308873qvb.21.1651679731168; Wed, 04 May 2022 08:55:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWQf1MgWg7+dtpFRiMuwnsLP/89TbN2bZSL8db/jN9u406NGPOeO4RDSOpIiEXVaYe1ruKKA== X-Received: by 2002:ad4:5de7:0:b0:45a:b6b0:67c with SMTP id jn7-20020ad45de7000000b0045ab6b0067cmr2308848qvb.21.1651679730871; Wed, 04 May 2022 08:55:30 -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 j24-20020ac86658000000b002f39b99f681sm7596097qtp.27.2022.05.04.08.55.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 May 2022 08:55:29 -0700 (PDT) Message-ID: Date: Wed, 4 May 2022 11:55:28 -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: Marek Polacek Cc: Jakub Jelinek , 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.1 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: Wed, 04 May 2022 15:55:34 -0000 On 5/4/22 11:15, Marek Polacek wrote: > On Tue, May 03, 2022 at 04:46:11PM -0400, Jason Merrill wrote: >> 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. > > So do you want me to make any changes or is the patch OK as-is? OK.