[clang] [clang][Sema][Tests] Add test coverage for function-like macro diagnostic edge cases and C++ (PR #223895)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 17 09:00:30 PDT 2026
================
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Regression test for the "function-like macro used without parens"
+// diagnostic added in https://github.com/llvm/llvm-project/pull/123495.
+// Confirms the same diagnostic fires correctly in C++ (not just C),
+// since the implementation lives in the shared SemaExpr.cpp.
+
+#define BAZ() 1
+// expected-note at -1 {{'BAZ' defined here as a function-like macro}}
+
+int x = BAZ; // expected-error {{'BAZ' is defined as a function-like macro; did you mean 'BAZ(...)'?}}
----------------
Fznamznon wrote:
Please add a newline at the end of file.
https://github.com/llvm/llvm-project/pull/223895
More information about the cfe-commits
mailing list