[llvm-bugs] [Bug 37504] Lambda should implicitly capture constexpr variable

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 17 22:40:19 PDT 2018


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

Frédéric <ufospoke at gmail.com> changed:

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

--- Comment #6 from Frédéric <ufospoke at gmail.com> ---
OK, I went to the end of this and I am sorry to have disturbed you but it seems
that I was wrong. The thing is that in the same function I had multiple lambdas
referring to a constexpr std::size_t. And for some of them I could remove the
capture and not for the others. So the warning was related to one of the
lambda, and I tried to remove all captures so it did not work.

I now understand that if a lambda uses a constexpr variable in a call with a
const reference, the constexpr must be capture to have a reference at the time
of the call where the reference to the original variable is not accessible.

Thanks for your help.

-- 
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/20180518/b6504202/attachment.html>


More information about the llvm-bugs mailing list