[Bug c++/54161] sizeof(void) expressions are accepted

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 2 20:35:00 GMT 2012


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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-08-02 20:34:52 UTC ---
A SFINAE testcase that doesn't depend on core 1172 would be

template<class T, unsigned = sizeof(T)>
auto f(int) -> char;

template<class>
auto f(...) -> char(&)[2];

static_assert(sizeof(f<void>(0)) != 1, ""); // OK - Oops
static_assert(sizeof(f<void()>(0)) != 1, ""); // OK - Oops

which already works fine.

I agree that we should get the pedwarn without -pedantic, but that seems to be
all there is to this bug.



More information about the Gcc-bugs mailing list