From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id A02BD385783F; Thu, 14 Sep 2023 13:42:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A02BD385783F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694698952; bh=tndr2/2AZhOWR2yWhNhaokjIwLjddkFzLA3uxLiMAf4=; h=From:To:Subject:Date:From; b=ilcy49yJaavULAOueo4LBtZo1vZKDqVYgjXwR0kwyMLcPpBuHJ/+xeBuVoE/n9YQy zIFr1GiffBPup6oRrtJPQ0eGd+lRKFChfb8Cj5vvr7sog3PvMnHv9Z+P89fQiTz/m7 NrDmGl5SBDUVj2tpEkf9Zl1/ofq6iTB7t+oBPRIg= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-11008] libstdc++: Add workaround for std::make_integer_sequence bug [PR111357] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 68458462525bce5afeeac2324566453c6f776580 X-Git-Newrev: 27fce25cc07f7efe11db05eb2fe74a465c41475f Message-Id: <20230914134232.A02BD385783F@sourceware.org> Date: Thu, 14 Sep 2023 13:42:32 +0000 (GMT) List-Id: https://gcc.gnu.org/g:27fce25cc07f7efe11db05eb2fe74a465c41475f commit r11-11008-g27fce25cc07f7efe11db05eb2fe74a465c41475f Author: Jonathan Wakely Date: Thu Sep 14 09:18:34 2023 +0100 libstdc++: Add workaround for std::make_integer_sequence bug [PR111357] The compiler bug has been fixed on trunk, but we need this workaround on the branches. libstdc++-v3/ChangeLog: PR c++/111357 * include/std/utility (make_integer_sequence): Add cast. * testsuite/20_util/integer_sequence/pr111357.cc: New test. (cherry picked from commit 7b0abd4a8ee9d2057febe443de67009dcdfe7574) Diff: --- libstdc++-v3/include/std/utility | 2 +- .../testsuite/20_util/integer_sequence/pr111357.cc | 34 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index f54f75b4d38..7ebb8a552c1 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -331,7 +331,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __has_builtin(__make_integer_seq) = __make_integer_seq; #else - = integer_sequence<_Tp, __integer_pack(_Num)...>; + = integer_sequence<_Tp, __integer_pack(_Tp(_Num))...>; #endif /// Alias template index_sequence diff --git a/libstdc++-v3/testsuite/20_util/integer_sequence/pr111357.cc b/libstdc++-v3/testsuite/20_util/integer_sequence/pr111357.cc new file mode 100644 index 00000000000..1ad06b732af --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/integer_sequence/pr111357.cc @@ -0,0 +1,34 @@ +// { dg-do compile { target c++14 } } + +// PR c++/111357 - __integer_pack fails to work with values of dependent type +// convertible to integers in noexcept context + +#include + +using std::integer_sequence; +using std::make_integer_sequence; + +template +void g(integer_sequence) +{} + +template +struct c1 +{ + static constexpr int value = 1; + constexpr operator int() { return value; } +}; + +template +struct R +{ + using S = make_integer_sequence{}>; + + R() noexcept(noexcept(g(S()))) // { dg-bogus "argument to .__integer_pack." } + {} +}; + +int main() +{ + R(); +}