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

            Bug ID: 30262
           Summary: user-defined operators are not called on lambda
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: mikhail.strelni...@gmail.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Following code prints "clang" when compiled with clang and prints "gcc or msvc"
when compiled with gcc or msvc.

#include <iostream>

namespace other
{
    template<typename F>
    void bar(F && f)
    {
        (*(&f))();
    }
}

namespace n
{
    template<typename>
    struct o {  };
    template<typename>
    struct p { void operator()(){ std::cout << "gcc or msvc" << std::endl; } };

    template<typename T>
    constexpr auto operator&(T)
    {
        return o<T>{};
    }
    template<typename T>
    constexpr auto operator*(T)
    {
        return p<T>{};
    }

    void foo()
    {
        other::bar([](){ std::cout << "clang" << std::endl; });
    }
}

int main()
{
    n::foo();
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to