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