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 7878 - A problem with purity and general templated algorithms #544

Merged
merged 2 commits into from
Jun 4, 2012

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Apr 19, 2012

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

Today template instantiation backtrace is implemented, so suppress errors is not useful.

@ghost
Copy link

ghost commented Apr 19, 2012

Feel free to close Issue 5505 as well, since it references binaryReverseArgs.

// else
// {
// alias comp binaryFun;
// }
}

unittest
Copy link

Choose a reason for hiding this comment

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

If you change /* to /** on line 142 you would fix Issue 5358

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. Added a commit.

@9rnsr
Copy link
Contributor Author

9rnsr commented Apr 21, 2012

Feel free to close Issue 5505 as well, since it references binaryReverseArgs.

Marked as a duplicate of bug 7878.

@@ -6782,7 +6782,8 @@ sort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable,
Range)(Range r)
{
alias binaryFun!(less) lessFun;
static if (is(typeof(lessFun(r.front, r.front)) == bool))
alias typeof(lessFun(r.front, r.front)) LessRet; // instantiate lessFun
static if (is(LessRet == bool))
Copy link
Member

Choose a reason for hiding this comment

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

So, is the point of this to make it so that when lessFun(r.front, r.front) fails to compile, you get the instantiation error rather than the static if's condition silently evaluating to false?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Today template instantiation error trace is enough useful, and shows the real problem why you fail to compile less predicate.

jmdavis added a commit that referenced this pull request Jun 4, 2012
Issue 7878 - A problem with purity and general templated algorithms
@jmdavis jmdavis merged commit 8e37bf3 into dlang:master Jun 4, 2012
@jmdavis
Copy link
Member

jmdavis commented Jun 4, 2012

Merged.

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.

2 participants