[Issue 22133] New: [REG2.097] Breaking change in DotTemplateExp type semantics leading to e.g. isInputRange regression

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 20 11:03:05 UTC 2021


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

          Issue ID: 22133
           Summary: [REG2.097] Breaking change in DotTemplateExp type
                    semantics leading to e.g. isInputRange regression
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: kinke at gmx.net

```
import std.range.primitives : isInputRange;

struct Slice
{
    bool empty() const;
    int front() const;
    void popFront()() // note: requires a mutable Slice
    {}
}

static assert(isInputRange!(      Slice) == true);
static assert(isInputRange!(const Slice) == false); // fails since v2.097
```

It boils down to both of the following assertions failing since v2.097:
```
enum isInputRange1(R) = is(typeof((R r) => r.popFront));
enum isInputRange2(R) = __traits(compiles, (R r) => r.popFront);
static assert(isInputRange1!(const Slice) == false);
static assert(isInputRange2!(const Slice) == false);
```

Regression introduced by https://github.com/dlang/dmd/pull/12294.

--


More information about the Digitalmars-d-bugs mailing list