File tree Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -1987,7 +1987,7 @@ def _parse_method_end(self, method: Method) -> None:
19871987 if self .lex .token_if ("{" ):
19881988 self ._discard_contents ("{" , "}" )
19891989 method .has_body = True
1990- break
1990+ break
19911991 elif tok_value == "throw" :
19921992 tok = self ._next_token_must_be ("(" )
19931993 method .throw = self ._create_value (self ._consume_balanced_tokens (tok ))
Original file line number Diff line number Diff line change @@ -1196,6 +1196,59 @@ class C {
11961196 )
11971197
11981198
1199+ def test_pure_virtual_trailing_return () -> None :
1200+ content = """
1201+ class C {
1202+ public:
1203+ int x;
1204+ virtual auto GetSelected() -> decltype(x) = 0;
1205+ };
1206+ """
1207+ data = parse_string (content , cleandoc = True )
1208+
1209+ assert data == ParsedData (
1210+ namespace = NamespaceScope (
1211+ classes = [
1212+ ClassScope (
1213+ class_decl = ClassDecl (
1214+ typename = PQName (
1215+ segments = [NameSpecifier (name = "C" )], classkey = "class"
1216+ )
1217+ ),
1218+ fields = [
1219+ Field (
1220+ access = "public" ,
1221+ type = Type (
1222+ typename = PQName (
1223+ segments = [FundamentalSpecifier (name = "int" )]
1224+ )
1225+ ),
1226+ name = "x" ,
1227+ )
1228+ ],
1229+ methods = [
1230+ Method (
1231+ return_type = Type (
1232+ typename = PQName (
1233+ segments = [
1234+ DecltypeSpecifier (tokens = [Token (value = "x" )])
1235+ ]
1236+ )
1237+ ),
1238+ name = PQName (segments = [NameSpecifier (name = "GetSelected" )]),
1239+ parameters = [],
1240+ has_trailing_return = True ,
1241+ pure_virtual = True ,
1242+ virtual = True ,
1243+ access = "public" ,
1244+ )
1245+ ],
1246+ )
1247+ ]
1248+ )
1249+ )
1250+
1251+
11991252def test_fn_trailing_return_with_body () -> None :
12001253 content = """
12011254 auto test() -> void
You can’t perform that action at this time.
0 commit comments