Consider the following code:I want the compiler to raise a warning when passing const char* instead of bool as a parameter to function foo.
consider following code:I want compiler raise warning, when passing const char* instead of bool as parameter to function foo. But GCC implicitly converts it. I tried -Wall, -Wextra, -Wpedantic, nothing works. Is there any flag that, could catch such implicit conversion (invalid parameter type)?
I was testing C++17 features on GCC compiler version 7.1.0. This is related to the fallthrough attribute and the following example (live example) is adapted from online CPP reference here
This question is about C++20's [[likely]]/[[unlikely]] feature, not compiler-defined macros.This documents (cppreference) only gave an example on applying them to a switch-case statement. This switch-case example compiles perfectly with my compiler (g++-7.2) so I assume the compiler has implemented this feature, though it's not yet officially introduced in current C++...
In the code below why is b uninitialized instead of out-of-bounds?Compiler call:Update: Now this is odd: