File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed
Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -1937,6 +1937,11 @@ def _parse_fn_end(self, fn: Function) -> None:
19371937 if self .lex .token_if ("{" ):
19381938 self ._discard_contents ("{" , "}" )
19391939 fn .has_body = True
1940+ elif self .lex .token_if ("=" ):
1941+ if self .lex .token_if_val ("delete" ):
1942+ fn .deleted = True
1943+ else :
1944+ raise self ._parse_error (None , "expected 'delete" )
19401945
19411946 def _parse_method_end (self , method : Method ) -> None :
19421947 """
Original file line number Diff line number Diff line change @@ -696,6 +696,7 @@ class Function:
696696 extern : typing .Union [bool , str ] = False
697697 static : bool = False
698698 inline : bool = False
699+ deleted : bool = False
699700
700701 #: If true, the body of the function is present
701702 has_body : bool = False
@@ -764,7 +765,6 @@ class Method(Function):
764765 constructor : bool = False
765766 explicit : bool = False
766767 default : bool = False
767- deleted : bool = False
768768
769769 destructor : bool = False
770770
Original file line number Diff line number Diff line change @@ -1313,3 +1313,25 @@ def test_msvc_inline() -> None:
13131313 ]
13141314 )
13151315 )
1316+
1317+
1318+ def test_deleted_function () -> None :
1319+ content = """
1320+ void trim() = delete;
1321+ """
1322+ data = parse_string (content , cleandoc = True )
1323+
1324+ assert data == ParsedData (
1325+ namespace = NamespaceScope (
1326+ functions = [
1327+ Function (
1328+ return_type = Type (
1329+ typename = PQName (segments = [FundamentalSpecifier (name = "void" )])
1330+ ),
1331+ name = PQName (segments = [NameSpecifier (name = "trim" )]),
1332+ parameters = [],
1333+ deleted = True ,
1334+ )
1335+ ]
1336+ )
1337+ )
You can’t perform that action at this time.
0 commit comments