ast_matcher capturesVar assertion failed in debug mode (original) (raw)
| AST_MATCHER_P(LambdaCapture, capturesVar, internal::Matcher, |
|---|
AST_MATCHER_P(LambdaCapture, capturesVar, internal::Matcher, InnerMatcher) { auto *capturedVar = Node.getCapturedVar(); return capturedVar && InnerMatcher.matches(*capturedVar, Finder, Builder); }
ValueDecl *getCapturedVar() const { assert(capturesVariable() && "No variable available for capture"); return static_cast<ValueDecl *>(DeclAndBits.getPointer()); }
The matcher relies on getCapturedVar returns nullptr if not captured, but the implementation asserts capturesVariable()