From 7d16e10113f632a80adb45f514f72c54bec3673c Mon Sep 17 00:00:00 2001 From: fangguo Date: Tue, 25 Sep 2018 08:57:36 +0800 Subject: [PATCH] =?UTF-8?q?fiexd=20=E2=80=9CCannot=20take=20the=20address?= =?UTF-8?q?=20of=20a=20bit=20field.=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```c++ #include class TestBool { public: TestBool():addChildValues_(){} TestBool(int):addChildValues_(false){} bool addChildValues_ : 1; bool indented_ : 1; }; int main() { std::cout << "\n TestBool () addChildValues_ = " << TestBool().addChildValues_; std::cout << "\n TestBool false addChildValues_ = " << TestBool(3).addChildValues_; return 0; } ``` ```text root@osssvr-1 # /opt/SUNWspro/prod/bin/CC testbool.cpp -o testbool Error: Cannot take the address of a bit field. 1 Error(s) detected. ``` --- src/lib_json/json_writer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index 3a7fd8e..2197efb 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -425,7 +425,7 @@ void FastWriter::writeValue(const Value& value) { // ////////////////////////////////////////////////////////////////// StyledWriter::StyledWriter() - : rightMargin_(74), indentSize_(3), addChildValues_() {} + : rightMargin_(74), indentSize_(3), addChildValues_(false) {} JSONCPP_STRING StyledWriter::write(const Value& root) { document_.clear();