<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 22, 2015 at 10:25 AM, Daniel Berenyi <span dir="ltr"><<a href="mailto:u235axe@gmail.com" target="_blank">u235axe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Dear All,<br><br></div>I'm using clang on windows under Visual Studio 2015 CTP 6. I've tried both the official binaries: <a href="http://llvm.org/releases/download.html" target="_blank">http://llvm.org/releases/download.html</a>, and this one: <a href="http://sourceforge.net/projects/clangonwin/postdownload?source=dlp" target="_blank">http://sourceforge.net/projects/clangonwin/postdownload?source=dlp</a> , and with all of them the following code fails to compile for me, but it is expected to be correct (based on stackoverflow), and it does comile with VS, and both clang and gcc on <a href="http://gcc.godbolt.org/" target="_blank">http://gcc.godbolt.org/</a><br><br>The code is the following, its is compiled with the additional flag:  -Xclang -std=c++14 <br></div><div><div><div><br>//-----------------------------------------------<br>template<typename F><br>  decltype(auto) deduce(F f){ return &decltype(f)::operator(); }<br><br>template<typename C, typename R, typename A> decltype(auto)<br>  signaturehelper( R(C::*f)(A)const ) { return R(); }<br><br>int main()<br>{<br>  auto l = [](int x){return x*2;};<br>  decltype(signaturehelper(deduce(l))) p;<br>}<br>//--------------------------------<br><br></div><div>It fails with:<br>decltype(signaturehelper(deduce(l))) p;<br>               ^~~~~~~~~~~~~~~<br>note: candidate template ignored: substitution failure [with C = (lambda at main.cpp:9:11), R = float, A = int]<br>decltype(auto) signaturehelper(R(C::*f)(A)const) { return R(); }<br></div><div><br></div><div>Other workarounds show that the compiler believes that the lambda has no member ::operator().<br><br>Am I overlooking something, or there is some problem with some settings / flags or the Windows build?<br></div></div></div></div></blockquote><div><br></div><div>Seems OK on 64-bit targets but fails for targets which have distinct cdecl/thiscall calling conventions like 32-bit mingw and 32-bit msvc.</div><div><br></div><div>Reid, any ideas?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div></div><div><br></div><div>Thanks in advance,<br></div><div>Daniel<br></div></div></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>