<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:ezyang@mit.edu" title="Edward Z. Yang <ezyang@mit.edu>"> <span class="fn">Edward Z. Yang</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - tuple with a reference to a temporary (C++11): static_assert: "Attempted to construct a reference element in a tuple with an rvalue""
   href="https://bugs.llvm.org/show_bug.cgi?id=20855">bug 20855</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>WONTFIX
           </td>
           <td>---
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>ezyang@mit.edu
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - tuple with a reference to a temporary (C++11): static_assert: "Attempted to construct a reference element in a tuple with an rvalue""
   href="https://bugs.llvm.org/show_bug.cgi?id=20855#c11">Comment # 11</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - tuple with a reference to a temporary (C++11): static_assert: "Attempted to construct a reference element in a tuple with an rvalue""
   href="https://bugs.llvm.org/show_bug.cgi?id=20855">bug 20855</a>
              from <span class="vcard"><a class="email" href="mailto:ezyang@mit.edu" title="Edward Z. Yang <ezyang@mit.edu>"> <span class="fn">Edward Z. Yang</span></a>
</span></b>
        <pre>I am reopening this to disagree.

There are three main arguments why clang should not reject this:

1. No where in the C++ standard is a tuple of references prohibited. 
Introducing a restriction, in the name of a "diagnostic", introduces
portability issues (where use of a reference in a tuple is allowed on one
compiler, e.g., gcc and old versions of clang) and disallowed on other
compilers.  Sure, introduce *warning* for a diagnostic, but don't make it a
fatal error.

2. It's inconsistent with clang's treatment of pair. std::pair<const int&,
const int&> works just fine; it is only tuple that is rejected. Are you going
to also attach this diagnostic to pair?

3. This construction is useful anywhere you (1) would have returned a reference
/ const reference, and (2) need to return multiple values.  Many of the
examples given by users in the ticket here were "wrong", and you definitely
have to be careful to use the correct constructor (lest reference collapsing
occur), but there truly is nothing wrong with wanting to return multiple
references from a function, to data whose scope extends beyond the immediate
function call.</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>