| 1 |
/* Origin PR preprocessor/64803 |
| 2 |
|
| 3 |
This test ensures that the value the __LINE__ macro expands to is |
| 4 |
constant and corresponds to the line of the macro expansion point |
| 5 |
the function-like macro expansion it's part of. |
| 6 |
|
| 7 |
{ dg-do run } |
| 8 |
{ dg-options -no-integrated-cpp } */ |
| 9 |
|
| 10 |
#include <assert.h> |
| 11 |
|
| 12 |
#define C(a, b) a ## b |
| 13 |
#define L(x) C(L, x) |
| 14 |
#define M(a) int L(__LINE__) = __LINE__; assert(L(__LINE__) == __LINE__); |
| 15 |
|
| 16 |
int |
| 17 |
main() |
| 18 |
{ |
| 19 |
M(a |
| 20 |
); |
| 21 |
|
| 22 |
assert(L19 == 19); /* 19 is the line number of the |
| 23 |
macro expansion point of the |
| 24 |
invocation of the M macro. Please |
| 25 |
adjust in case the layout of this |
| 26 |
file changes. */ |
| 27 |
return 0; |
| 28 |
} |