Description
So I have this weird issue, my project is using gcc 4.6.3, and it looks like the compiler has a bug, that vscode rightfully gives an error about, but the code builds. It's a bit annoying and isn't cool overall. What can I do about this issue?
The bug is as follows:
I have a struct, let's say struct Foo { int id; std::unordered_set<int> set; };
. My class has a private member of this struct, and it initializes it in initialization list like this : member({ 0, { } })
.
The problem with this is that gcc 4.6.3 unordered_set default constructor is explicit, which is why member({ 0, { } })
gives an Intellisense error, according to C++11. However, if this was actually an invalid code, I would write member({ 0, std::unordered_set<int>{ } })
(which is subjectively less pretty), but standard actually says that unordered_set default constructor is not supposed to be explicit, and so my code builds correctly in later gcc versions.
Is my only option to either update gcc or to write ugly code just to satisfy IntelliSense?
Another option would be to ignore it, but let's not talk about this.