annotate gcc/testsuite/g++.dg/cpp1z/decomp12.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // PR c++/78358
kono
parents:
diff changeset
2 // { dg-do run }
kono
parents:
diff changeset
3 // { dg-options -std=c++17 }
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 #include <tuple>
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 template <typename, typename> struct same_type;
kono
parents:
diff changeset
8 template <typename T> struct same_type<T, T> {};
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 int main() {
kono
parents:
diff changeset
11 std::tuple tuple = { 1, 'a', 2.3, true };
kono
parents:
diff changeset
12 auto[i, c, d, b] = tuple;
kono
parents:
diff changeset
13 same_type<std::tuple_element<0, decltype(tuple)>::type, decltype(i)>{};
kono
parents:
diff changeset
14 same_type<decltype(i), int>{};
kono
parents:
diff changeset
15 same_type<decltype(c), char>{};
kono
parents:
diff changeset
16 same_type<decltype(d), double>{};
kono
parents:
diff changeset
17 same_type<decltype(b), bool>{};
kono
parents:
diff changeset
18 if (i != 1 || c != 'a' || d != 2.3 || b != true)
kono
parents:
diff changeset
19 __builtin_abort ();
kono
parents:
diff changeset
20 }