[llvm-bugs] [Bug 32861] New: Incorrect template argument deduction for conversion operator

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 29 19:29:18 PDT 2017


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

            Bug ID: 32861
           Summary: Incorrect template argument deduction for conversion
                    operator
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eniebler at boost.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The following compiles on gcc, but with clang-trunk, the static assertion
fails.

    #include <type_traits>

    void foo( int const & );

    struct S {
        template <class T>
        operator T& ()
        {
            static_assert(std::is_same<T&, int const&>::value,"");
            throw 42;
        }
    };

    int main() {
        foo(S{});
    }

I believe in this example "T" should be deduced to be "int const", not "int".

-- 
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/20170430/dbf55782/attachment.html>


More information about the llvm-bugs mailing list