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

wrong UFCS type propagation with pointers #441

Closed
Kozzi11 opened this issue Aug 13, 2013 · 3 comments
Closed

wrong UFCS type propagation with pointers #441

Kozzi11 opened this issue Aug 13, 2013 · 3 comments

Comments

@Kozzi11
Copy link

Kozzi11 commented Aug 13, 2013

import std.stdio;
import core.stdc.string;

alias cstring = immutable(char)*;

byte[] arr(T : cstring)(T value) {
return value is null ? cast(byte[])[0x00] : (cast(byte*)value)[0 .. strlen(value) + 1];
}

void main(string[] args)
{
cstring str = std.string.toStringz("string");
writeln(str.arr);
}

@redstar
Copy link
Member

redstar commented Aug 17, 2013

The output of the program is:

[115, 116, 114, 105, 110, 103, 0]

with dmd 2.063.2, dmd trunk and ldc trunk. Does your compiler output something different?

@Kozzi11
Copy link
Author

Kozzi11 commented Aug 19, 2013

@redstar I am unable to compile it with ldc 1.0.11, I will try it with latest git version

compile output:
main.d(13): Error: no property 'arr' for type 'immutable(char)'

@Kozzi11
Copy link
Author

Kozzi11 commented Aug 19, 2013

With latest ldc from git It seems compile OK, so I close this issue.

@Kozzi11 Kozzi11 closed this as completed Aug 19, 2013
redstar pushed a commit that referenced this issue Sep 27, 2014
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

No branches or pull requests

2 participants