summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/arg-duplicate.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-07-21 03:09:58 +0000
committerChris Lattner <sabre@nondot.org>2007-07-21 03:09:58 +0000
commita6f5ab54257596b5dc895433e34297347e7f1e95 (patch)
treee8937f1bfcb001aaa3ef00946175cc7031867ba6 /clang/test/Sema/arg-duplicate.c
parent38dbdb2c9c3ee3c8cb362f06251bfe906b2b8870 (diff)
downloadbcm5719-llvm-a6f5ab54257596b5dc895433e34297347e7f1e95.tar.gz
bcm5719-llvm-a6f5ab54257596b5dc895433e34297347e7f1e95.zip
Fix off-by-one error when emitting diagnostics. Also, make diagnostic
a bit nicer for people who pass lots of extra arguments to calls by selecting them all instead of just the first one: arg-duplicate.c:13:13: error: too many arguments to function f3 (1, 1, 2, 3, 4); // expected-error {{too many arguments to function}} ^~~~~~~ This implements test/Sema/arg-duplicate.c, thanks to Neil for pointing out this crash. llvm-svn: 40136
Diffstat (limited to 'clang/test/Sema/arg-duplicate.c')
-rw-r--r--clang/test/Sema/arg-duplicate.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Sema/arg-duplicate.c b/clang/test/Sema/arg-duplicate.c
new file mode 100644
index 00000000000..5d44a72ecb3
--- /dev/null
+++ b/clang/test/Sema/arg-duplicate.c
@@ -0,0 +1,15 @@
+// RUN: clang -parse-ast-check %s
+
+typedef int x;
+int f3(y, x,
+ x) // expected-error {{redefinition of parameter}}
+ int y, x,
+ x; // expected-error {{redefinition of parameter}}
+{
+ return x + y;
+}
+
+void f4(void) {
+ f3 (1, 1, 2, 3, 4); // expected-error {{too many arguments to function}}
+}
+
OpenPOWER on IntegriCloud