This is an archive of the discontinued LLVM Phabricator instance.

Sema: Fix PR12350 destructor name lookup, addressing (some of) DR244
Needs ReviewPublic

Authored by jmorse on Jun 12 2018, 3:45 AM.

Details

Summary

Hi,

This patch tries to fix a problem in clangs implementation of C++11's
[basic.lookup.qual]p6 as demonstrated in PR12350, by:

  • Re-enabling looking in name-specifier prefixes for destructor names, when the penultimate name is a class
  • In that case, forces the destructor name to be sought as a type-name

Which has some history. Looking in the name-specifier prefix for a
destructor name was partially disabled in r96836 for C++ < 11 because
name hiding could hide the final destructor name lookup (PR6358), and
then for all C++ in r107835 because the initial fix for D244 (r209319)
wasn't in.

However, the spec still specifies looking in the name-specifier prefix, and
without doing so bugs like PR12350 can't be fixed. This patch gets around
the original name hiding issue by forcing a type-name lookup if we're
looking in the name-specifier prefix where the penultimate is a class,
avoiding any hiding.

This is almost certainly what the spec intended, IMHO. You can read
[basic.lookup.qual]p6 as supporting this interpretation if you take the
pseudo destructors phrasing "...the type-names are looked up _as_ types
in the scope..." and assume that the class-name form being looked
up "Similarly" means that the second class-name should also be looked
up _as_ a class-name.

Diff Detail