[PATCH] D26108: Add -Wnullability-completeness-on-arrays.

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 9 19:00:09 PST 2016


ahatanak added inline comments.


================
Comment at: lib/Sema/SemaType.cpp:3988
       // Allow arrays of auto if we are a generic lambda parameter.
       // i.e. [](auto (&array)[5]) { return array[0]; }; OK
       if (AT && D.getContext() != Declarator::LambdaExprParameterContext) {
----------------
jordan_rose wrote:
> ahatanak wrote:
> > This isn't something that is related to the changes made in this patch, but it looks like we issue a -Wnullability-completeness warning when there is a generic lambda like this:
> > 
> > ```
> > auto G2 = [](auto a){};
> > ```
> > 
> > Is this expected?
> It's not desired, but it's not a regression either. D26226 mentions how this comes up with explicit templates, so it doesn't surprise me that it happens with generic lambdas too.
It turns out it has nothing to do with this patch or your other patches. The warning is issued when there is a variable initialized with any kind of lambda:

```
auto G2 = [](int a){};
```

This happens because Type::canHaveNullability() returns true when it is an undeduced auto and checkNullabilityConsistency records its location.


Repository:
  rL LLVM

https://reviews.llvm.org/D26108





More information about the cfe-commits mailing list