1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
3 // rdar://12645424, crash due to a double-free
5 template<typename _Tp
> struct __add_lvalue_reference_helper
{};
6 template<typename _Tp
> struct add_lvalue_reference
: __add_lvalue_reference_helper
<_Tp
> {
10 template<typename
... Types
> struct type_list
;
11 template<typename
, template<typename
> class... Funs
> struct C
;
13 template<typename T
> struct C
<T
> {
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
;
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
;
26 template< class Pattern
> struct F
{
27 typedef Pattern filtered_pattern
;
28 tl_map
< filtered_pattern
, add_lvalue_reference
> type
;
31 template<class, class Pattern
> struct get_case
{
35 template<class Pattern
> struct rvalue_builder
{
36 template<typename Expr
> typename get_case
<Expr
, Pattern
>::type
operator>>(Expr
); // expected-note {{candidate template ignored}}
39 template<typename Arg0
> rvalue_builder
< type_list
<Arg0
> > on(const Arg0
& ) ;
42 int empty
= on(0) >> [] {}; // expected-error {{invalid operands to binary expression}}