[clang] [Clang] use parent declaration context to avoid asserting cast failure in defaulted comparison method (PR #96228)

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 24 09:08:14 PDT 2024


================
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
----------------
a-tarasyuk wrote:

@shafik Thanks for the feedback. I've moved the test to the appropriate existing test. From my understanding, the crash is related to this

https://github.com/llvm/llvm-project/blob/f985a8826bfa4ca3d23e654185de35e30ea6dc79/clang/include/clang/AST/DeclBase.h#L897-L914

In the case of `void s::f()`, `getLexicalParent` returned the global context, which caused the crash. Does that make sense? Or is there a better way to handle this? Please let me know what your thoughts are about that case.

https://github.com/llvm/llvm-project/pull/96228


More information about the cfe-commits mailing list