Bug 18590 – nothrow constructor call still type-checks destructor for purity

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-03-11T15:33:30Z
Last change time
2024-12-13T18:57:47Z
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: dmd#17850 →

Comments

Comment #0 by code — 2018-03-11T15:33:30Z
cat > bug.d << CODE extern(C) int printf(const char*, ...); struct F { static F create() pure nothrow { return F(1); } this(int) pure nothrow { } ~this() { printf("~this\n"); } } CODE dmd -c bug ---- Error: pure function 'bug.F.create' cannot call impure function 'bug.F.~this' ---- Apparently happens because `F(1)` is lowered to `(tmp = F(1)),tmp` internally. https://github.com/dlang/dmd/blob/93804714c4091a8d867c09ca7b5bf332acb34dfb/src/dmd/expression.d#L3931
Comment #1 by robert.schadek — 2024-12-13T18:57:47Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17850 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB