Here is a simple function with one int parameter:
void f(int x) {}
f(42);
And here is another function with one int parameter:
void g(int(x)) {}
g(42);
Now let us define x to be a type:
typedef int x;
void h(int(x)) {}
h(42);
// warning: passing argument 1 of ‘h’ makes pointer from integer without a cast
(This is the behavior I observe with gcc 4.8.2)
How do parser writers deal with this situation?
It seems the classic pipeline Lexer -> Parser -> Semantic Checker -> ... does not work here.
Aucun commentaire:
Enregistrer un commentaire