[llvm-bugs] [Bug 24767] New: clang does not reject ambiguous function call

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 10 00:28:53 PDT 2015


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

            Bug ID: 24767
           Summary: clang does not reject ambiguous function call
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dimanne at ya.ru
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

clang compiles well following code (since clang 3.5), but should NOT according
to standard (http://pastebin.com/aVVbjw7A). Also see this thread
http://stackoverflow.com/questions/29661253/overloaded-lambdas-in-c-and-differences-between-clang-and-gcc


#include <utility>

template <class... Ts>
class TMultiLambda: public Ts... {
public:
    template <class... Fs>
    TMultiLambda(Fs&&... Vs) noexcept: Ts(std::forward<Fs>(Vs))... {
    }
};
template <class... Ts>
auto MakeMultiLambda(Ts&&... Vs) noexcept ->
TMultiLambda<std::remove_reference_t<Ts>...> {
    return { std::forward<Ts>(Vs)... };
}

int main() {
    int x;
    auto a = [x](int, int) { };
    auto b = [x] (char) { };
    auto c = MakeMultiLambda(a, b);
    c(2, 2);
    c('q');
    return 0;
}


P.S.
It seems you differently handle/treat methods and operator(). If operator()
change to function f() clang stops compiling this code.

-- 
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/20150910/cca1cbe4/attachment.html>


More information about the llvm-bugs mailing list