mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
24 lines
440 B
D
24 lines
440 B
D
// https://issues.dlang.org/show_bug.cgi?id=24353
|
|
|
|
/**
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/test24353.d(23): Error: mutable method `test24353.S.opApply` is not callable using a `const` object
|
|
fail_compilation/test24353.d(14): Consider adding `const` or `inout` here
|
|
---
|
|
*/
|
|
|
|
|
|
struct S
|
|
{
|
|
int opApply(int delegate(int) dg)
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
void example()
|
|
{
|
|
const S s;
|
|
foreach (e; s) {} // Error expected here
|
|
}
|