The following code
#include <string>
void set_string(std::string) {
}
int main() {
if constexpr (false) {set_string(true);}
}
does not compile with an error
error: no matching function for call to 'set_string'
if constexpr (false) {set_string(true);}
^~~~~~~~~~
<source>:3:6: note: candidate function not viable: no known conversion from 'bool' to 'std::string' (aka 'basic_string<char>') for 1st argument
But set_string(true)
is discarded statement and should be dropped. I'm right?