← Back to index
|
Original Bugzilla link
Bug 17334 – Template constraints do short circuit semantic analysis for && and ||, but not for ?:
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-04-19T22:42:16Z
Last change time
2022-11-18T11:40:56Z
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0
by bugzilla — 2017-04-19T22:42:16Z
It should do it for ?: too. Spelunking the code, 'constraint' is the field of interest:
https://github.com/dlang/dmd/blob/master/src/ddmd/dtemplate.d#L497
and it gets semantically analyzed here:
https://github.com/dlang/dmd/blob/master/src/ddmd/dtemplate.d#L892
But before that it sets SCOPEcondition here:
https://github.com/dlang/dmd/blob/master/src/ddmd/dtemplate.d#L887
and looking in expression.d for SCOPEcondition:
https://github.com/dlang/dmd/blob/master/src/ddmd/expression.d#L15212
https://github.com/dlang/dmd/blob/master/src/ddmd/expression.d#L15212
and there's the short circuit conditional semantic analysis of constraints. But it's not there for ?:
Comment #1
by andrei — 2017-04-20T16:49:08Z
Related:
https://issues.dlang.org/show_bug.cgi?id=17335
Comment #2
by bugzilla — 2017-04-21T02:59:21Z
https://github.com/dlang/dmd/pull/6713