diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index e5f355cf..4c930315 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -3034,14 +3034,13 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F, F->operatorKind = GetOperatorKindFromDecl(FD->getDeclName()); TypeLoc RTL; + FunctionTypeLoc FTL; if (auto TSI = FD->getTypeSourceInfo()) { auto Loc = DesugarTypeLoc(TSI->getTypeLoc()); - auto FTL = Loc.getAs(); + FTL = Loc.getAs(); if (FTL) { - F->qualifiedType = GetQualifiedType(FD->getType(), &FTL); - RTL = FTL.getReturnLoc(); auto& SM = c->getSourceManager(); @@ -3052,16 +3051,13 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F, HandlePreprocessedEntities(F, headRange, MacroLocation::FunctionHead); HandlePreprocessedEntities(F, FTL.getParensRange(), MacroLocation::FunctionParameters); } - else - F->qualifiedType = GetQualifiedType(FD->getType()); } - else - F->qualifiedType = GetQualifiedType(FD->getType()); auto ReturnType = FD->getReturnType(); if (FD->isExternallyVisible()) CompleteIfSpecializationType(ReturnType); F->returnType = GetQualifiedType(ReturnType, &RTL); + F->qualifiedType = GetQualifiedType(FD->getType(), &FTL); const auto& Mangled = GetDeclMangledName(FD); F->mangled = Mangled; diff --git a/tests/CSharp/CSharp.Tests.cs b/tests/CSharp/CSharp.Tests.cs index 04eb044d..8871ddd1 100644 --- a/tests/CSharp/CSharp.Tests.cs +++ b/tests/CSharp/CSharp.Tests.cs @@ -71,6 +71,9 @@ public unsafe class CSharpTests : GeneratorTestFixture } CSharp.CSharp.FunctionInsideInlineNamespace(); + using (CSharpTemplates.SpecialiseReturnOnly()) + { + } #pragma warning restore 0168 #pragma warning restore 0219 diff --git a/tests/CSharp/CSharpTemplates.cpp b/tests/CSharp/CSharpTemplates.cpp index 398be139..514e23b7 100644 --- a/tests/CSharp/CSharpTemplates.cpp +++ b/tests/CSharp/CSharpTemplates.cpp @@ -129,3 +129,8 @@ void forceUseSpecializations(IndependentFields _1, IndependentFields TemplateWithIndexer _12, TemplateDerivedFromRegularDynamic _13, std::string s) { } + +DependentValueFields specialiseReturnOnly() +{ + return DependentValueFields(); +} diff --git a/tests/CSharp/CSharpTemplates.h b/tests/CSharp/CSharpTemplates.h index e14205af..66c8d137 100644 --- a/tests/CSharp/CSharpTemplates.h +++ b/tests/CSharp/CSharpTemplates.h @@ -486,6 +486,8 @@ void forceUseSpecializations(IndependentFields _1, IndependentFields TemplateWithIndexer _10, TemplateWithIndexer _11, TemplateWithIndexer _12, TemplateDerivedFromRegularDynamic _13, std::string s); +DLL_API DependentValueFields specialiseReturnOnly(); + // force the symbols for the template instantiations because we do not have the auto-compilation for the generated C++ source template class DLL_API IndependentFields; template class DLL_API IndependentFields;