[libcxx] r302946 - [test] Add specific test for P0138R2, direct-list-init of fixed enums from integers, part 3/3.

Casey Carter via cfe-commits cfe-commits at lists.llvm.org
Fri May 12 13:33:46 PDT 2017


Author: caseycarter
Date: Fri May 12 15:33:46 2017
New Revision: 302946

URL: http://llvm.org/viewvc/llvm-project?rev=302946&view=rev
Log:
[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.

Added:
    libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp

Added: libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp?rev=302946&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp Fri May 12 15:33:46 2017
@@ -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 <cstddef>
+#include <test_macros.h>
+
+// 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<int>(b) == 42, "");
+}




More information about the cfe-commits mailing list