changeset 1479:ffdc1fcfe4ca

[Issue 1097] Missing line number: casting array to array of different element size Matti Niemenmaa <deewiant@gmail.com> 2007-04-05 http://d.puremagic.com/issues/show_bug.cgi?id=1097
author thomask
date Fri, 06 Apr 2007 09:16:20 +0000
parents 6c060ae4f8b5
children 72a1fa78e62a
files nocompile/c/cast_35_A.d run/c/cast_35_B.d run/c/cast_35_C.d
diffstat 3 files changed, 82 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/c/cast_35_A.d	Fri Apr 06 09:16:20 2007 +0000
@@ -0,0 +1,16 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Matti Niemenmaa <deewiant@gmail.com>
+// @date@	2007-04-05
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1097
+// @desc@	[Issue 1097] Missing line number: casting array to array of different element size
+
+// __DSTRESS_ELINE__ 15
+
+module dstress.nocompile.c.cast_35_A;
+
+int[] foo() {
+	return cast(int[])"a";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/c/cast_35_B.d	Fri Apr 06 09:16:20 2007 +0000
@@ -0,0 +1,34 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Matti Niemenmaa <deewiant@gmail.com>
+// @date@	2007-04-05
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1097
+// @desc@	[Issue 1097] Missing line number: casting array to array of different element size
+
+module dstress.run.c.cast_35_B;
+
+align(1) struct Big{
+	short a;
+	byte b;
+}
+
+align(1) struct Small{
+	short a;
+}
+
+size_t test(int i){
+	Big[] b = new Big[i];
+	Small[] s = cast(Small[]) b;
+	return s.length;
+}
+
+int main(char[][] args){
+	try{
+		test(args.length);
+	}catch{
+		return 0;
+	}
+	assert(0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/c/cast_35_C.d	Fri Apr 06 09:16:20 2007 +0000
@@ -0,0 +1,32 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Matti Niemenmaa <deewiant@gmail.com>
+// @date@	2007-04-05
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1097
+// @desc@	[Issue 1097] Missing line number: casting array to array of different element size
+
+module dstress.run.c.cast_35_C;
+
+align(1) struct Big{
+	short a;
+	byte b;
+}
+
+align(1) struct Small{
+	short a;
+}
+
+size_t test(int i){
+	Big[] b = new Big[i];
+	Small[] s = cast(Small[]) b;
+	return s.length;
+}
+
+int main(char[][] args){
+	if(3 != test(args.length + 1)){
+		assert(0);
+	}
+	return 0;
+}