CppAst.NET
CppAst.NET copied to clipboard
[Question]: Specialized template class parameter issue
Hi, I have the following class:
#include
template<typename DataType, typename Variant1, typename Variant2, typename Variant3> class Foo { public: Foo(const std::shared_ptr<DataType> & foo) : foo_{foo} {} Foo(const std::variant<Variant1, Variant2, Variant3> & bar) : bar_{bar} {} private: std::shared_ptr<DataType> foo_; std::variant<Variant1, Variant2, Variant3> bar_; };
using FooInt = Foo<int, double, char, long>;
Even when I check FooInt's attribute, I fail to see for example shared_ptr's template parameter being "resolved" to DataType, instead I get (I guess the STL default) "_Ty" when I check the constructor arguments.
If I do an -ast-dump with clang-15 for example, I can clearly see though that even the unspecialized template class definition contains the proper arguments for shared_ptr (I don't even see _Ty there), e.g.:
| | |-CXXConstructorDecl 0x56434eb1f3a8 <line:8:3, col:59> col:3 Foo<DataType, Variant1, Variant2, Variant3> 'void (const std::shared_ptr<DataType> &)' implicit-inline
| | | |-ParmVarDecl 0x56434eb1f270 <col:7, col:41> col:41 referenced foo 'const std::shared_ptr<DataType> &'
| | | |-CXXCtorInitializer Field 0x56434eb1fa00 'foo_' 'std::shared_ptr<DataType>':'shared_ptr<DataType>'
| | | | -InitListExpr 0x56434eb1fcc8 <col:52, col:56> 'void' | | | |
-DeclRefExpr 0x56434eb1fca8 col:53 'const std::shared_ptr<DataType>':'const shared_ptr<DataType>' lvalue ParmVar 0x56434eb1f270 'foo' 'const std::shared_ptr<DataType> &'
| | | `-CompoundStmt 0x56434eb1fd38 <col:58, col:59>
How should I / could I figure out that "_Ty" is actually "DataType" (same goes for std::variant's template parameters). Thanks,