class B {
friend bool operator<( B x, B y) { return true; }
}
Fails to parse with an Unexpected token 'EOF'.
In group, friend, not followed by class/struct/union, is assumed to be a C++11 friendship declaration with a simple-type-specifier.
bool is skipped, probably taken for some attributes, and a call to type on operator < throws the exception because it looks for template arguments until end of file.
This PR proposes a fix by never skipping the token after friend, so type will parse what is expected to be a type (bool in this case, instead of operator). I think that what needs to be skipped (attributes ?) only concerns non-friend declaration.
No changes in parsing for existing presets, but in Pytorch, where an addition declaration (ptr_to_first_element) is added in global.java. Without the PR, parsing of List.h ends prematurely because of a friend bool operator<.
Fails to parse with an
Unexpected token 'EOF'
.In
group
,friend
, not followed byclass
/struct
/union
, is assumed to be a C++11 friendship declaration with a simple-type-specifier.bool
is skipped, probably taken for some attributes, and a call totype
onoperator <
throws the exception because it looks for template arguments until end of file. This PR proposes a fix by never skipping the token afterfriend
, sotype
will parse what is expected to be a type (bool
in this case, instead ofoperator
). I think that what needs to be skipped (attributes ?) only concerns non-friend declaration.No changes in parsing for existing presets, but in Pytorch, where an addition declaration (
ptr_to_first_element
) is added inglobal.java
. Without the PR, parsing ofList.h
ends prematurely because of afriend bool operator<
.Allows to parse
intrusive_ptr.h
in Pytorch.