================
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -std=c++26 -pedantic -verify -Wno-invalid-pp-token %s
+// RUN: %clang_cc1 -std=c++23 -pedantic -verify -Wno-invalid-pp-token %s
+
+// P2843R3: Preprocessing is never undefined.
+// These constructs were previously "undefined behavior" in the preprocessor;
+// as of C++26 they are ill-formed (diagnostic required). Clang already
+// diagnoses them under -pedantic, so this test just pins that behavior down.
+
+// [cpp.cond] A macro that expands to 'defined' in a conditional expression.
+#define DEFINED defined
+#if DEFINED(bar) // expected-warning {{macro expansion producing 'defined' has
undefined behavior}}
+#endif
----------------
cor3ntin wrote:
We should turn that into a hard error.
Can you add tests for
```
defined()
defined(a b)
defined(a, b)
```
https://github.com/llvm/llvm-project/pull/192073
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits