aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorKrystian Stasiowski <sdkrystian@gmail.com>2024-09-09 12:06:45 -0400
committerGitHub <noreply@github.com>2024-09-09 12:06:45 -0400
commit3cdb30ebbc18fa894d3bd67aebcff76ce7c741ac (patch)
tree5a4e06e811beba36a5927a565003126a19e5035e /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parenteba6160deec5a32e4b31c2a446172d0e388195c9 (diff)
downloadllvm-3cdb30ebbc18fa894d3bd67aebcff76ce7c741ac.zip
llvm-3cdb30ebbc18fa894d3bd67aebcff76ce7c741ac.tar.gz
llvm-3cdb30ebbc18fa894d3bd67aebcff76ce7c741ac.tar.bz2
[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)
Currently, clang erroneously rejects the following: ``` struct A { template<typename T> void f(); }; template<typename T> struct B { void g() { (*this)->template f<int>(); // error: no member named 'f' in 'B<T>' } A* operator->(); }; ``` This happens because `Sema::ActOnStartCXXMemberReference` does not adjust the `ObjectType` parameter when `ObjectType` is a dependent type (except when the type is a `PointerType` and the class member access is the `->` form). Since the (possibly adjusted) `ObjectType` parameter (`B<T>` in the above example) is passed to `Parser::ParseOptionalCXXScopeSpecifier`, we end up looking up `f` in `B` rather than `A`. This patch fixes the issue by identifying cases where the type of the object expression `T` is a dependent, non-pointer type and: - `T` is the current instantiation and lookup for `operator->` finds a member of the current instantiation, or - `T` has at least one dependent base case, and `operator->` is not found in the current instantiation and using `ASTContext::DependentTy` as the type of the object expression when the optional _nested-name-specifier_ is parsed. Fixes #104268.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions