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

fix issue 15940 - ImplicitConversionTargets and class alias in struct #4342

Closed
wants to merge 1 commit into from
Closed

fix issue 15940 - ImplicitConversionTargets and class alias in struct #4342

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented May 21, 2016

No description provided.

@dlang-bot
Copy link
Contributor

dlang-bot commented May 21, 2016

Fix Bugzilla Description
15940 ImplicitConversionTargets and class alias in struct

@JackStouffer
Copy link
Member

LGTM

{
class Foo{}
struct Bar{Foo foo; alias foo this;}
static assert(ImplicitConversionTargets!(Bar).length == 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

But Bar does convert implicitly to Foo. So ImplicitConversionTargets!Bar should list Foo, shouldn't it? Although it looks like ImplicitConversionTargets doesn't recognize alias this at all.

Copy link
Author

@ghost ghost May 21, 2016

Choose a reason for hiding this comment

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

it looks like ImplicitConversionTargets doesn't recognize alias this at all.

Yes, it's was just working for a struct containing an alias this to a class (so the bug fixed here), but all the other cases were not. for example:

unittest
{
    struct Bar{ubyte d; alias d this;}
    static assert(ImplicitConversionTargets!(Bar).length == 0);
}

passes. So the fix is conform will the global behavior of the template.

@ghost ghost closed this May 26, 2016
@ghost ghost reopened this Jun 1, 2016
@ghost ghost closed this Jun 2, 2016
@ghost ghost deleted the issue-15940 branch June 2, 2016 12:37
@ghost
Copy link

ghost commented Dec 10, 2019

Are there any reasons, why this has never been merged?

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants