Skip to content

Commit ef22ca1

Browse files
committed
Fix -Werror=effc++ errors with GNU 6.3.1
Fix "'MyHandler::type’ should be initialized in the member initialization list [-Werror=effc++]" errors. Tencent#874
1 parent c64f378 commit ef22ca1

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

example/simplepullreader/simplepullreader.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ struct MyHandler {
1616
const char* type;
1717
std::string data;
1818

19-
MyHandler() : type(), data() { Null(); }
20-
MyHandler(const MyHandler& cpy) : type(cpy.type),data(cpy.data) {}
21-
MyHandler& operator=(const MyHandler& cpy) {
22-
type = cpy.type;
23-
data = cpy.data;
24-
return *this;
25-
}
19+
MyHandler() : type(), data() {}
2620

2721
bool Null() { type = "Null"; data.clear(); return true; }
2822
bool Bool(bool b) { type = "Bool:"; data = b? "true": "false"; return true; }
@@ -38,6 +32,9 @@ struct MyHandler {
3832
bool EndObject(SizeType memberCount) { type = "EndObject:"; data = stringify(memberCount); return true; }
3933
bool StartArray() { type = "StartArray"; data.clear(); return true; }
4034
bool EndArray(SizeType elementCount) { type = "EndArray:"; data = stringify(elementCount); return true; }
35+
private:
36+
MyHandler(const MyHandler& noCopyConstruction);
37+
MyHandler& operator=(const MyHandler& noAssignment);
4138
};
4239

4340
int main() {

0 commit comments

Comments
 (0)