Define __cpp_lib_byte feature-test macro

* include/c_global/cstddef: Define __cpp_lib_byte feature-test macro.
	* testsuite/18_support/byte/requirements.cc: Check macro.

From-SVN: r253953
This commit is contained in:
Jonathan Wakely 2017-10-20 19:19:09 +01:00 committed by Jonathan Wakely
parent 313b789516
commit 37f7230a10
3 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2017-10-20 Jonathan Wakely <jwakely@redhat.com>
* include/c_global/cstddef: Define __cpp_lib_byte feature-test macro.
* testsuite/18_support/byte/requirements.cc: Check macro.
Backport from mainline
2017-10-13 Jonathan Wakely <jwakely@redhat.com>

View File

@ -57,9 +57,11 @@ namespace std
}
#endif
#if __cplusplus > 201402L
#if __cplusplus >= 201703L
namespace std
{
#define __cpp_lib_byte 201603
/// std::byte
enum class byte : unsigned char {};

View File

@ -20,6 +20,12 @@
#include <cstddef>
#ifndef __cpp_lib_byte
# error "Feature-test macro for byte missing"
#elif __cpp_lib_byte != 201603
# error "Feature-test macro for byte has wrong value"
#endif
static_assert( sizeof(std::byte) == sizeof(unsigned char) );
static_assert( alignof(std::byte) == alignof(unsigned char) );