riebl / artery

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

Fix exception message in Identity.cc #262

Closed hagau closed 2 years ago

hagau commented 2 years 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 2 years ago

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