<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 --- - tuple with a reference to a temporary (C++11): static_assert: "Attempted to construct a reference element in a tuple with an rvalue""
   href="http://llvm.org/bugs/show_bug.cgi?id=20855">20855</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>tuple with a reference to a temporary (C++11): static_assert: "Attempted to construct a reference element in a tuple with an rvalue"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mark@chromium.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>Created <span class=""><a href="attachment.cgi?id=12993" name="attach_12993" title="Testcase">attachment 12993</a> <a href="attachment.cgi?id=12993&action=edit" title="Testcase">[details]</a></span>
Testcase

When creating a tuple that contains a reference to a temporary, this
static_assert is triggered:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:210:10:
error: 
      static_assert failed "Attempted to construct a reference element in a
      tuple with an rvalue"
        {static_assert(!is_reference<_Hp>::value ||
         ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This check seems overzealous. In my seemingly-valid code, the temporary in
question outlives the reference to it, and there doesn’t appear to be any
reason to restrict this.

A testcase is attached. It can be built with “clang++ -std=c++11
-stdlib=libc++”.</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>