diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index 0e2d2efa..96c311c7 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -1685,6 +1685,12 @@ Type* Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, // TODO: stubbed Ty = new PackExpansionType(); } + case clang::Type::Decltype: + { + auto DT = Type->getAs(); + Ty = WalkType(DT->getUnderlyingType()); + break; + } default: { Debug("Unhandled type class '%s'\n", Type->getTypeClassName()); diff --git a/src/Parser/Parser.cpp b/src/Parser/Parser.cpp index 87a5b605..f81b1482 100644 --- a/src/Parser/Parser.cpp +++ b/src/Parser/Parser.cpp @@ -1693,6 +1693,12 @@ CppSharp::AST::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* Ty = gcnew CppSharp::AST::PackExpansionType(); break; } + case Type::Decltype: + { + auto DT = Type->getAs(); + Ty = WalkType(DT->getUnderlyingType()); + break; + } default: { Debug("Unhandled type class '%s'\n", Type->getTypeClassName()); diff --git a/tests/Basic/Basic.Tests.cs b/tests/Basic/Basic.Tests.cs index e9fd6e1d..9ff8f769 100644 --- a/tests/Basic/Basic.Tests.cs +++ b/tests/Basic/Basic.Tests.cs @@ -301,6 +301,13 @@ public class BasicTests : GeneratorTestFixture Assert.AreEqual(classA.Value, classB.Value); ClassC classC = (ClassC)classB; Assert.AreEqual(classB.Value, classC.Value); + } + + [Test] + public unsafe void TestDecltype() + { + var ret = basic.TestDecltype(); + Assert.AreEqual(0, ret); } } \ No newline at end of file diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index 3a60dcfd..68073c04 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -447,3 +447,10 @@ public: explicit ClassC(const ClassB& x) { Value = x.Value; } int Value; }; + +// Test decltype +int Expr = 0; +DLL_API decltype(Expr) TestDecltype() +{ + return Expr; +} \ No newline at end of file