[clang] [clang][Sema] Add diagnostic note for reference of function-like macros requiring without parentheses (PR #123495)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 31 15:27:17 PST 2025
================
@@ -180,3 +182,11 @@ void test2() {
// expected-error at -3 {{use of undeclared identifier}}
// expected-note at -4 {{cannot use initializer list at the beginning of a macro argument}}
}
+
+#define LIM() 10
+// expected-note at -1 {{'LIM' is defined here as a function-like macro; did you mean 'LIM(...)'}}
+
+void test3() {
+ int iter = LIM;
----------------
shafik wrote:
We should also cover other cases as well in the tests e.g.:
```cpp
#define F() 42
int x = F;
void g(int);
void f() {
F + 1;
g(F);
}
```
https://github.com/llvm/llvm-project/pull/123495
More information about the cfe-commits
mailing list