[all-commits] [llvm/llvm-project] a8fd0d: [Clang][Sema] Diagnose class member access express...

Krystian Stasiowski via All-commits all-commits at lists.llvm.org
Thu Apr 25 11:51:14 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a8fd0d029dca7d17eee72d0445223c2fe1ee7758
      https://github.com/llvm/llvm-project/commit/a8fd0d029dca7d17eee72d0445223c2fe1ee7758
  Author: Krystian Stasiowski <sdkrystian at gmail.com>
  Date:   2024-04-25 (Thu, 25 Apr 2024)

  Changed paths:
    M clang-tools-extra/clangd/unittests/FindTargetTests.cpp
    M clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
    M clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/owning-memory.cpp
    M clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Sema/Lookup.h
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/Expr.cpp
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Sema/HLSLExternalSemaSource.cpp
    M clang/lib/Sema/SemaAttr.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaExprMember.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Sema/SemaOpenMP.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/test/AST/HLSL/this-reference-template.hlsl
    M clang/test/CXX/drs/dr2xx.cpp
    M clang/test/CXX/drs/dr3xx.cpp
    A clang/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p4.cpp
    M clang/test/CXX/temp/temp.res/temp.local/p3.cpp
    M clang/test/CodeGenCXX/mangle.cpp
    M clang/test/Index/annotate-nested-name-specifier.cpp
    M clang/test/SemaCXX/member-expr.cpp
    M clang/test/SemaTemplate/instantiate-function-1.cpp
    M clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

  Log Message:
  -----------
  [Clang][Sema] Diagnose class member access expressions naming non-existent members of the current instantiation prior to instantiation in the absence of dependent base classes (#84050)

Consider the following:
```cpp
template<typename T>
struct A
{
    auto f()
    {
        return this->x;
    }
};
```
Although `A` has no dependent base classes and the lookup context for
`x` is the current instantiation, we currently do not diagnose the
absence of a member `x` until `A<T>::f` is instantiated. This patch
moves the point of diagnosis for such expressions to occur at the point
of definition (i.e. prior to instantiation).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list