[PATCH] D56731: Add -Wimplicit-ctad warning to diagnose CTAD on types with no user defined deduction guides.

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 15 23:00:40 PST 2019


Quuxplusone added a comment.

In D56731#1359190 <https://reviews.llvm.org/D56731#1359190>, @rsmith wrote:

> we need to keep in mind while making that decision that a warning that is either off-by-default or turned off by nearly everyone delivers much less value


Agreed. I would expect the D54565 <https://reviews.llvm.org/D54565> version of `-Wctad` to be off-by-default, but turned **on** by nearly everyone, so it'd be a middle road. We'd have to try it and see. :)

> Are there open-source projects making use of CTAD on which we could perform an analysis?

I think that's the same question as "Are there open-source projects making use of C++17?" If C++17 projects exist, then either they're making use of CTAD on purpose, or they're making use of it accidentally (in which case `-Wctad` would be able to count the number of accidents).  I just went and did an analysis of yomm2, Yato, and nytl: https://quuxplusone.github.io/blog/2019/01/16/counting-ctad/
yomm2 and Yato do not use CTAD. nytl uses CTAD heavily and intentionally, and 5 of its 30 instances are on a single class which has no deduction guides. (I //think// there's no bug. If it is a subtle bug, then that would be amazingly strong evidence in favor of Eric's heuristic!)

----

> Hmm, I think I was actually thinking of cases more like:
> 
>   vector<string> s = {{"foo", "bar"}};
>    
> 
> ... which I have seen come up quite a lot.

Yikes! That's a new one to me. But not CTAD-related, I agree. :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56731/new/

https://reviews.llvm.org/D56731





More information about the cfe-commits mailing list