diff --git a/tests/test_attributes.py b/tests/test_attributes.py index f1d62ce..122bada 100644 --- a/tests/test_attributes.py +++ b/tests/test_attributes.py @@ -12,6 +12,8 @@ from cxxheaderparser.types import ( NameSpecifier, PQName, Pointer, + TemplateDecl, + TemplateTypeParam, Token, Type, Typedef, @@ -201,3 +203,31 @@ def test_friendly_declspec(): ] ) ) + + +def test_declspec_template(): + content = """ + template + __declspec(deprecated("message")) + static T2 fn() { return T2(); } + """ + data = parse_string(content, cleandoc=True) + + assert data == ParsedData( + namespace=NamespaceScope( + functions=[ + Function( + return_type=Type( + typename=PQName(segments=[NameSpecifier(name="T2")]) + ), + name=PQName(segments=[NameSpecifier(name="fn")]), + parameters=[], + static=True, + has_body=True, + template=TemplateDecl( + params=[TemplateTypeParam(typekey="class", name="T2")] + ), + ) + ] + ) + )