Mercurial > projects > dstress
view run/i/inline_13_A.d @ 1603:2031b04871b3
Fix broken invariant + synchronized test. Synchronized is not a valid function
attribute for structs!
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 28 Mar 2009 19:17:32 +0100 |
parents | b8c0195059d9 |
children |
line wrap: on
line source
// $HeadURL$ // $Date$ // $Author$ // @author@ Uwe Salomon <post@uwesalomon.de> // @date@ 2005-07-13 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=4525 module dstress.run.i.inline_13_A; struct NodeType(Key, T){ NodeType* next; uint hash; Key key; } struct HashIterator(Key, T){ NodeType!(Key, T)* m_ptr; static HashIterator fromPtr(NodeType!(Key, T)* ptr){ return *(cast(HashIterator*) &ptr); } int opEquals(HashIterator iter){ return (m_ptr == iter.m_ptr); } } struct Hash(Key, T){ alias HashIterator!(Key, T) Iterator; Iterator end(){ return Iterator.fromPtr(null); } } int main(){ Hash!(uint, uint) hash; hash.Iterator iter; if ((iter = hash.end()) == hash.end){ return 0; } assert(0); }