[v3] PR libstdc++/80165

Message ID CAFk2RUbR2oiFPtqMBTaamLZj5zjuPHtWQEzUB7Oj2Q-Ej=G6Ng@mail.gmail.com
State New
Headers show
Series
  • [v3] PR libstdc++/80165
Related show

Commit Message

Ville Voutilainen May 12, 2018, 5:37 p.m.
This just adds a missing test. The bug was in variant, not tuple,
so I added the test under variant. Ok for trunk (this is not going
to be backported)?

2018-05-12  Ville Voutilainen  <ville.voutilainen@gmail.com>

    PR libstdc++/80165
    * testsuite/20_util/variant/80165.cc: New.

Comments

Jonathan Wakely May 13, 2018, 12:02 a.m. | #1
On 12/05/18 20:37 +0300, Ville Voutilainen wrote:
>This just adds a missing test. The bug was in variant, not tuple,
>so I added the test under variant. Ok for trunk (this is not going
>to be backported)?

OK, thanks.

Patch

diff --git a/libstdc++-v3/testsuite/20_util/variant/80165.cc b/libstdc++-v3/testsuite/20_util/variant/80165.cc
new file mode 100644
index 0000000..add976c
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/variant/80165.cc
@@ -0,0 +1,12 @@ 
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <tuple>
+#include <variant>
+
+int main() {
+  using variant_t = std::variant<short, int, long>;
+  constexpr auto variant_v = variant_t{std::in_place_index_t<0>{}, short{}};
+  constexpr auto tuple = std::make_tuple(variant_v);
+  constexpr std::tuple tuple_v{variant_v};
+}