[llvm-bugs] [Bug 35332] New: reference binding and conversion operators to reference types

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 16 09:52:09 PST 2017


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

            Bug ID: 35332
           Summary: reference binding and conversion operators to
                    reference types
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kaballo86 at hotmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The following snippet compiles successfully, rather than resulting in calls to
deleted functions:

    struct convf {
      float f = 0;
      operator float&() { return f; }
      operator float const&() const { return f; }
    };

    template <typename T>
    void lvbind(T&) {}
    template <typename T>
    void lvbind(T&&) = delete;

    int main() {
      convf f;
      convf const fc;

      // lvbind<int>(f); // error: no match
      // lvbind<int>(fc); // error: no match
      lvbind<int const>(f);
      lvbind<int const>(fc);
    }

This is related to the resolution of LWG2993.

-- 
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/20171116/f5d99723/attachment.html>


More information about the llvm-bugs mailing list