CppAst.NET icon indicating copy to clipboard operation
CppAst.NET copied to clipboard

Fix FullParentName for types not in a root namespace

Open Petezah opened this issue 1 year ago • 2 comments

This was an issue I ran into while making a code generator. I didn't end up depending on this codepath, but thought it might still be useful to you or other users of the library. Unfortunately, I cannot remember how to repro the issue I was seeing.

Petezah avatar Oct 21 '24 19:10 Petezah

This was an issue I ran into while making a code generator. I didn't end up depending on this codepath, but thought it might still be useful to you or other users of the library. Unfortunately, I cannot remember how to repro the issue I was seeing.

Yeah, this part can be a bit messy to get right, and the halo effect could be annoying so I will keep this PR around for now until someone found a similar issue and provides a repro so that it can be investigated properly.

xoofx avatar Nov 13 '24 20:11 xoofx

I also hit this issue when parsing template type parameters defined in the STL. Here is a simple example that hits this issue:

#include <ratio>

template <typename T>
struct foo
{
    T bar;
};

foo<std::ratio<0, 1>> test;

and here is the exception stack trace:

Unhandled exception. System.NotImplementedException: Can not be here, not support type here!
   at CppAst.CppElement.get_FullParentName()
   at CppAst.CppClass.get_FullName()
   at CppAst.CppTemplateArgument.get_ArgString()
   at CppAst.CppTemplateArgument.ToString()
   at CppAst.CppClass.ToString()
   at System.IO.TextWriter.WriteLine(Object value)
   at System.IO.TextWriter.SyncTextWriter.WriteLine(Object value)
   at System.Console.WriteLine(Object value)
   at Program.<Main>$(String[] args) in Program.cs:line 48

cjkfdev avatar Dec 31 '24 19:12 cjkfdev

Closing this issue, as I believe that it might have been fixed in the past months, but couldn't check (though I hit a similar issue). Haven't verified with the template case above but hopefully it's solved. 🤞

xoofx avatar Nov 20 '25 08:11 xoofx