http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51222
--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-11-21 07:51:49 UTC --- When fixing this problem, I suggest to add the following tests as well, which also fail currently (In previous builds sometimes one of these forms worked when the other failed): //--- template<class T> struct add_rref { typedef T&& type; }; template<> struct add_rref<void> { typedef void type; }; template<class T> typename add_rref<T>::type declval(); template<class T, class U> auto f2(int) -> decltype(::delete ::new T(declval<U>()), char()); template<class, class> auto f2(...) -> char(&)[2]; template<class T> auto g2(int) -> decltype(::delete ::new T(), char()); template<class> auto g2(...) -> char(&)[2]; struct C { }; struct A { virtual ~A() = 0; }; struct D1 { D1() = delete; }; struct D2 { ~D2() = delete; }; static_assert(sizeof(g2<void>(0)) == 2, "Ouch"); static_assert(sizeof(g2<void()>(0)) == 2, "Ouch"); static_assert(sizeof(g2<void() const>(0)) == 2, "Ouch"); static_assert(sizeof(g2<A>(0)) == 2, "Ouch"); static_assert(sizeof(g2<D1>(0)) == 2, "Ouch"); static_assert(sizeof(g2<D2>(0)) == 2, "Ouch"); static_assert(sizeof(g2<int&>(0)) == 2, "Ouch"); static_assert(sizeof(g2<int&&>(0)) == 2, "Ouch"); static_assert(sizeof(g2<void(&)()>(0)) == 2, "Ouch"); static_assert(sizeof(g2<void(&&)()>(0)) == 2, "Ouch"); static_assert(sizeof(f2<void, void>(0)) == 2, "Ouch"); static_assert(sizeof(f2<void(), void()>(0)) == 2, "Ouch"); static_assert(sizeof(f2<void() const, void() const>(0)) == 2, "Ouch"); static_assert(sizeof(f2<int, void>(0)) == 2, "Ouch"); static_assert(sizeof(f2<void, int>(0)) == 2, "Ouch"); static_assert(sizeof(f2<C, void>(0)) == 2, "Ouch"); static_assert(sizeof(f2<C, int>(0)) == 2, "Ouch"); static_assert(sizeof(f2<int&, int&>(0)) == 2, "Ouch"); static_assert(sizeof(f2<int&&, int&&>(0)) == 2, "Ouch"); static_assert(sizeof(f2<void(&)(), void(&)()>(0)) == 2, "Ouch"); static_assert(sizeof(f2<void(&&)(), void(&&)()>(0)) == 2, "Ouch"); //---