This compiles and fails the assert: template T() { const o = new Object; } void main() { assert(T!().o is T!().o); } It should not compile, as const o = new Object; also fails with "Error: non-constant expression new Object". The assert is triggered because DMD emits a call to new for each mention of T!().o inside a function.
D2 bug is duplicate of issue 2414.
*** Issue 2706 has been marked as a duplicate of this issue. ***
*** Issue 4397 has been marked as a duplicate of this issue. ***
D1 only, works in D2