D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16538 - Parameter head-const-ness shouldn't matter but does
Summary: Parameter head-const-ness shouldn't matter but does
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-25 10:13 UTC by Eyal
Modified: 2022-11-10 14:35 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Eyal 2016-09-25 10:13:37 UTC
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!
Comment 1 Walter Bright 2017-05-13 13:00:03 UTC
Fixed by https://github.com/dlang/dmd/pull/6731
Comment 2 Walter Bright 2017-06-10 20:45:45 UTC
Fixed by https://github.com/dlang/dmd/pull/6731