use static_assert and SFINAE instead of gcc __attribute__ error