4 ms·
The best bit is that the type name resolution depends on the current scope, but the scope itself is very unintuitive on edge cases. Jourdan and Pottier in their
by lifthrasiir 3y ago
The best bit is that the type name resolution depends on the current scope, but the scope itself is very unintuitive on edge cases. Jourdan and Pottier in their paper A Simple, Possibly Correct LR Parser for C11 [1] describe several edge cases, including the following case where scope is not necessarily consecutive:
typedef long T, U;
// T is an argument T is a typedef
// vvvvvvvvvvvvvvvvvvvvvvvvvvv ~~~
enum {V} (*f(T T, enum {U} y, int x[T+U]))(T t) {
// T is an argument (until the end of function)
// vvvvvvvvvvvvvvvvvvvvvv
long l = T+U+V+x[0]+y;
return 0;
}
[1] https://hal.science/hal-01633123/file/jourdan2017simple.pdf https://hal.science/hal-01633123/file/jourdan2017simple.pdf