digitalmars.D.bugs - [Issue 4273] New: Error: functions cannot return a tuple
- d-bugmail puremagic.com (38/38) Jun 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4273
- d-bugmail puremagic.com (15/15) Jun 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4273
- d-bugmail puremagic.com (7/7) Jun 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4273
- d-bugmail puremagic.com (10/10) Jun 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4273
- d-bugmail puremagic.com (6/6) Jun 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4273
http://d.puremagic.com/issues/show_bug.cgi?id=4273 Summary: Error: functions cannot return a tuple Product: D Version: 2.040 Platform: x86 OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: sean invisibleduck.org --- If line A is changed to "auto x = foo(1,2);" then the code compiles without incident. This should compile with one parameter as well. import std.typecons; template fooRet(T...) { static if( T.length == 1 ) alias T fooRet; else alias Tuple!(T) fooRet; } fooRet!(T) foo(T...)(T vals) { Tuple!(T) ret; static if( T.length == 1 ) return ret.field[0]; else return ret; } void main() { auto x = foo(1); // A } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4273 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc I don't understand the purpose of your code, but I think the problems are in your code. Maybe in fooRet you meant to use: alias T[0] fooRet; You can also use: auto foo(T...)(T vals) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4273 17:16:41 PDT --- "Fixing" this would require conflating a Tuple!(T) with T. I think this would be a mistake. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4273 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |WONTFIX -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4273 --- You're right, it was a mistake in my code. Sorry. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 04 2010