I tried to compile the code with option C++14:
#define X static_cast<double>(2)
#include <algorithm>
// if you change the two lines, no error occurs
int main()
{
return 0;
}
But I get error after X:
error: expected ',' or '...'
I do not get error with option C++98. With my gcc version 4.8.4, I don't get error, but with 5.4.0 I do. Is this a bug? Do I do something wrong?
I get the same error on my local g++ 5.4.0 installation. I looked at the g++ -E
output, and it seems the error traces to /usr/lib/gcc/x86_64-linux-gnu/5/include/ia32intrin.h lines 252 and 254:
/* Write flags register */
extern __inline void
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__writeeflags (unsigned long long X) // 252
{
__builtin_ia32_writeeflags_u64 (X); // 254
}
This can be considered a bug in the compiler-bundled library, since non-reserved #define
s are not supposed to conflict with them. (Other functions in the same header use parameter __X
.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With