diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-09-14 09:18:34 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-09-14 14:26:03 +0100 |
commit | 557a858f2ead4ae8b64b157d7fd33830a81646d5 (patch) | |
tree | 0ea54b38e369656c15f0cae547b0dcbb47fe47fb | |
parent | 9da3c935e3f46e32d9f801f07916634dc9a65886 (diff) | |
download | gcc-557a858f2ead4ae8b64b157d7fd33830a81646d5.zip gcc-557a858f2ead4ae8b64b157d7fd33830a81646d5.tar.gz gcc-557a858f2ead4ae8b64b157d7fd33830a81646d5.tar.bz2 |
libstdc++: Add testcase for std::make_integer_sequence bug [PR111357]
The compiler bug has been fixed on trunk, but this adds a regression test
for the library component.
libstdc++-v3/ChangeLog:
PR c++/111357
* testsuite/20_util/integer_sequence/pr111357.cc: New test.
-rw-r--r-- | libstdc++-v3/testsuite/20_util/integer_sequence/pr111357.cc | 34 |
1 files changed, 34 insertions, 0 deletions
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 0000000..1ad06b7 --- /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>(); +} |