1 // PR c++/85866
2 // { dg-do compile { target c++11 } }
3 
4 template<typename _Tp, typename _Up = _Tp&&>
5 _Up
6 __declval(int);
7 
8 template<typename _Tp>
9 _Tp
10 __declval(long);
11 
12 template<typename _Tp>
13 auto declval() noexcept -> decltype(__declval<_Tp>(0));
14 
15 template<typename...>
16 using void_t = void;
17 
18 template<typename U, typename V,
19 	 void_t<decltype ( (declval<U>().*declval<V>()) () )
20 		>* = nullptr>
boom()21 void boom(){}
22 
23 struct Foo {
barFoo24   void bar(){}
25 };
26 
main()27 int main() {
28   boom<Foo, decltype(&Foo::bar)>();
29 }
30