Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Bug? Binary literals are supported for old c++

$
0
0

I use this compilation lines:

icpc -std=c++98 -pedantic-errors integers.cc

To compile the following piece of code:

int i = 0b10101;
std::cout << i << std::endl;

It compiles well and works perfectly (the output is 21).
To verify that i use the correct compiler flags I add the following line

auto g () {
    return 2.3;
 }

And indeed in this case I get the expected compiler error when using the compiler flags.

Binary literals is a feature that is supposed to exist only since C++14. So why does my code of binary literals compile? Is it icpc bug?

(With g++ and same flags, it works as expected and does not compile with the binary literals)


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>