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.129.124]) by sourceware.org (Postfix) with ESMTPS id 0396C3858C00 for ; Mon, 26 Sep 2022 12:59:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0396C3858C00 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=1664197198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vqtRbVdbRPa7AawGjgpD9s/UKNObMrlkz92+16/F6G0=; b=bhuRtBMrC/3gdrl1arRzFRqolehQ4eEoJmyAG/5ZGPYeHktIZxrcuSOEARytxAn14ObD+P UlnZoqhiTMc0F1bMTwtOWdqsJYm1Ba+OXV6CQMzpeuHLOiWnNXLpIBpyxhnpnEjNJo/dl9 M7NvxbW7/3CDu58pGjLxWOb52hL+ajc= 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-537-IUBzy4GCMtOi4CMC6LVy8g-1; Mon, 26 Sep 2022 08:59:55 -0400 X-MC-Unique: IUBzy4GCMtOi4CMC6LVy8g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5C30185A794; Mon, 26 Sep 2022 12:59:54 +0000 (UTC) Received: from localhost (unknown [10.33.36.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D14617583; Mon, 26 Sep 2022 12:59:54 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Add #if around non-C++03 code in std::bitset [PR107037] Date: Mon, 26 Sep 2022 13:59:53 +0100 Message-Id: <20220926125953.2149422-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP,URI_HEX 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: Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/107037 * include/std/bitset (_Base_bitset::_M_do_reset): Use preprocessor conditional around non-C++03 code. * testsuite/20_util/bitset/107037.cc: New test. --- libstdc++-v3/include/std/bitset | 5 +++-- libstdc++-v3/testsuite/20_util/bitset/107037.cc | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/bitset/107037.cc diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset index 6dbc58c6429..1a551cf9785 100644 --- a/libstdc++-v3/include/std/bitset +++ b/libstdc++-v3/include/std/bitset @@ -182,13 +182,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX14_CONSTEXPR void _M_do_reset() _GLIBCXX_NOEXCEPT { +#if __cplusplus >= 201402L if (__builtin_is_constant_evaluated()) { for (_WordT& __w : _M_w) __w = 0; return; } - +#endif __builtin_memset(_M_w, 0, _Nw * sizeof(_WordT)); } @@ -1680,7 +1681,7 @@ _GLIBCXX_END_NAMESPACE_VERSION #endif // C++11 -#ifdef _GLIBCXX_DEBUG && _GLIBCXX_HOSTED +#if defined _GLIBCXX_DEBUG && _GLIBCXX_HOSTED # include #endif diff --git a/libstdc++-v3/testsuite/20_util/bitset/107037.cc b/libstdc++-v3/testsuite/20_util/bitset/107037.cc new file mode 100644 index 00000000000..b4560dd3775 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/bitset/107037.cc @@ -0,0 +1,7 @@ +// { dg-options "-std=c++03" } +// { dg-do compile } +// PR libstdc++/107037 bitset::_M_do_reset fails for strict -std=c++03 mode +#include +template class std::bitset<0>; +template class std::bitset<1>; +template class std::bitset<100>; -- 2.37.3