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

Fixed issue 14981 #3678

Closed
wants to merge 1 commit into from
Closed

Conversation

JackStouffer
Copy link
Member

Using the new auto function attribute inference in 2.068.

https://issues.dlang.org/show_bug.cgi?id=14981

@@ -7250,7 +7250,7 @@ if (isInputRange!Range)
}

// Assertion only.
private void dbgVerifySorted()
private auto dbgVerifySorted()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this work? I copied the code and the deduced return type remained void.

Copy link
Member

Choose a reason for hiding this comment

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

The type is inferred as void. It should probably be turned into a template function instead.
private void dbgVerifySorted()()

Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't get how this fixes the issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

@atilaneves In 2.068, auto functions function attributes are inferred http://dlang.org/changelog/2.068.0.html#attribinference3

Copy link
Member

Choose a reason for hiding this comment

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

I thought member functions of template structs/classes were already inferred?

Copy link
Member Author

Choose a reason for hiding this comment

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

You might be right, I don't know. I thought that they were only inferred if they were templates or auto functions themselves.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this compiles. There is another reason why this isn't working. I agree with @atilaneves.

struct S(T)
{
    void foo() {}
}

void main() nothrow
{
    S!int s;
    s.foo();
}

@JackStouffer
Copy link
Member Author

Changing the return type back to void passes the test as well. This might have been fixed via #3669.

@schveiguy
Copy link
Member

2.067.1 does not fail, 2.068.0 does, and the head revision does not fail. So this was a regression, and seems to have been fixed.

@schveiguy schveiguy closed this Sep 30, 2015
@schveiguy
Copy link
Member

This might have been fixed via #3669.

Yes, I think that was it. Because prior to that, there was a call to uniform, which calls enforce, which can throw.

@schveiguy
Copy link
Member

Hm.. interestingly, the code hadn't changed since 2.067.1 to 2.068.0, but did not fail in the prior version. Weird. So many different players here, perhaps it was a change in Array? In any case, all is well now.

@JackStouffer JackStouffer deleted the issue14981 branch May 22, 2017 17:36
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