1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify 2 3 // rdar://12645424, crash due to a double-free 4 5 template<typename _Tp> struct __add_lvalue_reference_helper {}; 6 template<typename _Tp> struct add_lvalue_reference : __add_lvalue_reference_helper<_Tp> { 7 typedef _Tp type; 8 }; 9 10 template<typename... Types> struct type_list; 11 template<typename , template<typename> class... Funs> struct C; 12 13 template<typename T> struct C<T> { 14 typedef T type; 15 }; 16 17 template<typename T, template<typename> class Fun0, template<typename> class... Funs> struct C<T, Fun0, Funs...> { 18 typedef typename C<typename Fun0<T>::type, Funs...>::type type; 19 }; 20 21 template<class , template<typename> class... Funs> struct tl_map; 22 template<typename... Ts, template<typename> class... Funs> struct tl_map<type_list<Ts...>, Funs...> { 23 typedef type_list<typename C<Ts, Funs...>::type...> type; 24 }; 25 26 template< class Pattern> struct F { 27 typedef Pattern filtered_pattern; 28 tl_map< filtered_pattern, add_lvalue_reference > type; 29 }; 30 31 template<class, class Pattern> struct get_case { 32 F<Pattern> type; 33 }; 34 35 template<class Pattern> struct rvalue_builder { 36 template<typename Expr> typename get_case<Expr, Pattern>::type operator>>(Expr ); // expected-note {{candidate template ignored}} 37 }; 38 39 template<typename Arg0> rvalue_builder< type_list<Arg0> > on(const Arg0& ) ; 40 41 class Z { 42 int empty = on(0) >> [] {}; // expected-error {{invalid operands to binary expression}} 43 }; 44