www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17334] New: Template constraints do short circuit semantic

https://issues.dlang.org/show_bug.cgi?id=17334

          Issue ID: 17334
           Summary: Template constraints do short circuit semantic
                    analysis for && and ||, but not for ?:
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

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 ?:

--
Apr 19