-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
Language ConformanceC++11, style, or language warning topics addressedC++11, style, or language warning topics addressedduplicate
Description
when passing a Json::Value pointer to a const Json::Value &;
compiler will automatically transform the pointer to bool then to a json::value;
void LogJson(const Json::Value& value) {
LOG(ERROR) << value.toStyledString();
}
int main() {
Json::Value json = Json::Value(Json::objectValue)
const Json::Value *json_p = &json;
LogJson(json);
LogJson(json_p);
}
the first LogJson will log a "{}"
the second LogJson will log a "true", caused by implict conversation
Expecte the second LogJson will compile fail.
leeshun
Metadata
Metadata
Assignees
Labels
Language ConformanceC++11, style, or language warning topics addressedC++11, style, or language warning topics addressedduplicate