[clang] [clang] Diagnose default arguments defined in different scopes (PR #124844)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 29 15:03:47 PST 2025
================
@@ -27,3 +27,23 @@ extern double(*func2)(
P_10000(int u)
P_10000(int v) // expected-error {{too many function parameters; subsequent parameters will be ignored}}
int w);
+
+#define PD_10(x) x, x, x, x, x, x, x, x, x, x,
+#define PD_100(x) PD_10(x) PD_10(x) PD_10(x) PD_10(x) PD_10(x) \
+ PD_10(x) PD_10(x) PD_10(x) PD_10(x) PD_10(x)
+#define PD_1000(x) PD_100(x) PD_100(x) PD_100(x) PD_100(x) PD_100(x) \
+ PD_100(x) PD_100(x) PD_100(x) PD_100(x) PD_100(x)
+#define PD_10000(x) PD_1000(x) PD_1000(x) PD_1000(x) PD_1000(x) PD_1000(x) \
+ PD_1000(x) PD_1000(x) PD_1000(x) PD_1000(x) PD_1000(x)
+
+extern "C" int func3(
+ PD_10000(int = 0)
+ PD_10000(int = 0)
+ PD_10000(int = 0)
+ PD_10000(int = 0)
+ PD_10000(int = 0)
+ PD_10000(int = 0)
+ PD_10000(int = 0) // expected-error {{too many function parameters; subsequent parameters will be ignored}}
+ int = 0);
+
+int h = func3();
----------------
Endilll wrote:
It was intended as a test for the code that emits diagnostics, but I need to update it, yeah.
https://github.com/llvm/llvm-project/pull/124844
More information about the cfe-commits
mailing list