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 2FC9B38493E0 for ; Thu, 17 Nov 2022 01:12:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2FC9B38493E0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668647543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FSV9/9Ev6MTuBH75qflml9lYLyUGFgWMboZtbbTrJ8Q=; b=T/tspQzX7hUp2jF5+3l46LaF9/cs9eoot93cSqG+XvXyFVyYllkO6TeKj2BRYuCutyKQAx V/3VMTD3AUiOQLoYQY7BiT+VJwJRyYOFq80wOGkf+XnM53PjdXI6K3SiKpMuPjOvEzC8Ez DWRZ/i2H6cemf2c/B0m4znstBFiuy5A= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-638-dXJlccjTPG--bGnQD9Dopw-1; Wed, 16 Nov 2022 20:12:22 -0500 X-MC-Unique: dXJlccjTPG--bGnQD9Dopw-1 Received: by mail-qt1-f197.google.com with SMTP id y19-20020a05622a121300b003a526e0ff9bso377413qtx.15 for ; Wed, 16 Nov 2022 17:12:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FSV9/9Ev6MTuBH75qflml9lYLyUGFgWMboZtbbTrJ8Q=; b=B/HNTPZ+vi45X02RL6ZUgbzi1/Der+ZZs/Zp7s5kDabWuD4EyNoqp1QeLLTbTpR+wm 3x0ZYhqRuQlxRaTx/PxEgYYGSGZPelybmfzMUzomNVZhyUHNjRMkQ2cIYAOD3ZT6EuzT vJZXLHYvLfaH+SspLkcWiPHf4VXeYlZ9jCgaHbXS4Va5tQO4YVxaF3QFOssdqftsbzbx eyzUdWW2veievh/mENi5DHz6R7eY/4m5wLiU1GA51iukqhS+cF9hQyR4BsFRsbu7Fny6 xbbRKF5EVT/aG95MWv68vjoFog5U1V3PcXQx6UnfGsO+UhTE5oqy9+WtQbQGGYAlLCnl btkw== X-Gm-Message-State: ANoB5pkd6DP9rn0yuTQVvRTVYH4p9JtxjilD+iNVL35dBbIvBmK2fpSX zU7lLiN5mEavSaarvdj1MWXlrN8h5M9Debow+ImG0+laaZnwq02iMVQLqbEPHqUbo8JmoorQ9zr Qx11uHyllTpFETokSeg== X-Received: by 2002:ac8:4e31:0:b0:3a5:d3d:2528 with SMTP id d17-20020ac84e31000000b003a50d3d2528mr416755qtw.619.1668647540168; Wed, 16 Nov 2022 17:12:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf4l9960E+dr+wAc7gBrbf3lXV0YCAgvpfciReZtyN+S5bTYaqXA9h5ybMdGbJanW5iYzJ+ekg== X-Received: by 2002:ac8:4e31:0:b0:3a5:d3d:2528 with SMTP id d17-20020ac84e31000000b003a50d3d2528mr416737qtw.619.1668647539918; Wed, 16 Nov 2022 17:12:19 -0800 (PST) Received: from redhat.com (2603-7000-9500-2e39-0000-0000-0000-1db4.res6.spectrum.com. [2603:7000:9500:2e39::1db4]) by smtp.gmail.com with ESMTPSA id o16-20020a05620a2a1000b006fa617ac616sm11526450qkp.49.2022.11.16.17.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 17:12:19 -0800 (PST) Date: Wed, 16 Nov 2022 20:12:17 -0500 From: Marek Polacek To: Jason Merrill Cc: GCC Patches Subject: Re: [PATCH] c++: Reject UDLs in certain contexts [PR105300] Message-ID: References: <20221112165331.349041-1-polacek@redhat.com> <95aefa6c-5460-3e40-1e07-c2ebd39e3559@redhat.com> MIME-Version: 1.0 In-Reply-To: <95aefa6c-5460-3e40-1e07-c2ebd39e3559@redhat.com> User-Agent: Mutt/2.2.7 (2022-08-07) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Nov 16, 2022 at 08:22:39AM -0500, Jason Merrill wrote: > On 11/15/22 19:35, Marek Polacek wrote: > > On Tue, Nov 15, 2022 at 06:58:39PM -0500, Jason Merrill wrote: > > > On 11/12/22 06:53, Marek Polacek wrote: > > > > In this PR, we are crashing because we've encountered a UDL where a > > > > string-literal is expected. This patch makes the parser reject string > > > > and character UDLs in all places where the grammar requires a > > > > string-literal and not a user-defined-string-literal. > > > > > > > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > > > Since the grammar has > > > > > > user-defined-string-literal : > > > string-literal ud-suffix > > > > > > maybe we want to move the UDL handling out to a cp_parser_udl_string_literal > > > that calls cp_parser_string_literal? > > > > Umm, maybe, but the UDL handling code seems to be too entrenched in > > cp_parser_string_literal and I don't think it's going to be easy to extract > > it :/. > > Fair enough; maybe a wrapper, then? As in, have a cp_parser_udl_string_literal wrapper that calls cp_parser_string_literal with udl_ok=true, rename cp_parser_string_literal, introduce a new cp_parser_string_literal wrapper that passes udl_ok=false? One problem with cp_parser_udl_string_literal is that it's too similar to cp_parser_userdef_string_literal, which would be confusing, I think. Marek