3397 – Unintended function call to static opCall

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3397 - Unintended function call to static opCall
Summary: Unintended function call to static opCall
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: Other All
: P2 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
Reported: 2009年10月14日 06:27 UTC by Moritz Warning
Modified: 2014年04月18日 09:12 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Moritz Warning 2009年10月14日 06:27:15 UTC
Tested with DMD 1.049 and svn r208.
It's a blocker for Tango.
Error: cannot implicitly convert expression (stack.pop()) of type Pair!(uint) to uint
struct Pair(T)
{
 static Pair opCall(T a, T b)
 {
 return Pair.init;
 }
}
struct Stack(T)
{
 T pop()
 {
 return T.init;
 }
}
void main()
{
	Stack!(Pair!(uint)) stack;
	Pair!(uint) item = stack.pop; //this line fails, works with stack.pop() or auto
}
Comment 1 Walter Bright 2009年10月15日 02:29:09 UTC
Why is it a blocker if using stack.pop() works?
Comment 2 Don 2009年10月15日 02:38:29 UTC
This was probably caused by my fix to bug 2702. It also caused the other (D2 only) critical regression bug 3367. Both need to be fixed in the next release.
Comment 3 Walter Bright 2009年10月15日 03:12:12 UTC
I've checked in a fix to this one, but not 3367.
Comment 4 Moritz Warning 2009年10月15日 05:49:40 UTC
>Why is it a blocker if using stack.pop() works?
This is of course a trivial workaround.
But it would break existing code (User and Tango code).
Anyway, this syntax also isn't encouraged in Tango.
Comment 5 Moritz Warning 2009年10月15日 07:00:21 UTC
DMD svn r215 now segfaults on this test case.
Comment 6 Moritz Warning 2009年11月06日 07:41:33 UTC
Works with 1.051.
Comment 7 Walter Bright 2009年11月06日 11:30:39 UTC
Fixed dmd 1.051 and 2.036


AltStyle によって変換されたページ (->オリジナル) /