Open
Description
Did you check existing issues?
- I have read all the tree-sitter docs if it relates to using the parser
- I have searched the existing issues of tree-sitter-cpp
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version
)
No response
Describe the bug
extern template int Foo::foo<int>();
is treated as an ERROR, but actually it is valid.
Reference: https://en.cppreference.com/w/cpp/language/class_template
Steps To Reproduce/Bad Parse Tree
class Foo {
public:
template <typename T>
T foo();
};
extern template int Foo::foo<int>();
(declaration ; [6, 0] - [6, 36]
(storage_class_specifier) ; [6, 0] - [6, 6]
(ERROR ; [6, 7] - [6, 23]
(identifier) ; [6, 16] - [6, 19]
(identifier)) ; [6, 20] - [6, 23]
type: (qualified_identifier ; [6, 23] - [6, 33]
name: (template_type ; [6, 25] - [6, 33]
name: (type_identifier) ; [6, 25] - [6, 28]
arguments: (template_argument_list ; [6, 28] - [6, 33]
(type_descriptor ; [6, 29] - [6, 32]
type: (primitive_type))))) ; [6, 29] - [6, 32]
declarator: (parenthesized_declarator ; [6, 33] - [6, 35]
(identifier)))) ; [6, 34] - [6, 34]
Expected Behavior/Parse Tree
no ERROR.
Repro
class Foo {
public:
template <typename T>
T foo();
};
extern template int Foo::foo<int>();