Bug 1559 – version statement makes code outside of it disappear
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-10-09T07:11:00Z
Last change time
2014-02-24T15:31:35Z
Keywords
wrong-code
Assigned to
bugzilla
Creator
torhu
Comments
Comment #0 by torhu — 2007-10-09T07:11:55Z
---
// newbug.d
void main()
{
//int x; // FIX 1
printf("Do you see this?\n");
version(ANYTHING) { /* Doesn't matter if this block is empty or not */ }
else { /*printf("Now you do!");*/ } // FIX 2
}
--
Compiling and running it:
---
c:\prog\test\D\bugs>dmd -run newbug
c:\prog\test\D\bugs>
---
Nothing is printed, which suggests that the printf call is not compiled in. Grepping the executable for 'printf' turns up empty.
Uncommenting the code in either line 'FIX 1' or 'FIX 2' makes the first printf call work.