aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorKrystian Stasiowski <sdkrystian@gmail.com>2024-04-09 08:31:52 -0400
committerGitHub <noreply@github.com>2024-04-09 08:31:52 -0400
commit4657ab1c968e486e9f45329daa07340ebcf3bffd (patch)
tree598488af68bb71b3c84f04b20a9fec2b3f98522f /clang/lib/Frontend/InitPreprocessor.cpp
parent866a1bc814b4d4cb9aa3890eae56ffa05431741d (diff)
downloadllvm-4657ab1c968e486e9f45329daa07340ebcf3bffd.zip
llvm-4657ab1c968e486e9f45329daa07340ebcf3bffd.tar.gz
llvm-4657ab1c968e486e9f45329daa07340ebcf3bffd.tar.bz2
[Clang][Sema] Fix crash when 'this' is used in a dependent class scope function template specialization that instantiates to a static member function (#87541)
This patch fixes a crash that happens when '`this`' is referenced (implicitly or explicitly) in a dependent class scope function template specialization that instantiates to a static member function. For example: ``` template<typename T> struct A { template<typename U> static void f(); template<> void f<int>() { this; // causes crash during instantiation } }; template struct A<int>; ``` This happens because during instantiation of the function body, `Sema::getCurrentThisType` will return a null `QualType` which we rebuild the `CXXThisExpr` with. A similar problem exists for implicit class member access expressions in such contexts (which shouldn't really happen within templates anyways per [class.mfct.non.static] p2, but changing that is non-trivial). This patch fixes the crash by building `UnresolvedLookupExpr`s instead of `MemberExpr`s for these implicit member accesses, which will then be correctly rebuilt as `MemberExpr`s during instantiation.
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions