immutable bug?

Era Scarecrow rtcvb32 at yahoo.com
Wed Jan 25 07:46:57 PST 2012


 DMD 2.057 - Windows version

 I'm in the middle of converting a medium sized project from C to D. While I'm doing that I have several static data structures. Here's where I find myself. Can't probably duplicate the error message without the full sources.

 Since immutable is transitive, this should not cause an error. But I am getting this one, which repeats 4 times for all four Notepart entries:

Error: cannot implicitly convert expression ("fQuality") of type string to char[]

//for reference on types
const nLen = 4;
enum ValueType {}
struct Flags {}

alias NotePart NP;
alias ValueType VT;

struct NotePart {
	ValueType type;	
	char[] id;
	Flags flags;
	int _size;
}

struct SubRecordParts {
	char name[nLen];
	char requ[nLen];
	int size;
	NotePart[] notes;
	int identifyBy = -1;
}

//immutable should (i think) implicitly change char[] to immutable(char[])
immutable SubRecordParts subParts[] = [
	{"AADT", "", 16, [
		NP(VT.ranged_32, "IApparatus"),
		NP(VT.float_32, "fQuality"),
		NP(VT.float_32, "fWeight"),
		NP(VT.i_32, "iuses")]}
];


More information about the Digitalmars-d-learn mailing list