Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cxxheaderparser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ def _parse_fn_end(self, fn: Function) -> None:
if self.lex.token_if("{"):
self._discard_contents("{", "}")
fn.has_body = True
elif self.lex.token_if("="):
if self.lex.token_if_val("delete"):
fn.deleted = True
else:
raise self._parse_error(None, "expected 'delete")

def _parse_method_end(self, method: Method) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion cxxheaderparser/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ class Function:
extern: typing.Union[bool, str] = False
static: bool = False
inline: bool = False
deleted: bool = False

#: If true, the body of the function is present
has_body: bool = False
Expand Down Expand Up @@ -764,7 +765,6 @@ class Method(Function):
constructor: bool = False
explicit: bool = False
default: bool = False
deleted: bool = False

destructor: bool = False

Expand Down
22 changes: 22 additions & 0 deletions tests/test_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,3 +1313,25 @@ def test_msvc_inline() -> None:
]
)
)


def test_deleted_function() -> None:
content = """
void trim() = delete;
"""
data = parse_string(content, cleandoc=True)

assert data == ParsedData(
namespace=NamespaceScope(
functions=[
Function(
return_type=Type(
typename=PQName(segments=[FundamentalSpecifier(name="void")])
),
name=PQName(segments=[NameSpecifier(name="trim")]),
parameters=[],
deleted=True,
)
]
)
)
Loading