Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 6912 - const(T)[]/immutable(T)[] can be implicitly cast to inout(const(T)[])/inout(immutable(T)[]) #504

Merged
merged 1 commit into from
Nov 15, 2011

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Nov 10, 2011

http://d.puremagic.com/issues/show_bug.cgi?id=6912

Fix inout matching on dynamic array and associative array types.

return x;
}

/************************************/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is flawed.
Try to add a positive test, it will fail because the delegate is no inout function.

static assert(is(typeof({ inout(int) wda = 2; })));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thank you for your pointing out.
I'll fix this test.

@WalterBright WalterBright merged commit eb5a37d into dlang:master Nov 15, 2011
static assert(!is(typeof(testinout!q{ int [] mda; inout( const(int)[]) wda = mda; })));
static assert(!is(typeof(testinout!q{ const(int)[] cda; inout( const(int)[]) wda = cda; })));
static assert(!is(typeof(testinout!q{ immutable(int)[] ida; inout( const(int)[]) wda = ida; })));
static assert(!is(typeof(testinout!q{ immutable(int)[] ida; inout(immutable(int)[]) wda = ida; })));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. immutable(int)[] should implicitly cast inout(immutable(int)[]), because the inout qualifier only talks about the head of the array.
It is probably my fault, because I got the title of the bug report wrong. (the bug report does not actually talk about immutable).

braddr pushed a commit to braddr/dmd that referenced this pull request Oct 22, 2012
Fix using F!() syntax instead of F[] in typetuple.d documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants