-
Notifications
You must be signed in to change notification settings - Fork 640
Open
Description
Universal Ctags crashes with assertion failure in cxxScopePushTop at parsers/cxx/cxx_scope.c:238 when parsing complex C++ template specializations. The assertion false indicates an unexpected state in the scope stack management when handling member function pointer template specializations. Note, for this to crash the binary you need to run in debug mode.
Reproduced by:
// C++ template specialization that triggers scope management bug
template <class T>
struct TestUtil {
static bool isNull(const T&) { return false; }
};
template <class T>
struct TestUtil<T*> {
static bool isNull(T* f) { return 0 == f; }
};
template <class CLASS, class MEMTYPE>
inline
bool
TestUtil<MEMTYPE CLASS::*>::isNull(MEMTYPE CLASS::* f)
{
return 0 == f;
}# Save the above as scope_crash.h and run:
# This crashes with: cxxScopePushTop: Assertion `false' failed
./ctags -o /tmp/test scope_crash.hSuggested fix: Improve the C++ scope stack management to properly handle complex template specializations, especially member function pointer specializations. The scope parser needs better logic to track nested template contexts and their specializations.
Metadata
Metadata
Assignees
Labels
No labels