Closed mglisse closed 1 month ago
It looks like this isn't specifically an issue in Unordered. I reproduced this using only a stand-in for boost::empty_value
. It's still happening on the latest Visual Studio 2022, 17.10.3. The Unordered code does basically the following.
// A stand-in for boost::empty_value
template <class T>
class empty_value : T
{
public:
using type = T;
};
template <class T>
struct S : empty_value<T>
{
using type = typename empty_value<T>::type;
};
struct Outer { struct Inner {}; };
S<Outer::Inner> s{};
int main(){}
This clearly looks like a compiler bug in MSVC. It could be fixed by inheriting publicly from T
in empty_value
. I'm not sure if this is a breaking change in Core. There is no workaround I could see in the Unordered library. I'll look into changing this in Core.
For your use case, you can work around this problem by moving H
outside of A
. It seems like MSVC has a problem with nested classes/structs in this case.
Hi @mglisse can you confirm if this fix solves your original problem? Thank you!
Thanks. I'll try to check if it fixes the original problem at some point, but don't hold your breath (I don't have the environment available anymore). If it fixes the reduced testcase, I think that's good enough to close the issue, and I'll open a new one later if it turns out not to be sufficient for our full code.
Compiling this with Visual Studio 2022 (17.8.5) and Boost 1.85 yields
This is most likely a bug in visual studio (it might even be fixed already in more recent versions, I don't have other versions at hand right now), but in case you want to work around it in Boost somehow...