1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <utility> 11 12// template <class T1, class T2> struct pair 13 14// constexpr pair(); 15 16// This test doesn't pass due to a constexpr bug in GCC 4.9 that fails 17// to initialize any type without a user provided constructor in a constant 18// expression (e.g. float). 19// XFAIL: gcc-4.9 20 21// NOTE: The SFINAE on the default constructor is tested in 22// default-sfinae.pass.cpp 23 24 25#include <utility> 26#include <type_traits> 27#include <cassert> 28 29#include "test_macros.h" 30#include "archetypes.hpp" 31 32int main() 33{ 34 { 35 typedef std::pair<float, short*> P; 36 P p; 37 assert(p.first == 0.0f); 38 assert(p.second == nullptr); 39 } 40#if TEST_STD_VER >= 11 41 { 42 typedef std::pair<float, short*> P; 43 constexpr P p; 44 static_assert(p.first == 0.0f, ""); 45 static_assert(p.second == nullptr, ""); 46 } 47 { 48 using NoDefault = ImplicitTypes::NoDefault; 49 using P = std::pair<int, NoDefault>; 50 static_assert(!std::is_default_constructible<P>::value, ""); 51 using P2 = std::pair<NoDefault, int>; 52 static_assert(!std::is_default_constructible<P2>::value, ""); 53 } 54#endif 55} 56