On Jan 18, 2017 7:34 PM, "Akira Hatanaka via Phabricator" < revi...@reviews.llvm.org> wrote:
ahatanak added a comment. In https://reviews.llvm.org/D28467#649861, @krasin wrote: > This change makes Clang hardly incompatible with MSVC++. Consider the following program: > > #include <stdio.h> > > int main(void) { > const int kDelta = 10000001; > auto g = [kDelta](int i) > { > printf("%d\n", i % kDelta); > }; > g(2); > } > > > Clang will warn about the unused lambda capture: > > $ clang++ lala.cc -o lala -std=c++14 -Wall -Werror && ./lala > lala.cc:5:13: error: lambda capture 'kDelta' is not required to be captured for use in an unevaluated context [-Werror,-Wunused-lambda-capture] > auto g = [kDelta](int i) > ^ > 1 error generated. > Is kDelta considered to be used in an unevaluated context here? I thought unevaluated context in c++ means the expression is used as operands of operators such as typeid and decltype. It is not used in an unevaluated context -- that is a bug. ~Aaron Repository: rL LLVM https://reviews.llvm.org/D28467
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits