On Tue, Mar 20, 2018 at 7:37 PM, David Malcolm <dmalc...@redhat.com> wrote: > PR c++/84892 reports that we fail to offer fix-it hints about accessor > member functions when complaining about accesses to private fields > through const pointers and references. > > It turns out that field_accessor_p was incorrectly checking for "this" > being a "const *T", rather than being a "const T*". > We were also missing test coverage for this ("offer it for const") case > (we were only checking for the "don't offer it for non-const" case). > > Successfully bootstrapped and regression-tested on x86_64-pc-linux-gnu. > > OK for trunk? (not technically a regression, but affects a new feature) > > gcc/cp/ChangeLog: > PR c++/84892 > * search.c (field_accessor_p): Use class_of_this_parm rather than > type_of_this_parm, to check that "this" is a "const T *", rather > than a "T const *". ^^^^^^^^^ T *const
(const T* and T const* are the same type). The patch is OK. Jason