(translation_unit ; [0, 0] - [5, 0] cpp
(struct_specifier ; [0, 0] - [4, 1] cpp
name: (type_identifier) ; [0, 7] - [0, 8] cpp
body: (field_declaration_list ; [1, 0] - [4, 1] cpp
(function_definition ; [2, 4] - [2, 46] cpp
type: (primitive_type) ; [2, 4] - [2, 8] cpp
declarator: (function_declarator ; [2, 9] - [2, 35] cpp
declarator: (operator_name) ; [2, 9] - [2, 19] cpp
parameters: (parameter_list ; [2, 19] - [2, 29] cpp
(parameter_declaration ; [2, 20] - [2, 28] cpp
(type_qualifier) ; [2, 20] - [2, 25] cpp
type: (type_identifier) ; [2, 26] - [2, 27] cpp
declarator: (abstract_reference_declarator))) ; [2, 27] - [2, 28] cpp
(type_qualifier)) ; [2, 30] - [2, 35] cpp
(default_method_clause)) ; [2, 36] - [2, 46] cpp
(friend_declaration ; [3, 4] - [3, 43] cpp
(declaration ; [3, 11] - [3, 43] cpp
type: (primitive_type) ; [3, 11] - [3, 15] cpp
declarator: (init_declarator ; [3, 16] - [3, 42] cpp
declarator: (function_declarator ; [3, 16] - [3, 32] cpp
declarator: (operator_name) ; [3, 16] - [3, 26] cpp
parameters: (parameter_list ; [3, 26] - [3, 32] cpp
(parameter_declaration ; [3, 27] - [3, 28] cpp
type: (type_identifier)) ; [3, 27] - [3, 28] cpp
(parameter_declaration ; [3, 30] - [3, 31] cpp
type: (type_identifier)))) ; [3, 30] - [3, 31] cpp
value: (identifier))))))) ; [3, 35] - [3, 42] cpp
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version)No response
Describe the bug
In C++20,
operator==andoperator<=>can get marked asdefault. These operators do not have to be methods and can befriends instead. This does not get parsed correctly.Steps To Reproduce/Bad Parse Tree
Example (adapted from Default comparisons (cppreference))
(Bad) tree:
See that the
friendfunction with= defaultgot parsed as a declaration, and thedefaultgot parsed as a value, not a keyword.Expected Behavior/Parse Tree
Defaulted friend functions (currently probably only
operator==andoperator<=>) should get parsed as such.Repro