Merge pull request #324 from Lastique/alignas_constexpr

Increase gcc version for BOOST_NO_CXX11_ALIGNAS to 4.9
This commit is contained in:
jzmaddock
2020-03-24 11:06:58 +00:00
committed by GitHub
2 changed files with 24 additions and 4 deletions

View File

@ -254,7 +254,6 @@
// C++0x features in 4.8.n and later
//
#if (BOOST_GCC_VERSION < 40800) || !defined(BOOST_GCC_CXX11)
# define BOOST_NO_CXX11_ALIGNAS
# define BOOST_NO_CXX11_THREAD_LOCAL
# define BOOST_NO_CXX11_SFINAE_EXPR
#endif
@ -267,6 +266,14 @@
# define BOOST_NO_CXX14_BINARY_LITERALS
#endif
// C++0x features in 4.9.n and later
//
#if (BOOST_GCC_VERSION < 40900) || !defined(BOOST_GCC_CXX11)
// Although alignas support is added in gcc 4.8, it does not accept
// constant expressions as an argument until gcc 4.9.
# define BOOST_NO_CXX11_ALIGNAS
#endif
// C++0x features in 5.1 and later
//
#if (BOOST_GCC_VERSION < 50100) || !defined(BOOST_GCC_CXX11)

View File

@ -1,4 +1,4 @@
// (C) Copyright Andrey Semashev 2013
// (C) Copyright Andrey Semashev 2013, 2020
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
@ -12,6 +12,12 @@
namespace boost_no_cxx11_alignas {
template< unsigned int Alignment >
struct alignment
{
static const unsigned int value = Alignment;
};
struct alignas(16) my_data1
{
char data[10];
@ -22,10 +28,17 @@ struct alignas(double) my_data2
char data[16];
};
struct alignas(alignment< 16u >::value) my_data3
{
char data[16];
};
my_data1 dummy1[2];
my_data2 dummy2;
alignas(16) char dummy3[10];
alignas(double) char dummy4[32];
my_data3 dummy3;
alignas(16) char dummy4[10];
alignas(double) char dummy5[32];
alignas(alignment< 16u >::value) char dummy6[32];
int test()
{