xref: /llvm-project/clang/test/C/drs/dr483.c (revision 7fc57d7c97c64b64ef865d71343867ab30cfcf15)
1 /* RUN: %clang_cc1 -std=c89 -verify -pedantic -Wno-c11-extensions %s
2    RUN: %clang_cc1 -std=c99 -verify -pedantic -Wno-c11-extensions %s
3    RUN: %clang_cc1 -std=c11 -verify -pedantic %s
4    RUN: %clang_cc1 -std=c17 -verify -pedantic %s
5    RUN: %clang_cc1 -std=c2x -verify -pedantic %s
6  */
7 
8 /* expected-no-diagnostics */
9 
10 /* WG14 DR483: yes
11  * __LINE__ and __FILE__ in macro replacement list
12  *
13  * The crux of this DR is to ensure that __LINE__ (and __FILE__) use in a macro
14  * replacement list report the line and file of the expansion of that macro,
15  * not the line and file of the macro definition itself.
16  */
17 #line 500
18 #define MAC() __LINE__
19 
20 #line 1000
21 _Static_assert(MAC() == 1000, "");
22 
23