public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Add testcase for std::make_integer_sequence bug [PR111357]
@ 2023-09-14 13:32 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-09-14 13:32 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested aarch64-linux. Pushed to trunk.

I'll backport the test and a library workaround to the release branches.

-- >8 --

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.
---
 .../20_util/integer_sequence/pr111357.cc      | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 libstdc++-v3/testsuite/20_util/integer_sequence/pr111357.cc

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>();
+}
-- 
2.41.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-14 13:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-14 13:32 [committed] libstdc++: Add testcase for std::make_integer_sequence bug [PR111357] Jonathan Wakely

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).