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 4A774383FB90 for ; Wed, 31 Aug 2022 14:35:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4A774383FB90 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=1661956534; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=izuwhXHymOC1Vv/NTckDyuwGUtwkf9jWlMa4bQ8cbXI=; b=afa2Zftsc90+LLtxrc60f4ILWDNhlhgQ5V/BguIPqPit4ntvnkUJe7Jub3CFeG8PKy2GRe t9ov19JWx9QPMZN2cDimTnjCJHHlmJNIIWfnBcXEPvEoIHeEMuwlkSey9I4eQIgSsfs+iR tkuQ+Ls9YvVBrPeOZRXoJdSPX7eES48= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-284-BPphTWjFOOmc20PVkcY3rQ-1; Wed, 31 Aug 2022 10:35:32 -0400 X-MC-Unique: BPphTWjFOOmc20PVkcY3rQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 83F56811E80; Wed, 31 Aug 2022 14:35:32 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 405F0C15BB3; Wed, 31 Aug 2022 14:35:32 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 27VEZTbi205813 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 31 Aug 2022 16:35:29 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 27VEZS2X205812; Wed, 31 Aug 2022 16:35:28 +0200 Date: Wed, 31 Aug 2022 16:35:28 +0200 From: Jakub Jelinek To: Joseph Myers , Jason Merrill , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] c++, v2: Implement C++23 P2071R2 - Named universal character escapes [PR106648] Message-ID: Reply-To: Jakub Jelinek References: <4fcd7e74-6f1c-dbec-a42c-e4e3fd13470b@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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 Tue, Aug 30, 2022 at 11:37:07PM +0200, Jakub Jelinek via Gcc-patches wrote: > If > #define z(x) 0 > #define a z( > int x = a\NARG); > is valid in C and C++ <= 20 then > #define z(x) 0 > #define a z( > int x = a\N{LATIN SMALL LETTER A WITH ACUTE}); > is too and shall preprocess to int x = 0; too. > Which would likely mean that we want to only handle it in identifiers if > in C++23 and not actually treat it as an extension except in literals. > > Jason, your toughts about that? Trying to read again the current C++23 wording, I'm afraid that outside of the literals both the delimited escape sequences and named universal characters are a complete nightmare for diagnostics. Because the wording is that only valid universal character names are replaced by their corresponding characters. Ill-formed is only if the hexadecimal digit sequences are valid but represent a number that is not a UCS scalar value, or represent a control character. So, I think we can't reject even #define z(x) 0 #define a z( int b = a\u{}); int c = a\u{); int d = a\N{}); int e = a\N{); int f = a\u123); int g = a\U1234567); int h = a\N{LATIN SMALL LETTER A WITH ACUT}); Couldn't C++23 say at least that if a valid named-universal-character doesn't designate any character then the program is ill-formed? So, we could reject the int h case above and accept silently the others? GCC 12 accepts all these without warning, current trunk rejects the h case with error and accepts the rest without a warning, clang trunk emits warnings on all cases but the last and rejects the h case with an error. Jakub