-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Consider the following parameter declaration:
void func(int* (x[3]))WrapVTK misinterprets x as a type, rather than as the parameter name, which the parser assumes is missing. Because of where it assumes the parameter name should be, it actually assumes the parameter is a function:
void func(int* f(x*))Whereas the correct parse would give the following:
void func(int** x)This is illustrative of a bug with our parser. When it encounters a parse where an identifier could be interpreted as either a parameter name or as a type, it sometimes misinterprets a parameter name as a type. For example, WrapVTK's parse would be correct if we replaced x with int, or if x is a typedef of int.
void func(int* (int[3]))Here, int cannot be interpreted as a parameter name, therefore we (and any parser) must assume that the parameter name is missing from the declaration i.e. void func(int* f(int[3])).
A real C++ parser will know, from previous definitions, whether x is a type. But our parser doesn't utilize previous definitions to adjust its parse.
In any case, this is an edge case of the C++ grammar, and it doesn't come up often in real code.
So back to your regular scheduled programming...