Tighten static_assert to also check result type.