xoofx / xoofx/CppAst.NET

NullReferenceException when parsing instantiation of a previously partially specialised template

Open
#77 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
620
Forks
79
Avg merge
14h 27m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at CppModelBuilder.GetOrCreateDeclarationContainer and reproduce the provided C++ template specialization snippet. Trace how ClassTemplatePartialSpecialization cursors are handled before the instantiation container is created; done means the snippet parses without a NullReferenceException and the declaration container is created successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
compilers, devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.