Issue #1348

C++ unordered_set hash/comparator requirements

Both the hash and comparator functors provided to std::unordered_set must be copy constructible per the C++ standard. Otherwise, compiling verilator with libc++ fails with the following errors

"error: static_assert failed "the specified hash does not meet the Hash requirements""
"error: static_assert failed "the specified comparator is required to be copy constructible""

The error goes away if both EqSenTree and HashSenTree are made copyable.

Also, for some reason std::less<ScoreboardTestElem> and std::less<MergeCandidate> are considered non-invokable in SortByValueMap::removeKeyFromOldVal, which causes a warning. I'm not totally sure why this is since it looks like both have a const operator< member function defined.

You can check for this by adding the following static assert to the first line of removeKeyFromOldVal.

Another possible issue I noticed while working on this - it looks like gcc isn't being called with any -std=XXX even though autoconf recognizes that my compiler is gnu++14 capable. Is that the intended behavior? That means by default it uses the custom unordered_set provided with verilator rather than the system one, which might be why no one else noticed the first issue until now. I'm not super familiar with autoconf or the build system, but it looks like everything is compiled with $CPPFLAGS, but only $CXXFLAGS has the standard flag?

Also, not sure if it's related, but in configure.ac on line 237 you have "_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_OLDEST,-std=std++03)". Should that be '-std=c++03'? At least with clang, -std=std++XX isn't a legal option.

I fixed the std++03 thing, that was a typo, though the macro it sets isn't presently used. At present these flags are only used for runtime, that should be fixed, but I'll need to do a lot of testing first as these flags seem to break a lot of stuff in glibc.