<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - generic lambda: failed to interpret a string when the string is in a pair"
   href="http://llvm.org/bugs/show_bug.cgi?id=22029">22029</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>generic lambda: failed to interpret a string when the string is in a pair
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++14
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>wang_feng@live.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Example code:

template< typename ... Args >
auto list( Args ... args )
{
    return [=]( auto func ){ return func( args... ); };
}

template< typename List_1, typename List_2 >
auto cons( List_1 list_1, List_2 list_2 )
{
    return list_1( [=]( auto ... args_1 ){ return list_2( [=]( auto ... args_2
){ return list( args_1..., args_2...); } ); } );
}

template< typename Func, typename List >
auto map( Func func, List the_list )
{
    return the_list( [=]( auto ... elems ){ return list( func(elems)... ); } );
}

#include <string>
#include <utility>
#include <type_traits>
#include <iostream> 
int main()
{
    auto mfl = cons( cons( list( std::make_pair( std::string{"f1"}, [](int i){
return i; } ) ),
                 list( std::make_pair( std::string{"f2"}, []( double x, double
y){ return x*y; } ) ) ),
                 list( std::make_pair( std::string{"f3"}, [](std::string s){
return s+s; } ) ) );

    auto pair_printer = []( auto the_pair ) { std::cout << "id:" <<
the_pair.first << "\n"; return the_pair; };
    map( pair_printer, mfl );

    return 0;
}

the expected output is(gcc 4.9 gives):

id:f1
id:f2
id:f3

but clang(3.4 and 3.5) gives:

id:f1
id: 4S� 4S�
id:4S��4S��4S��S���
                            �S��
                                    84S��4S�

and clang 3.6 failed to link it.

An online version is here:
<a href="http://melpon.org/wandbox/permlink/6dnNByDwiAAl27as">http://melpon.org/wandbox/permlink/6dnNByDwiAAl27as</a>
Some discussion in stackoverflow is here:
<a href="http://stackoverflow.com/questions/27482444/strange-behaviour-of-generalized-lambda-in-c14">http://stackoverflow.com/questions/27482444/strange-behaviour-of-generalized-lambda-in-c14</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>