Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
November 18, 2008 [Issue 2460] New: Ref functions can't be template functions. | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2460 Summary: Ref functions can't be template functions. Product: D Version: 2.020 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: minor Priority: P4 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: hskwk@inter7.jp Ref functions can't be template functions I guess DMD parser failed to bind `ref' to ref functions if the template is written in function template syntax. It is not serious problem for me. real t; ref real f(S)(S rhs) { size_t tmp; return t; } template g(S) { ref real g(S rhs) { size_t tmp; return t; } } f(1.0); // variable f!(double).f.tmp only parameters or foreach declarations can be ref g(1.0) // no problem -- |
March 27, 2010 [Issue 2460] Ref functions can't be template functions. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2460 Lars T. Kyllingstad <bugzilla@kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@kyllingen.net Severity|minor |major --- Comment #1 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2010-03-27 11:27:51 PDT --- Raising importance, since operator overloading is now done with templated functions, and this will become a major pain in the long run. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 24, 2010 [Issue 2460] Ref functions can't be template functions. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2460 Masahiro Nakagawa <repeatedly@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |repeatedly@gmail.com --- Comment #2 from Masahiro Nakagawa <repeatedly@gmail.com> 2010-05-24 08:59:21 PDT --- Today, I hit the similar problem. In the latest dmd, above code works but variadic version doesn't works. struct Foo { // works! I use this for workaround template foo(Args...) if (true) { ref Foo foo(Args args) { return this; } } // doesn't work. I want use this!! ref Foo foo(Args...)(Args args) if (true) { return this; } // works! ref Foo foo(Args...)(Args args) { return this; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 23, 2011 [Issue 2460] Ref functions can't be template functions. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2460 kennytm@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |kennytm@gmail.com Resolution| |FIXED --- Comment #3 from kennytm@gmail.com 2011-04-23 09:31:02 PDT --- Looks like this has been fixed. All programs in this page compiles for me. -------- struct Foo { double x, y; ref double get(Args...)(Args args) if (args.length == 4) { return x; } } void main() { Foo f; f.get(4,5,6,7) = 6; assert(f.x == 6); } -------- Can we fix this std.complex bug then? "Some operators, such as opAssign and opOpAssign, should return by ref, but currently don't. This will be implemented as soon as DMD bug 2460 is fixed." -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 26, 2011 [Issue 2460] Ref functions can't be template functions. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2460 --- Comment #4 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2011-04-26 02:40:59 PDT --- Cool! I'll fix std.complex. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation