================
@@ -140,3 +140,39 @@ void test5() {
FOO1 + 1; // expected-error {{'FOO1' is defined as a function-like macro;
did you mean 'FOO1(...)'?}}
bar(FOO1); // expected-error {{'FOO1' is defined as a function-like macro;
did you mean 'FOO1(...)'?}}
}
+
+#undef FOO1
+
+void test6(){
+ int iter = FOO1; //expected-error {{use of undeclared identifier 'FOO1'}}
+}
+
+
+#define FOO1() 99 // expected-note {{'FOO1' defined here as a function-like
macro}}
+// expected-note@-1 {{'FOO1' defined here as a function-like macro}}
+
+void test7() {
+ int w = FOO1; // expected-error {{'FOO1' is defined as a function-like
macro; did you mean 'FOO1(...)'?}}
+}
+
+#define FOO2() 42
+
+void test8() {
+ int y = FOO2 /* comment */ (); // no error expected — still a real call
+}
+
+void test9() {
+ int z = FOO2
+ (); // no error expected — paren across a line break
+}
+
+void test10() {
+ int arr[FOO1]; // expected-error {{'FOO1' is defined as a function-like
macro; did you mean 'FOO1(...)'?}}
+}
+
+#define VARFOO(...) 1
+// expected-note@-1 {{'VARFOO' defined here as a function-like macro}}
----------------
StarOne01 wrote:
done!
https://github.com/llvm/llvm-project/pull/223895
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits