[Issue 18115] New: [REG2.078-b1] case where && is not shortcut anymore in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 23 11:17:04 UTC 2017


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

          Issue ID: 18115
           Summary: [REG2.078-b1] case where && is not shortcut anymore in
                    CTFE
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

The following code does not compile anymore, starting from 2.078 beta1:

```
module test;

class A23456{}

string foo()
{
    string result;
    mixin("alias m = " ~ __MODULE__ ~ ";");
    foreach (member; __traits(allMembers, m))
    {
        if (member.length > 5 && member[$-6..$] == "A23456")
            result ~= member ~ " ";
    }
    return result;
}

enum e = foo();
```

A workaround is to turn the `if` into a `static if` however this is a
regression.

--


More information about the Digitalmars-d-bugs mailing list