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 @@ -1773,7 +1773,7 @@ def _parse_method_end(self, method: Method) -> None:
1773
1773
setattr (method , tok_value , True )
1774
1774
elif tok_value in ("&" , "&&" ):
1775
1775
method .ref_qualifier = tok_value
1776
- elif tok_value == "ARROW " :
1776
+ elif tok_value == "-> " :
1777
1777
self ._parse_trailing_return_type (method )
1778
1778
break
1779
1779
elif tok_value == "throw" :
Original file line number Diff line number Diff line change 4
4
Array ,
5
5
AutoSpecifier ,
6
6
ClassDecl ,
7
+ DecltypeSpecifier ,
8
+ Field ,
7
9
Function ,
8
10
FunctionType ,
9
11
FundamentalSpecifier ,
@@ -1141,3 +1143,54 @@ def test_noexcept_contents() -> None:
1141
1143
]
1142
1144
)
1143
1145
)
1146
+
1147
+
1148
+ def test_auto_decltype_return () -> None :
1149
+ content = """
1150
+ class C {
1151
+ public:
1152
+ int x;
1153
+ auto GetSelected() -> decltype(x);
1154
+ };
1155
+ """
1156
+ data = parse_string (content , cleandoc = True )
1157
+
1158
+ assert data == ParsedData (
1159
+ namespace = NamespaceScope (
1160
+ classes = [
1161
+ ClassScope (
1162
+ class_decl = ClassDecl (
1163
+ typename = PQName (
1164
+ segments = [NameSpecifier (name = "C" )], classkey = "class"
1165
+ )
1166
+ ),
1167
+ fields = [
1168
+ Field (
1169
+ access = "public" ,
1170
+ type = Type (
1171
+ typename = PQName (
1172
+ segments = [FundamentalSpecifier (name = "int" )]
1173
+ )
1174
+ ),
1175
+ name = "x" ,
1176
+ )
1177
+ ],
1178
+ methods = [
1179
+ Method (
1180
+ return_type = Type (
1181
+ typename = PQName (
1182
+ segments = [
1183
+ DecltypeSpecifier (tokens = [Token (value = "x" )])
1184
+ ]
1185
+ )
1186
+ ),
1187
+ name = PQName (segments = [NameSpecifier (name = "GetSelected" )]),
1188
+ parameters = [],
1189
+ has_trailing_return = True ,
1190
+ access = "public" ,
1191
+ )
1192
+ ],
1193
+ )
1194
+ ]
1195
+ )
1196
+ )
You can’t perform that action at this time.
0 commit comments