From: Casey Carter Date: Fri, 12 May 2017 20:33:46 +0000 (+0000) Subject: [test] Add specific test for P0138R2, direct-list-init of fixed enums from integers... X-Git-Tag: llvmorg-5.0.0-rc1~5186 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4de0f034cfb2c7f7959c9cae10647ceff2c44353;p=platform%2Fupstream%2Fllvm.git [test] Add specific test for P0138R2, direct-list-init of fixed enums from integers, part 3/3. Test the C++17 Core Language feature independently from other std::byte tests. llvm-svn: 302946 --- diff --git a/libcxx/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp new file mode 100644 index 0000000..1576261 --- /dev/null +++ b/libcxx/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't like "std::byte b1{1}" +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 + +int main () { + constexpr std::byte b{42}; + static_assert(std::to_integer(b) == 42, ""); +}