From 02bc3d77de93088e065ede2f9c07fb023f54d3a9 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Sun, 7 Feb 2016 11:28:50 -0600 Subject: [PATCH] This *might* fix the last gcc-6 error. See https://github.com/open-source-parsers/jsoncpp/issues/411#issuecomment-180974558 I was unable to produce a warning in Clang, so I am not certain. But based on a [SO answer](http://stackoverflow.com/questions/25480059/gcc-conversion-warning-when-assigning-to-a-bitfield), I think I've fixed the following: ``` /tmp/jsoncpp/src/lib_json/json_value.cpp: In copy constructor 'Json::Value::CZString::CZString(const Json::Value::CZString&)': /tmp/jsoncpp/src/lib_json/json_value.cpp:235:18: error: conversion to 'unsigned char:2' from 'unsigned int' may alter its value [-Werror=conversion] storage_.policy_ = (other.cstr_ ~~~~~~~~~~~~ ? (static_cast(other.storage_.policy_) == noDuplication ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ? noDuplication : duplicate) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ : static_cast(other.storage_.policy_)); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` --- src/lib_json/json_value.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index 1f6425f..f598491 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -231,7 +231,7 @@ Value::CZString::CZString(const CZString& other) : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0 ? duplicateStringValue(other.cstr_, other.storage_.length_) : other.cstr_) { - storage_.policy_ = (other.cstr_ + storage_.policy_ = static_cast(other.cstr_ ? (static_cast(other.storage_.policy_) == noDuplication ? noDuplication : duplicate) : static_cast(other.storage_.policy_));