<html>
    <head>
      <base href="https://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 --- - std::bind const-qualifying bound arguments captured by value when compiled as C++14"
   href="https://llvm.org/bugs/show_bug.cgi?id=23141">23141</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>std::bind const-qualifying bound arguments captured by value when compiled as C++14
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>eniebler@boost.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code fails to compile when compiled as C++14:

#include <functional>
#include <type_traits>

struct Fun
{
  template<typename T, typename U>
  void operator()(T && t, U && u) const
  {
    static_assert(std::is_same<U, int &>::value, "");
  }
};

int main()
{
    std::bind(Fun{}, std::placeholders::_1, 42)("hello");
}

The error is:

    static_assert(std::is_same<U, int &>::value, "");
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/clang-trunk/bin/../include/c++/v1/__functional_base:415:12: note: in
instantiation of function template specialization
      'Fun::operator()<char const (&)[6], const int &>' requested here
    return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
           ^
/usr/local/clang-trunk/bin/../include/c++/v1/__config:381:15: note: expanded
from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
1 error generated.


When compiled as C++11, the code compiles successfully.</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>