Nico Weber cc89063bff libcxx: Rename .hpp files in libcxx/test/support to .h
LLVM uses .h as its extension for header files.

Files renamed using:

    for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done

References to the files updated using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
        a=$(basename $f);
        echo $a;
        rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/";
    done

HPP include guards updated manually using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
      echo ${f%.hpp}.h ;
    done | xargs mvim

Differential Revision: https://reviews.llvm.org/D66104

llvm-svn: 369481
2019-08-21 00:14:12 +00:00

63 lines
1.4 KiB
C++

// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
// <variant>
// template <class ...Types> class variant;
// constexpr size_t index() const noexcept;
#include <cassert>
#include <string>
#include <type_traits>
#include <variant>
#include "archetypes.h"
#include "test_macros.h"
#include "variant_test_helpers.h"
int main(int, char**) {
{
using V = std::variant<int, long>;
constexpr V v;
static_assert(v.index() == 0, "");
}
{
using V = std::variant<int, long>;
V v;
assert(v.index() == 0);
}
{
using V = std::variant<int, long>;
constexpr V v(std::in_place_index<1>);
static_assert(v.index() == 1, "");
}
{
using V = std::variant<int, std::string>;
V v("abc");
assert(v.index() == 1);
v = 42;
assert(v.index() == 0);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
{
using V = std::variant<int, MakeEmptyT>;
V v;
assert(v.index() == 0);
makeEmpty(v);
assert(v.index() == std::variant_npos);
}
#endif
return 0;
}