mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 13:40:11 +03:00
Merge pull request #15826 from ntrel/method-mod
[dmd/func.d] Reword 'method not callable using a $mod object' error for constructors Signed-off-by: Dennis <dkorpel@users.noreply.github.com> Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com> Merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
This commit is contained in:
commit
0dfc7bd891
3 changed files with 26 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail217.d(22): Error: mutable method `fail217.Message.this` is not callable using a `immutable` object
|
||||
fail_compilation/fail217.d(22): Error: mutable constructor `fail217.Message.this` cannot construct a `immutable` object
|
||||
fail_compilation/fail217.d(13): Consider adding `const` or `inout` here
|
||||
---
|
||||
*/
|
||||
|
|
19
compiler/test/fail_compilation/immutable_ctor.d
Normal file
19
compiler/test/fail_compilation/immutable_ctor.d
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/immutable_ctor.d(18): Error: `immutable` copy constructor `immutable_ctor.S1.this` cannot construct a mutable object
|
||||
---
|
||||
*/
|
||||
|
||||
struct S1
|
||||
{
|
||||
this(ref const S1 s) immutable {
|
||||
}
|
||||
int i;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
const(S1) s1;
|
||||
S1 ms1 = s1;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue