[llvm-bugs] [Bug 39605] New: optional does not work with reference_wrapper

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 9 10:43:49 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39605

            Bug ID: 39605
           Summary: optional does not work with reference_wrapper
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ldionne at apple.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

The following code does not compile with libc++ trunk:

-----------------------------------------
#include <optional>
#include <cassert>


int main() {
  int i = 1, j = 2;
  std::optional<std::reference_wrapper<int&>> opt = i;
  assert(&*opt == &i);
  opt = j;
  assert(&*opt == &j);
}
-----------------------------------------

Live example: https://wandbox.org/permlink/vdqObz9zKRqNw5zJ

Our optional does not seem to support reference_wrapper properly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181109/0079a087/attachment.html>


More information about the llvm-bugs mailing list