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

Geoffrey Romer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 15 17:10:22 PST 2019


gromer added a comment.

In D56731#1358926 <https://reviews.llvm.org/D56731#1358926>, @jdennett wrote:

> In D56731#1358907 <https://reviews.llvm.org/D56731#1358907>, @Quuxplusone wrote:
>
> > For my own use-cases, I will continue to want a 100% comprehensive `-Wctad`. All these "heuristics" you're proposing seem very ad-hoc, and make a lot of work for the compiler vendor, and seem complicated enough that I would still worry about bugs slipping through the cracks. Whereas, if the user can simply 100% outlaw CTAD, then they don't ever have to worry.
>
>
> That's fair; I don't think anyone here is speaking against such a diagnostic (though maybe the name will be a bikeshed).


Agreed.

> It's just that this patch is a solution for a different problem: allowing the sufficiently safe uses of CTAD without allowing too many bugs.

That makes it sound like a difference of degree, but I think it's more fundamental: those other warnings/heuristics/whatever are intended to protect //library users// against buggy uses of CTAD, but this one is intended to protect //library maintainers// from being forced to support CTAD usages that are correct (from the user's point of view), but that the maintainer didn't intend to support. So the only way that anything can "slip through the cracks" of this warning is if there's some way to use CTAD with a class template whose maintainers never intended to support CTAD, without triggering this warning (I'm reluctantly willing to exclude the case where user code opens up the library's namespace and adds a deduction guide, because I expect most maintainers will be only too happy to break such code).


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

https://reviews.llvm.org/D56731





More information about the cfe-commits mailing list