D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17334 - Template constraints do short circuit semantic analysis for && and ||, but not for ?:
Summary: Template constraints do short circuit semantic analysis for && and ||, but no...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-19 22:42 UTC by Walter Bright
Modified: 2022-11-18 11:40 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2017-04-19 22:42:16 UTC
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 Andrei Alexandrescu 2017-04-20 16:49:08 UTC
Related: https://issues.dlang.org/show_bug.cgi?id=17335
Comment 2 Walter Bright 2017-04-21 02:59:21 UTC
https://github.com/dlang/dmd/pull/6713