Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Warning '-Werror=overloaded-virtual' with gcc-5.1.0 --std=c++14 #142

Open
mohitmv opened this issue Sep 10, 2019 · 1 comment
Open

Warning '-Werror=overloaded-virtual' with gcc-5.1.0 --std=c++14 #142

mohitmv opened this issue Sep 10, 2019 · 1 comment

Comments

@mohitmv
Copy link

mohitmv commented Sep 10, 2019

Please review and merge this pull request :
random-basad@7a03087

Thanks.
@artwyman

/home/genstor/toolchain/json11-master/json/json11.hpp:228:25: error: 'virtual const json11::Json& json11::JsonValue::operator[](const string&) const' was hidden [-Werror=overloaded-virtual]
     virtual const Json &operator[](const std::string &key) const;
                         ^
/home/genstor/toolchain/json11-master/json/json11.cpp:206:18: error:   by 'virtual const json11::Json& json11::JsonArray::operator[](size_t) const' [-Werror=overloaded-virtual]
     const Json & operator[](size_t i) const override;
                  ^
In file included from /home/genstor/toolchain/json11-master/json/json11.cpp:22:0:
/home/genstor/toolchain/json11-master/json/json11.hpp:226:25: error: 'virtual const json11::Json& json11::JsonValue::operator[](size_t) const' was hidden [-Werror=overloaded-virtual]
     virtual const Json &operator[](size_t i) const;
                         ^
/home/genstor/toolchain/json11-master/json/json11.cpp:214:18: error:   by 'virtual const json11::Json& json11::JsonObject::operator[](const string&) const' [-Werror=overloaded-virtual]
     const Json & operator[](const string &key) const override;
                  ^
@artwyman
Copy link
Contributor

That's not a PR it's a diff in your repo. You need to submit a PR and sign the Dropbox CLA before I could consider merging anything. https://opensource.dropbox.com/cla/ . That being said, per the note in the README this repo isn't actively maintained anymore, and hasn't been tested with newer compilers, so you may be best off just fixing things in your own repo as necessary.

Regarding the actual issue, it seems to me that the hiding here is semi-intentional. It doesn't make sense for a JsonArray to have operator[] with a string key, but to populate the vtable it has to have the default implementation which returns null. It doesn't seem obvious to me how to best express that in the code, but suppressing the warning seems like it might be the simplest option.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants