AssociativeArray.opIndex

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Mar 2 21:43:58 PST 2012


In attempting to fix issue 5030, I'm finding that defining
AssociativeArray.opIndex gives an odd error when druntime is compiled:

dmd: mtype.c:4411: StructDeclaration* TypeAArray::getImpl(): Assertion `impl' failed.

This error only happens when opIndex is declared like this:

	Value opIndex(Key key, int file=__FILE__, int line=__LINE__)

It seems to be OK when declared without the extra parameters, but then
if there's any error in the function body, such as a missing return
value, another strange error happens:

	src/core/thread.d(2835): Error: undefined identifier module thread.keys

Even though the error has nothing to do with thread.d at all.
Apparently there are some unstated assumptions about what's in struct
AssociativeArray?


T

-- 
Chance favours the prepared mind. -- Louis Pasteur


More information about the Digitalmars-d mailing list