riebl / artery

OMNeT++ V2X simulation framework for ETSI ITS-G5
GNU General Public License v2.0
203 stars 129 forks source link

Fix exception message in Identity.cc #262

Closed hagau closed 1 year ago

hagau commented 1 year ago

When compiling with Clang-14 I get the following error:

home/artery/artery/src/artery/utility/Identity.cc:57:84: error: cannot pass non-trivial object of type 'const std::string' (aka 'const basic_string<char>') to variadic constructor; expected type from format string was 'char *' [-Wnon-pod-varargs]
        throw omnetpp::cRuntimeError("unknown basis %s to derive station id from", basis);
                                                    ~~                             ^~~~~
/home/artery/artery/src/artery/utility/Identity.cc:57:84: note: did you mean to call the c_str() method?
        throw omnetpp::cRuntimeError("unknown basis %s to derive station id from", basis);
                                                                                   ^
                                                                                        .c_str()

Apparently, handling non-POD objects in a variadic constructor is implementation-specific and while GCC supports it, Clang raises an error.

riebl commented 1 year ago

Oops, I thought cRuntimeError is handling that. Thanks for your PR!