diff --git a/cxxheaderparser/parser.py b/cxxheaderparser/parser.py index 3ec9e86..20e678f 100644 --- a/cxxheaderparser/parser.py +++ b/cxxheaderparser/parser.py @@ -1815,7 +1815,7 @@ class CxxParser: return dtype # Applies to variables and return values - _type_kwd_both = {"const", "constexpr", "extern", "inline", "static", "volatile"} + _type_kwd_both = {"const", "constexpr", "extern", "inline", "static"} # Only found on methods _type_kwd_meth = {"explicit", "virtual"} diff --git a/tests/test_typedef.py b/tests/test_typedef.py index 3a7d715..50a3084 100644 --- a/tests/test_typedef.py +++ b/tests/test_typedef.py @@ -876,3 +876,26 @@ def test_typedef_enum_expr(): ], ) ) + + +def test_volatile_typedef(): + content = """ + typedef volatile signed short vint16; + """ + data = parse_string(content, cleandoc=True) + + assert data == ParsedData( + namespace=NamespaceScope( + typedefs=[ + Typedef( + type=Type( + typename=PQName( + segments=[FundamentalSpecifier(name="signed short")] + ), + volatile=True, + ), + name="vint16", + ) + ] + ) + )