[llvm-bugs] [Bug 35034] New: An R-value to L-value reference binding in a templated constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 23 06:34:36 PDT 2017


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

            Bug ID: 35034
           Summary: An R-value to L-value reference binding in a templated
                    constructor
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: poltavsky.alexandr at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

A really nasty bug:

template<typename T>
struct data {

  template<typename U>
  data( U && value ) : _value{ T( std::forward<U>( value ) ) } {}

  T _value;
};

data< int& > d{ 10 }; //okay on Clang, not okay on GCC & MSVC

https://godbolt.org/g/TrgJCp

The initial intent for the code was to avoid strict init rules for uniform
initialization in a converting constructor.

-- 
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/20171023/b1850766/attachment.html>


More information about the llvm-bugs mailing list