aboutsummaryrefslogtreecommitdiffstats
path: root/include/gsl/gsl_byte
diff options
context:
space:
mode:
Diffstat (limited to 'include/gsl/gsl_byte')
-rw-r--r--include/gsl/gsl_byte9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/gsl/gsl_byte b/include/gsl/gsl_byte
index 5da9a86..e861173 100644
--- a/include/gsl/gsl_byte
+++ b/include/gsl/gsl_byte
@@ -57,6 +57,13 @@
#endif // _MSC_VER
+// Use __may_alias__ attribute on gcc and clang
+#if defined __clang__ || (__GNUC__ > 5)
+#define byte_may_alias __attribute__((__may_alias__))
+#else // defined __clang__ || defined __GNUC__
+#define byte_may_alias
+#endif // defined __clang__ || defined __GNUC__
+
namespace gsl
{
#if GSL_USE_STD_BYTE
@@ -69,7 +76,7 @@ using std::to_integer;
// This is a simple definition for now that allows
// use of byte within span<> to be standards-compliant
-enum class byte : unsigned char
+enum class byte_may_alias byte : unsigned char
{
};