http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57684

--- Comment #2 from Francesco Biscani <bluescarni at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> I think the problem is that unordered_map requires its template arguments to
> be complete at the time of instantiation, otherwise it's undefined behaviour.
> 
> When the static member is instantiated the type Derived is not complete,
> because base<derived> is instantiated before the body of derived.
> 
> So although it would be nice if this worked, I think it technically relies
> on undefined behaviour.

Thanks for the quick reply!

I understand this might be a bit OT here, but would wrapping the static member
in an std::unique_ptr avoid UB?

Reply via email to