From 066b2801e06867d1d147be9629328a37b525bb57 Mon Sep 17 00:00:00 2001 From: k-hara Date: Thu, 10 Jan 2013 11:59:12 +0900 Subject: [PATCH] fix Issue 9259 - Passing an array of pointers to a typesafe vararg is broken --- src/mtype.c | 2 +- test/runnable/test9259.d | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/runnable/test9259.d diff --git a/src/mtype.c b/src/mtype.c index 0de354d39b39..943cfbbf66d4 100644 --- a/src/mtype.c +++ b/src/mtype.c @@ -4311,7 +4311,7 @@ MATCH TypeDArray::implicitConvTo(Type *to) return MATCHconvert; } - return next->constConv(to); + return next->constConv(to) ? MATCHconvert : MATCHnomatch; } if (to->ty == Tarray) diff --git a/test/runnable/test9259.d b/test/runnable/test9259.d new file mode 100644 index 000000000000..f870f63a4929 --- /dev/null +++ b/test/runnable/test9259.d @@ -0,0 +1,13 @@ +// PERMUTE_ARGS: -inline -release -g -O -d -dw -de + +void test(int*[] arr...) +{ + assert(arr.length == 1); + assert(*arr[0] == 5); // This assertion fails +} + +void main() +{ + int a = 5; + test([&a]); +}