www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16538] New: Parameter head-const-ness shouldn't matter but does

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

          Issue ID: 16538
           Summary: Parameter head-const-ness shouldn't matter but does
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: eyal weka.io

const(int) retConst1();
int retConst2();
auto retConst = [&retConst1, &retConst2]; // Compiles!

const(int*) retConstPtr1();
const(int)* retConstPtr2();
auto retConstPtr = [&retConstPtr1, &retConstPtr2]; // Compiles!

void constArray1(const(int)[1]);
void constArray2(const(int[1]));
auto constArray = [&constArray1, &constArray2]; // Compiles!

const(int)[] retConstSlice1();
const(int[]) retConstSlice2();
auto retConstSlice = [&retConstSlice1, &retConstSlice2]; // Compiles!

void constSlice1(const(int)[]);
void constSlice2(const(int[]));
auto constSlice = [&constSlice1, &constSlice2]; // Errors: Incompatible types!

void ptrToConst1(const(int)*);
void ptrToConst2(const(int*));
auto ptrToConst = [&ptrToConst1, &ptrToConst2]; // Errors: Incompatible types!

--
Sep 25 2016