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<DuplicationPolicy>(other.storage_.policy_) == noDuplication
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      ? noDuplication : duplicate)
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  : static_cast<DuplicationPolicy>(other.storage_.policy_));
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
This commit is contained in:
Christopher Dunn 2016-02-07 11:28:50 -06:00
parent 6b562c850d
commit 02bc3d77de

View File

@ -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<unsigned>(other.cstr_
? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
? noDuplication : duplicate)
: static_cast<DuplicationPolicy>(other.storage_.policy_));