public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-7817] libstdc++: Add workaround for std::make_integer_sequence bug [PR111357] Date: Thu, 14 Sep 2023 13:39:29 +0000 (GMT) [thread overview] Message-ID: <20230914133929.2E72E3858CDA@sourceware.org> (raw) https://gcc.gnu.org/g:7b0abd4a8ee9d2057febe443de67009dcdfe7574 commit r13-7817-g7b0abd4a8ee9d2057febe443de67009dcdfe7574 Author: Jonathan Wakely <jwakely@redhat.com> 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/bits/utility.h (make_integer_sequence): Add cast. * testsuite/20_util/integer_sequence/pr111357.cc: New test. Diff: --- libstdc++-v3/include/bits/utility.h | 2 +- .../testsuite/20_util/integer_sequence/pr111357.cc | 34 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/utility.h b/libstdc++-v3/include/bits/utility.h index abaaae2dd33..714e2c02680 100644 --- a/libstdc++-v3/include/bits/utility.h +++ b/libstdc++-v3/include/bits/utility.h @@ -173,7 +173,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __has_builtin(__make_integer_seq) = __make_integer_seq<integer_sequence, _Tp, _Num>; #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 <utility> + +using std::integer_sequence; +using std::make_integer_sequence; + +template<int... V> +void g(integer_sequence<int,V...>) +{} + +template<typename ...T> +struct c1 +{ + static constexpr int value = 1; + constexpr operator int() { return value; } +}; + +template<typename T> +struct R +{ + using S = make_integer_sequence<int,c1<T>{}>; + + R() noexcept(noexcept(g(S()))) // { dg-bogus "argument to .__integer_pack." } + {} +}; + +int main() +{ + R<int>(); +}
reply other threads:[~2023-09-14 13:39 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230914133929.2E72E3858CDA@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).