diff --git a/src/AST/CppTypePrinter.cs b/src/AST/CppTypePrinter.cs index 513c83b1..572d902b 100644 --- a/src/AST/CppTypePrinter.cs +++ b/src/AST/CppTypePrinter.cs @@ -39,7 +39,8 @@ namespace CppSharp.AST public string VisitTagType(TagType tag, TypeQualifiers quals) { - return tag.Declaration.Visit(this); + var qual = PrintTypeQualifiers && quals.IsConst ? "const " : string.Empty; + return string.Format("{0}{1}", qual, tag.Declaration.Visit(this)); } public string VisitArrayType(ArrayType array, TypeQualifiers quals) diff --git a/src/Generator.Tests/AST/TestAST.cs b/src/Generator.Tests/AST/TestAST.cs index 993e7b66..b810fe00 100644 --- a/src/Generator.Tests/AST/TestAST.cs +++ b/src/Generator.Tests/AST/TestAST.cs @@ -408,5 +408,14 @@ namespace CppSharp.Generator.Tests.AST Assert.That(template.Specializations[0].Constructors.First().QualifiedName, Is.Not.EqualTo(template.Specializations[1].Constructors.First().QualifiedName)); } + + [Test] + public void TestPrintingSpecializationWithConstValue() + { + var template = AstContext.FindDecl("TestSpecializationArguments").First(); + var cppTypePrinter = new CppTypePrinter { PrintScopeKind = CppTypePrintScopeKind.Qualified }; + Assert.That(template.Specializations.Last().Visit(cppTypePrinter), + Is.EqualTo("TestSpecializationArguments")); + } } } diff --git a/tests/Native/AST.h b/tests/Native/AST.h index c46d1b48..3ee30d5d 100644 --- a/tests/Native/AST.h +++ b/tests/Native/AST.h @@ -154,3 +154,5 @@ class ForwardedTemplate; typedef ForwardedTemplate i; typedef ForwardedTemplate l; + +template class TestSpecializationArguments;