1 // PR c++/84496 2 // { dg-do compile { target c++14 } } 3 4 template <typename T, T n> struct C { static constexpr T D = n; }; 5 struct E : C<bool, false> {}; 6 template <typename> struct F : C<bool, false> {}; 7 template <typename T> T foo (); 8 template <typename> struct H { typedef int G; }; 9 template <typename> class I; 10 struct L; 11 template <typename, typename> struct J; 12 template <bool, bool, typename...> struct K; 13 struct R { 14 template <typename M, typename... N> 15 static J<decltype (foo<M> () (foo<N>...)), L> o; 16 }; 17 template <typename P, typename... Q> struct K<false, false, P, Q...> : R { 18 typedef decltype (o<P, Q...>) G; 19 }; 20 template <typename P, typename... Q> 21 struct D : K<E::D, F<typename H<P>::G>::D, P, Q...> {}; 22 template <typename P, typename... Q> struct I<P (Q...)> : D<P, Q...> {}; 23 template <typename> class function; 24 template <typename S, typename... Q> struct function<S (Q...)> { 25 template <typename T, typename = typename I<T (Q...)>::G> struct C; 26 template <typename, typename> using U = int; 27 template <typename P, typename = U<int, void>, typename = U<C<P>, void>> 28 function (P); 29 }; 30 template <typename S, typename... Q> 31 template <typename P, typename, typename> 32 function<S (Q...)>::function (P) 33 { 34 } 35 void bar (function<void (int)>); 36 37 void 38 baz () 39 { 40 auto a = [] { 41 static int counter; 42 bar ([] (auto) { counter++; }); 43 }; 44 } 45