www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22133] New: [REG2.097] Breaking change in DotTemplateExp type


          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 puremagic.com
          Reporter: kinke 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.

Jul 20 2021