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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Sean Kelly <[email protected]> 2010-06-04 16:24:41 PDT
---
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: -------