Cleanup _LIBCPP_HAS_NO_<c++11-feature> macros for std::initializer_list
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300623 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -53,7 +53,7 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
|
|||||||
namespace std // purposefully not versioned
|
namespace std // purposefully not versioned
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#ifndef _LIBCPP_CXX03_LANG
|
||||||
|
|
||||||
template<class _Ep>
|
template<class _Ep>
|
||||||
class _LIBCPP_TEMPLATE_VIS initializer_list
|
class _LIBCPP_TEMPLATE_VIS initializer_list
|
||||||
@@ -111,7 +111,7 @@ end(initializer_list<_Ep> __il) _NOEXCEPT
|
|||||||
return __il.end();
|
return __il.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#endif // !defined(_LIBCPP_CXX03_LANG)
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// <initializer_list>
|
||||||
|
|
||||||
|
// Test that the file can be included in C++03
|
||||||
|
|
||||||
|
#include <initializer_list>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
// template<class E> class initializer_list;
|
// template<class E> class initializer_list;
|
||||||
|
|
||||||
// const E* begin() const;
|
// const E* begin() const;
|
||||||
@@ -19,8 +21,6 @@
|
|||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
A(std::initializer_list<int> il)
|
A(std::initializer_list<int> il)
|
||||||
@@ -52,13 +52,9 @@ struct B
|
|||||||
|
|
||||||
#endif // TEST_STD_VER > 11
|
#endif // TEST_STD_VER > 11
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
A test1 = {3, 2, 1};
|
A test1 = {3, 2, 1};
|
||||||
#endif
|
|
||||||
#if TEST_STD_VER > 11
|
#if TEST_STD_VER > 11
|
||||||
constexpr B test2 = {3, 2, 1};
|
constexpr B test2 = {3, 2, 1};
|
||||||
#endif // TEST_STD_VER > 11
|
#endif // TEST_STD_VER > 11
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
// template<class E> class initializer_list;
|
// template<class E> class initializer_list;
|
||||||
|
|
||||||
// initializer_list();
|
// initializer_list();
|
||||||
@@ -20,10 +22,9 @@ struct A {};
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
std::initializer_list<A> il;
|
std::initializer_list<A> il;
|
||||||
assert(il.size() == 0);
|
assert(il.size() == 0);
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
#if TEST_STD_VER > 11
|
#if TEST_STD_VER > 11
|
||||||
constexpr std::initializer_list<A> il2;
|
constexpr std::initializer_list<A> il2;
|
||||||
static_assert(il2.size() == 0, "");
|
static_assert(il2.size() == 0, "");
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
// <initializer_list>
|
// <initializer_list>
|
||||||
|
|
||||||
// template<class E> const E* begin(initializer_list<E> il);
|
// template<class E> const E* begin(initializer_list<E> il);
|
||||||
@@ -17,8 +19,6 @@
|
|||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
A(std::initializer_list<int> il)
|
A(std::initializer_list<int> il)
|
||||||
@@ -49,13 +49,10 @@ struct B
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // TEST_STD_VER > 11
|
#endif // TEST_STD_VER > 11
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
A test1 = {3, 2, 1};
|
A test1 = {3, 2, 1};
|
||||||
#endif
|
|
||||||
#if TEST_STD_VER > 11
|
#if TEST_STD_VER > 11
|
||||||
constexpr B test2 = {3, 2, 1};
|
constexpr B test2 = {3, 2, 1};
|
||||||
#endif // TEST_STD_VER > 11
|
#endif // TEST_STD_VER > 11
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
// template<class E>
|
// template<class E>
|
||||||
// class initializer_list
|
// class initializer_list
|
||||||
// {
|
// {
|
||||||
@@ -26,12 +28,10 @@ struct A {};
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
static_assert((std::is_same<std::initializer_list<A>::value_type, A>::value), "");
|
static_assert((std::is_same<std::initializer_list<A>::value_type, A>::value), "");
|
||||||
static_assert((std::is_same<std::initializer_list<A>::reference, const A&>::value), "");
|
static_assert((std::is_same<std::initializer_list<A>::reference, const A&>::value), "");
|
||||||
static_assert((std::is_same<std::initializer_list<A>::const_reference, const A&>::value), "");
|
static_assert((std::is_same<std::initializer_list<A>::const_reference, const A&>::value), "");
|
||||||
static_assert((std::is_same<std::initializer_list<A>::size_type, std::size_t>::value), "");
|
static_assert((std::is_same<std::initializer_list<A>::size_type, std::size_t>::value), "");
|
||||||
static_assert((std::is_same<std::initializer_list<A>::iterator, const A*>::value), "");
|
static_assert((std::is_same<std::initializer_list<A>::iterator, const A*>::value), "");
|
||||||
static_assert((std::is_same<std::initializer_list<A>::const_iterator, const A*>::value), "");
|
static_assert((std::is_same<std::initializer_list<A>::const_iterator, const A*>::value), "");
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user