[llvm-bugs] [Bug 40989] decltype resolution ignores SFINAE

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 6 16:55:33 PST 2019


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

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
The problem is that the recursive call happens here:

typename std::enable_if<!std::is_same<T, two>::value, decltype(rhs +
lhs)>::type
                                                               ^~~~~~~~~

whereas the SFINAEable error happens later, here:

typename std::enable_if<!std::is_same<T, two>::value, decltype(rhs +
lhs)>::type
                                                                         
^~~~~~

... so this doesn't work. You need the SFINAE check to precede the computation 
of the decltype type. I've written up an example of how to do that in PR40988.

-- 
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/20190307/58dc9689/attachment.html>


More information about the llvm-bugs mailing list