Bug 23591 – [REG 2.101] Invalid casts accepted by the compiler if from type is noreturn

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-12-30T12:47:24Z
Last change time
2022-12-31T14:27:44Z
Keywords
accepts-invalid, pull
Assigned to
No Owner
Creator
Iain Buclaw
See also
https://issues.dlang.org/show_bug.cgi?id=23587

Comments

Comment #0 by ibuclaw — 2022-12-30T12:47:24Z
This nonsense is compilable. --- noreturn square(int x); int example(int i) { int x = cast(string)square(i); int y = cast(real function(char))assert(0); return x + y; } --- Introduced by https://github.com/dlang/dmd/pull/14494
Comment #1 by dlang-bot — 2022-12-30T12:50:38Z
@ibuclaw updated dlang/dmd pull request #14758 "Revert "Fix Issues 23331, 23379 - fix casts involving noreturn"" fixing this issue: - fix Issue 23591 - [REG 2.101] Invalid casts accepted by the compiler if from type is noreturn https://github.com/dlang/dmd/pull/14758
Comment #2 by dlang-bot — 2022-12-31T14:27:44Z
dlang/dmd pull request #14758 "Revert "Fix Issues 23331, 23379 - fix casts involving noreturn"" was merged into master: - 227b3edae230a4084eacc994cf940ec4e612232b by Iain Buclaw: fix Issue 23591 - [REG 2.101] Invalid casts accepted by the compiler if from type is noreturn https://github.com/dlang/dmd/pull/14758