const_first_const_second.pass.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <utility>
11
12// template <class T1, class T2> struct pair
13
14// pair(const T1& x, const T2& y);
15
16#include <utility>
17#include <cassert>
18
19class A
20{
21    int data_;
22public:
23    A(int data) : data_(data) {}
24
25    bool operator==(const A& a) {return data_ == a.data_;}
26};
27
28int main()
29{
30    {
31        typedef std::pair<float, short*> P;
32        P p(3.5f, 0);
33        assert(p.first == 3.5f);
34        assert(p.second == nullptr);
35    }
36    {
37        typedef std::pair<A, int> P;
38        P p(1, 2);
39        assert(p.first == A(1));
40        assert(p.second == 2);
41    }
42}
43