Skip to content

Commit 02bc3d7

Browse files
committed
This *might* fix the last gcc-6 error.
See open-source-parsers#411 (comment) 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_)); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
1 parent 6b562c8 commit 02bc3d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib_json/json_value.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ Value::CZString::CZString(const CZString& other)
231231
: cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0
232232
? duplicateStringValue(other.cstr_, other.storage_.length_)
233233
: other.cstr_) {
234-
storage_.policy_ = (other.cstr_
234+
storage_.policy_ = static_cast<unsigned>(other.cstr_
235235
? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
236236
? noDuplication : duplicate)
237237
: static_cast<DuplicationPolicy>(other.storage_.policy_));

0 commit comments

Comments
 (0)