From 86bd7340e2acc7026497ecbfd0599065f6708449 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Mon, 4 Jul 2016 22:41:59 +0300 Subject: [PATCH] Fixed the parsing of fields with a template template parameter type. Signed-off-by: Dimitar Dobrev --- src/AST/TypeExtensions.cs | 18 +++++++++++++----- tests/Common/Common.h | 6 ++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/AST/TypeExtensions.cs b/src/AST/TypeExtensions.cs index 35efbe0f..5a0ad6e4 100644 --- a/src/AST/TypeExtensions.cs +++ b/src/AST/TypeExtensions.cs @@ -134,11 +134,19 @@ return decl != null; } - var templatedClass = ((ClassTemplate) type.Template).TemplatedClass; - decl = templatedClass.CompleteDeclaration == null - ? templatedClass as T - : (T) templatedClass.CompleteDeclaration; - return decl != null; + var classTemplate = type.Template as ClassTemplate; + if (classTemplate != null) + { + var templatedClass = classTemplate.TemplatedClass; + decl = templatedClass.CompleteDeclaration == null + ? templatedClass as T + : (T) templatedClass.CompleteDeclaration; + return decl != null; + } + + var templateTemplateParameter = type.Template as TemplateTemplateParameter; + if (templateTemplateParameter != null) + return (decl = templateTemplateParameter.TemplatedDecl as T) != null; } tagType = (TagType) type.Desugared; } diff --git a/tests/Common/Common.h b/tests/Common/Common.h index 2fa25baf..40ed1a9d 100644 --- a/tests/Common/Common.h +++ b/tests/Common/Common.h @@ -1154,3 +1154,9 @@ struct _Aligned<_Len, char> }; typedef _Aligned<16, char>::type type; + +template class InteriorRings = SpecialisesVoid> +struct polygon +{ + InteriorRings interior_rings; +};