digitalmars.D.bugs - [Issue 2526] New: non-const initializer to constant accepted inside template
- d-bugmail puremagic.com Dec 20 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2526 Summary: non-const initializer to constant accepted inside template Product: D Version: 1.037 Platform: PC OS/Version: Linux Status: NEW Keywords: accepts-invalid, wrong-code Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: kamm-removethis incasoftware.de 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. --
Dec 20 2008








d-bugmail puremagic.com