Bug 9913 – static if (__traits(compiles)...) causes program to hang

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-09T13:37:49Z
Last change time
2021-01-24T05:20:02Z
Assigned to
No Owner
Creator
callumenator

Comments

Comment #0 by callumenator — 2013-04-09T13:37:49Z
DMD 2.062 Win32 import std.stdio, std.typecons; void main() { int ee = 0; static if (__traits(compiles, { Unique!int(&ee);})) auto e = Unique!int(&ee); writeln(e); // required to trigger } With the static if conditional (which passes) the writeln line causes the program to hang indefinitely after printing the expected result. Remove the static if conditional, and the program does not hang, behaves correctly.
Comment #1 by callumenator — 2013-06-10T17:03:04Z
(In reply to comment #0) Still present in 2.063 (Win32).
Comment #2 by bugzilla — 2013-10-07T00:08:19Z
Not an ice, as dmd itself does not hang. The compiled program does. Removed ice keyword.
Comment #3 by yebblies — 2013-11-22T07:29:20Z
Looks like an infinite look inside the gc
Comment #4 by yebblies — 2013-11-22T07:37:36Z
loop*
Comment #5 by maxhaton — 2021-01-24T05:20:02Z
Given example does not compile, an alternative version without Unique does not exhibit specified behaviour (Works since 2.067.old)