[Issue 2809] New: Wrong code for unsigned shift
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 6 07:05:13 PDT 2009
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: bugzilla at digitalmars.com
ReportedBy: maxmo at 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); }
---
--
More information about the Digitalmars-d-bugs
mailing list