NullReferenceException when parsing instantiation of a previously partially specialised template
s1sw opened this issue · 6 comments
Parsing the following code causes a NullReferenceException:
template<typename A, typename B>
struct foo {};
template<typename B>
struct foo<int, B> {};
foo<int, int> foobar;
CppModelBuilder.GetOrCreateDeclarationContainer
doesn't handle ClassTemplatePartialSpecialization
cursors. This causes it to return null, which later causes the exception when trying to create a declaration container for the instantiation.
@fangfang1984 as you have changed that code recently, maybe that's something you would have an interest to check/fix?
Ok, I will try to fix it.
I've attempted to reproduce this error on the latest CppAst.Net and found that the issue has already been fixed in recent adjustments. The TemplatePartialSpecialized should work properly in the new code. Please try again with the latest code, the corresponding 'foobar' field should now be recognized correctly.
This is an excellent sample code for verifying whether partial template specialization works correctly, i will try to add it to tests code.
I've attempted to reproduce this error on the latest CppAst.Net and found that the issue has already been fixed in recent adjustments.
Releasing the latest commit, forgot to do it.
I've attempted to reproduce this error on the latest CppAst.Net and found that the issue has already been fixed in recent adjustments.
Releasing the latest commit, forgot to do it.
I've just added the sample code for partial specialized template and related feature enhancements, and submitted a PR (Pull Request).