http://d.puremagic.com/issues/show_bug.cgi?id=2809
Summary: Wrong code for unsigned shift Product: D Version: 2.027 Platform: PC URL: http://www.digitalmars.com/webnews/newsgroups.php?art_gr oup=digitalmars.D.learn&article_id=16107 OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: ma...@pochta.ru --- const short s=-1; static assert(s>>>1==0x7fff); //fail --- Influenced by error messages, where compiler transforms a>>>b to cast(int)a>>>b. Here compiler complains about conversion to return type: --- short a(short b) { return b>>>1; } --- When you add it, the code is accepted, but the bug is already triggered. --- short a(short b) { return cast(short)(b>>>1); } --- --