15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <utility>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // template <class T1, class T2> struct pair
125a83710eSEric Fiselier 
135a83710eSEric Fiselier // tuple_element<I, pair<T1, T2> >::type
145a83710eSEric Fiselier 
155a83710eSEric Fiselier #include <utility>
165a83710eSEric Fiselier 
17*7fc6a556SMarshall Clow #include "test_macros.h"
18*7fc6a556SMarshall Clow 
1957f00f2fSEric Fiselier template <class T1, class T2>
test()2057f00f2fSEric Fiselier void test()
2157f00f2fSEric Fiselier {
2257f00f2fSEric Fiselier     {
2357f00f2fSEric Fiselier     typedef T1 Exp1;
2457f00f2fSEric Fiselier     typedef T2 Exp2;
2557f00f2fSEric Fiselier     typedef std::pair<T1, T2> P;
2657f00f2fSEric Fiselier     static_assert((std::is_same<typename std::tuple_element<0, P>::type, Exp1>::value), "");
2757f00f2fSEric Fiselier     static_assert((std::is_same<typename std::tuple_element<1, P>::type, Exp2>::value), "");
2857f00f2fSEric Fiselier     }
2957f00f2fSEric Fiselier     {
3057f00f2fSEric Fiselier     typedef T1 const Exp1;
3157f00f2fSEric Fiselier     typedef T2 const Exp2;
3257f00f2fSEric Fiselier     typedef std::pair<T1, T2> const P;
3357f00f2fSEric Fiselier     static_assert((std::is_same<typename std::tuple_element<0, P>::type, Exp1>::value), "");
3457f00f2fSEric Fiselier     static_assert((std::is_same<typename std::tuple_element<1, P>::type, Exp2>::value), "");
3557f00f2fSEric Fiselier     }
3657f00f2fSEric Fiselier     {
3757f00f2fSEric Fiselier     typedef T1 volatile Exp1;
3857f00f2fSEric Fiselier     typedef T2 volatile Exp2;
3957f00f2fSEric Fiselier     typedef std::pair<T1, T2> volatile P;
4057f00f2fSEric Fiselier     static_assert((std::is_same<typename std::tuple_element<0, P>::type, Exp1>::value), "");
4157f00f2fSEric Fiselier     static_assert((std::is_same<typename std::tuple_element<1, P>::type, Exp2>::value), "");
4257f00f2fSEric Fiselier     }
4357f00f2fSEric Fiselier     {
4457f00f2fSEric Fiselier     typedef T1 const volatile Exp1;
4557f00f2fSEric Fiselier     typedef T2 const volatile Exp2;
4657f00f2fSEric Fiselier     typedef std::pair<T1, T2> const volatile P;
4757f00f2fSEric Fiselier     static_assert((std::is_same<typename std::tuple_element<0, P>::type, Exp1>::value), "");
4857f00f2fSEric Fiselier     static_assert((std::is_same<typename std::tuple_element<1, P>::type, Exp2>::value), "");
4957f00f2fSEric Fiselier     }
5057f00f2fSEric Fiselier }
5157f00f2fSEric Fiselier 
main(int,char **)522df59c50SJF Bastien int main(int, char**)
535a83710eSEric Fiselier {
5457f00f2fSEric Fiselier     test<int, short>();
5557f00f2fSEric Fiselier     test<int*, char>();
562df59c50SJF Bastien 
572df59c50SJF Bastien   return 0;
585a83710eSEric Fiselier }
59