Hi, I added to mainline the testcase in Comment 16 of PR51213.
Thanks, Paolo. /////////////////////
2013-06-23 Paolo Carlini <paolo.carl...@oracle.com> * g++.dg/cpp0x/sfinae47.C: New.
Index: g++.dg/cpp0x/sfinae47.C =================================================================== --- g++.dg/cpp0x/sfinae47.C (revision 0) +++ g++.dg/cpp0x/sfinae47.C (working copy) @@ -0,0 +1,25 @@ +// Source: Comment 16 of PR51213 +// { dg-do compile { target c++11 } } + +template <class T> +T && declval(); + +template <class T> +constexpr auto hasSize(int) -> decltype(declval<T&>().size(), bool()) +{ return true; } + +template <class T> +constexpr bool hasSize(...) +{ return false; } + +struct A +{ + int size(); +}; + +struct B : private A +{ +}; + +static_assert(hasSize<A>(0), "A"); +static_assert(!hasSize<B>(0), "B");