Issue |
145658
|
Summary |
[Clang] Implement P2843R3 - Preprocessing is never undefined
|
Labels |
clang,
c++26
|
Assignees |
|
Reporter |
cor3ntin
|
Here are some test cases for this paper.
The limitations on line numbers may be a bit restrictive, show we ask WG21 to make that implementation defined?
We currently do not diagnose directives in arguments of function macros, so this should
probably comes with an opt-out mechanism
```cpp
// [cpp.include]: nothing to do
#define FOO invalid
#include FOO
// expected-error@-1 {{expected "FILENAME" or <FILENAME>}}
// [cpp.cond]
#define DEFINED defined
#if DEFINED(bar) // Should be an error
#endif
// [cpp.replace.general]
#define FUNCTION_MACRO(...)
FUNCTION_MACRO(
#if 0 // should diagnose
#endif
)
// [cpp.stringize]: nothing to do
#define STR(x) # x
const char* a = STR(\o{999});
// [cpp.concat]: nothing to do
#define CONCAT(A, B) A ## B
CONCAT(=, >)
// expected-error@-1 {{pasting formed '=>', an invalid preprocessing token}}
// [cpp.predefined]
#undef defined
// expected-error@-1 {{error: 'defined' cannot be used as a macro name}}
#undef __DATE__
// expected-warning@-1 {{undefining builtin macro}}
// should be turned into an error by default
// [cpp.line]
#line 0 // should diagnose
#line -1
#line 2147483647
#line 2147483648 // should diagnose ?
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs