Open tsoj opened 3 months ago
Harry: type = {
operator(): (this, i: int) -> int = 123 + i;
}
Spiderman: type = {
operator*: (this) -> Harry = Harry();
operator*: (this, i: int) -> int = 456 + i;
}
main: () -> int = {
a: Spiderman = ();
b := (a*)(1 + 1);
c := a*(1 + 1);
std::cout << c << std::endl;
std::cout << b << std::endl;
}
I don't think in this case there is a way to disambiguate without parenthesis.
EDIT: ah, i guess this is basically the same as #1068
Describe the bug
Compiling this results in an error:
The same happens if I change the
&
to a*
. However, if I change the line toit works.
Maybe the problem is that here https://github.com/hsutter/cppfront/blob/c618ed507573e935d351b2918a6f1121a6e5bb5c/source/parse.h#L6058-L6073 it is not checked if the next token is one of the keywords that also suggest a binary
&
instead of a postfix one (i.e.this
,const_cast
, all the fundamental types, probably more that I am missing right now)EDIT: I guess this also happens with cases like
a := 1 * -(1);
though here the error happens in the cpp1 compilation. Or