[all-commits] [llvm/llvm-project] a642eb: [Clang][Sema] Fix crash when using name of Unresol...

Krystian Stasiowski via All-commits all-commits at lists.llvm.org
Tue Mar 5 05:52:32 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a642eb89bdaf10c6b4994fc1187de27b441236ed
      https://github.com/llvm/llvm-project/commit/a642eb89bdaf10c6b4994fc1187de27b441236ed
  Author: Krystian Stasiowski <sdkrystian at gmail.com>
  Date:   2024-03-05 (Tue, 05 Mar 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    A clang/test/SemaTemplate/unqual-unresolved-using-value.cpp

  Log Message:
  -----------
  [Clang][Sema] Fix crash when using name of UnresolvedUsingValueDecl with template arguments (#83842)

The following snippet causes a crash:
```
template<typename T>
struct A : T {
  using T::f;
  void f();

  void g() {
    f<int>(); // crash here
  }
};
```
This happens because we cast the result of `getAsTemplateNameDecl` as a
`TemplateDecl` in `Sema::ClassifyName`, which we cannot do for an
`UnresolvedUsingValueDecl`. This patch fixes the crash by considering a name
to be that of a template if _any_ function declaration is found per [temp.names] p3.3.



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