http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48557
Summary: [C++0x][SFINAE] Hard errors with void as operand of binary built-in operators Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: daniel.krueg...@googlemail.com CC: ja...@redhat.com Build: 4.7.0 20110409 (experimental) The following program is well-formed, but should be well-formed according to SFINAE rules: //----------------- template<class T> struct add_rval_ref { typedef T&& type; }; template<> struct add_rval_ref<void> { typedef void type; }; template<class T> typename add_rval_ref<T>::type create(); template<class T, class U, class = decltype(create<T>() + create<U>()) > char f(int); template<class, class> char (&f(...))[2]; static_assert(sizeof(f<void, int>(0)) != 1, "Error"); // (a) //----------------- The error message at (a) is: "error: void value not ignored as it ought to be" The same problem has been confirmed to exist for the following binary operators: +,-,*,/,%,<<,>>,==,!=,<,<=,>,>=,&,^,|,&&,|| It does *not* occur for the corresponding compounds assignments, like +=, though