RFR: JDK-8312395: Improve assertions in growableArray [v2]
Kim Barrett
kbarrett at openjdk.org
Thu Jul 20 15:33:51 UTC 2023
On Thu, 20 Jul 2023 11:22:30 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> > I think the use of `this->xxx` is just personal style. I find it unnecessary especially given the other uses in this file.
>
> Interestingly enough I get compiler errors when leaving out "this->" (GCC 10.3). It may be because the member is part of a templatized base class. Odd, though.
Qualification with `this->` is needed in a bunch of places here because of the
C++ name lookup rules. Unqualified name lookup does not search dependent base
classes. For example, in GrowableArrayWithAllocator an unqualified use of
`_len` won't find that member in the base class, but will instead (probably)
fail to find it in namespace scope during phase1 (pre-instantiation) template
checking lookup (of 2 phase lookup), and so fail to compile. It isn't possible
to resolve it in phase1 because the dependent base class definition isn't
known until instantiation.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14946#issuecomment-1644141370
More information about the hotspot-dev
mailing list