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 0BCCA3858427 for ; Fri, 9 Feb 2024 17:55:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0BCCA3858427 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0BCCA3858427 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707501319; cv=none; b=iit8R79+Imc3r37IjVIshkaUmcWz5IhmMXDvmVKCXE+rzAm6MGNcwdy0c0pVZ0PmNM5G/bePsGr5djztS69HKqy38brMkD7nvgA+5Tp7CPft3xyv+3qC3i0cwY2Y1BBuFXgjVNqvf7SfgGQG5R7uDu/8GEmlG/9lCwCPZCDzt0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707501319; c=relaxed/simple; bh=lTAC7JC6MtrhLAcGz3brUxtWDscaEQ1AAfIiRL56TYU=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Q9MJ7hWd5kQpRvaouaNgYugJR1qnb7ydP49J/Je4YyAq+p8WIKQg78vBIgKnXJQSun827sv56cZdn1W/RN7RFgbdv65LVsSaoKlF+JOB4SescAe+Ijc70yiBuqGXLZ+uqikjsncr0+U4kGXlFLZqZgb3BIi7X9D6MoRHv0nLFbI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707501316; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eIMVdV8Gy5cQTBf/1TXljSlJ8wSTzOD6fJ3Y3ROA7/8=; b=GXsA709OFfJNTMyFve2TLa3wqqSW0vQk60JzJ6VlTKhPysKjjxXM1OmPPu7BMlum5FomT3 mwJX0sLEJ82va+YH9TJstVkocy3VZAFFhwxP2RebcC2JuXWyG0cFhWKYzRYWL3lh3ahY0I dOsscTH1yRM0MaC6r0TduI0bGNdm6iU= Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-552-UgrCgbEWPwek-UG-eYaULA-1; Fri, 09 Feb 2024 12:55:15 -0500 X-MC-Unique: UgrCgbEWPwek-UG-eYaULA-1 Received: by mail-vk1-f200.google.com with SMTP id 71dfb90a1353d-4c01a351c42so362066e0c.2 for ; Fri, 09 Feb 2024 09:55:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707501315; x=1708106115; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eIMVdV8Gy5cQTBf/1TXljSlJ8wSTzOD6fJ3Y3ROA7/8=; b=nbgpGPk1F5puiqKdjH8Y2B3zCstj0Cz1O6DWJMTfIojx9edhnVxDCgOb7cNQKgaNG0 L0iZNSgeYIKMKl2WrJQlX3S3XtNDR4Jm5VpJthiZVrmBfgN7QqEVbVKEtrkh/WR54WmJ plDjugVjaL3zbsVKqRimy7kgvACUQHL44YsK8dWAqQathi1kp67aZVz2vCeCnESwIKsZ fERmss9sAWVMImJHBpaOlxhC5UmawzZb9U6HdxeOOQPlfqfpZRwGby5amNZ+Ytwm91cT HdbGdTRtZCe61SAFr/xBl7F1QBHPOPLkbhqs9HQUFbVuGfpSJN0iP68z4DB1Z/fzyrrq Ql2g== X-Gm-Message-State: AOJu0Yxz3HOB/pgUZOsLZQ2lPEvXW/xhW8CIz1iHHJqN0SdmiO1RiQIQ vVZdNsXd6gPU9XySGFZsJBK98sGdl7BSFM4UKvJ0cukJ6k/lTxt8YKH7FvZDAZeDfKOZZqBcGK/ 9LqBFSM/Fm9dMcY9msaYtRsOqgm6KRDiri2XPrI28aJGOBIafkb4AGkI= X-Received: by 2002:a1f:da03:0:b0:4c0:1cc8:8821 with SMTP id r3-20020a1fda03000000b004c01cc88821mr75768vkg.9.1707501315033; Fri, 09 Feb 2024 09:55:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfYaVIHxc9tKEG764kYiWok5pggxr9HwrmDKg3ztvy8qoMA+h0GntnWMhf5YNteWYzL/cPsg== X-Received: by 2002:a1f:da03:0:b0:4c0:1cc8:8821 with SMTP id r3-20020a1fda03000000b004c01cc88821mr75752vkg.9.1707501314709; Fri, 09 Feb 2024 09:55:14 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVBi9UbP+YwOhWaxnzpnQbcyvLy1+rk8lZxhlHOKeo4tgLuuGu5Ixl9dJY9w1sxMOUZgTprkB/jaaszsOD6o0dV+j0JdgvFct55AWbFxpfp16Ov Received: from [192.168.1.130] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id lv7-20020a056214578700b006869d54c818sm1006215qvb.109.2024.02.09.09.55.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 09:55:14 -0800 (PST) Message-ID: Date: Fri, 9 Feb 2024 12:55:13 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] c++: Don't advertise cxx_constexpr_string_builtins [PR113658] To: Alex Coplan , Marek Polacek Cc: gcc-patches@gcc.gnu.org, Nathan Sidwell References: 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=-11.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,LIKELY_SPAM_BODY,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 2/2/24 10:45, Alex Coplan wrote: > On 02/02/2024 09:34, Marek Polacek wrote: >> On Fri, Feb 02, 2024 at 10:27:23AM +0000, Alex Coplan wrote: >>> Bootstrapped/regtested on x86_64-apple-darwin, OK for trunk? >>> >>> Thanks, >>> Alex >>> >>> -- >8 -- >>> >>> When __has_feature was introduced for GCC 14, I included the feature >>> cxx_constexpr_string_builtins, since of the relevant string builtins >>> that GCC implements, it seems to support constexpr evaluation of those >>> builtins. >>> >>> However, as the PR shows, GCC doesn't implement the full list of >>> builtins in the clang documentation. After enumerating the builtins, >>> the clang docs [1] say: >>> >>>> Support for constant expression evaluation for the above builtins can >>>> be detected with __has_feature(cxx_constexpr_string_builtins). >>> >>> and a strict reading of this would suggest we can't really support >>> constexpr evaluation of a builtin if we don't implement the builtin in >>> the first place. >>> >>> So the conservatively correct thing to do seems to be to stop >>> advertising the feature altogether to avoid failing to build code which >>> assumes the presence of this feature implies the presence of all the >>> builtins listed in the clang documentation. >>> >>> [1] : https://clang.llvm.org/docs/LanguageExtensions.html#string-builtins >>> >>> gcc/cp/ChangeLog: >>> >>> PR c++/113658 >>> * cp-objcp-common.cc (cp_feature_table): Remove entry for >>> cxx_constexpr_string_builtins. >>> >>> gcc/testsuite/ChangeLog: >>> >>> PR c++/113658 >>> * g++.dg/ext/pr113658.C: New test. >> >>> diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc >>> index f06edf04ef0..85dde0459fa 100644 >>> --- a/gcc/cp/cp-objcp-common.cc >>> +++ b/gcc/cp/cp-objcp-common.cc >>> @@ -110,7 +110,6 @@ static constexpr cp_feature_info cp_feature_table[] = >>> { "cxx_alignof", cxx11 }, >>> { "cxx_attributes", cxx11 }, >>> { "cxx_constexpr", cxx11 }, >>> - { "cxx_constexpr_string_builtins", cxx11 }, >>> { "cxx_decltype", cxx11 }, >>> { "cxx_decltype_incomplete_return_types", cxx11 }, >>> { "cxx_default_function_template_args", cxx11 }, >>> diff --git a/gcc/testsuite/g++.dg/ext/pr113658.C b/gcc/testsuite/g++.dg/ext/pr113658.C >>> new file mode 100644 >>> index 00000000000..f4a34888f28 >>> --- /dev/null >>> +++ b/gcc/testsuite/g++.dg/ext/pr113658.C >> >> Might be better to name this has-feature2.C >> >> Please include >> // PR c++/113658 > > Can do. OK with those two testcase adjustments. Jason