Compiling with gcc-7.1 with the flag -std=c++17, the following program raises an error:
-std=c++17
#include void foo(const char* cstr)
You can call foo(std::string(str).c_str()).
foo(std::string(str).c_str())