Fix handling of class member access into a vector type.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 14 Aug 2019 22:57:50 +0000 (22:57 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 14 Aug 2019 22:57:50 +0000 (22:57 +0000)
commit9e77f524b56985191c5ac6347abf391c5d9ba8ef
tree0550d8583d5f92101cfd8e0030598a1e80deccb7
parentcad8356d699b36c73abb267f65db575ddacbd652
Fix handling of class member access into a vector type.

When handling a member access into a non-class, non-ObjC-object type, we
would perform a lookup into the surrounding scope as if for an
unqualified lookup. If the member access was followed by a '<' and this
lookup (or the typo-correction for it) found a template name, we'd treat
the member access as naming that template.

Now we treat such accesses as never naming a template if the type of the
object expression is of vector type, so that vector component accesses
are never misinterpreted as naming something else. This is not entirely
correct, since it is in fact valid to name a template from the enclosing
scope in this context, when invoking a pseudo-destructor for the vector
type via an alias template, but that's very much a corner case, and this
change leaves that case only as broken as the corresponding case for
Objective-C types is.

This incidentally adds support for dr2292, which permits a 'template'
keyword at the start of a member access naming a pseudo-destructor.

llvm-svn: 368940
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/test/CXX/drs/dr22xx.cpp
clang/test/CXX/drs/dr4xx.cpp
clang/test/SemaCXX/cxx2a-adl-only-template-id.cpp
clang/test/SemaCXX/pseudo-destructors.cpp
clang/test/SemaCXX/vector.cpp