digitalmars.D.bugs - [Issue 3755] New: Regression forward declaration templates something
- d-bugmail puremagic.com (68/68) Jan 30 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3755
- d-bugmail puremagic.com (8/8) Feb 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3755
- d-bugmail puremagic.com (17/17) Jul 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3755
http://d.puremagic.com/issues/show_bug.cgi?id=3755
Summary: Regression forward declaration templates something
Product: D
Version: 1.056
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: borislav.asdf gmail.com
It used to work in 1.055 now it says
bug.d(6): Error: declaration _D3bug1A6__initZ forward declaration
bug.d(34): Error: template instance bug.Tuple!(_D3bug1A6__initZ) error
instantiating
bug.d(38): instantiated from here: InitsOf!(A)
bug.d(54): instantiated from here: MinArgs!(func)
//////////////////////////
//////////////////////////
//////////////////////////
struct A {
}
//////////////////////////
//////////////////////////
//////////////////////////
template ParameterTupleOf( Fn )
{
static if( is( Fn Params == function ) )
alias Params ParameterTupleOf;
else static if( is( Fn Params == delegate ) )
alias ParameterTupleOf!(Params) ParameterTupleOf;
else static if( is( Fn Params == Params* ) )
alias ParameterTupleOf!(Params) ParameterTupleOf;
else
static assert( false, "Argument has no parameters." );
}
template Tuple( TList... )
{
alias TList Tuple;
}
template InitsOf(T...) {
static if(T.length == 0)
alias Tuple!() InitsOf;
else
alias Tuple!(T[0].init, InitsOf!(T[1 .. $])) InitsOf;
}
template MinArgs(alias func) {
const uint MinArgs = MinArgsImpl!(func, 0,
InitsOf!(ParameterTupleOf!(typeof(&func))));
}
private template MinArgsImpl(alias func, int index, Args...) {
static if(index >= Args.length)
const uint MinArgsImpl = Args.length;
else static if(is(typeof(func(Args[0 .. index]))))
const uint MinArgsImpl = index;
else
const uint MinArgsImpl = MinArgsImpl!(func, index + 1, Args);
}
void func(A) {
}
void main() {
const a = MinArgs!(func);
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 30 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3755
borislav.asdf gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |regression
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3755
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|1.056 |D1
Summary|Regression forward |Forward declaration
|declaration templates |templates something (D1
|something |only)
Severity|regression |normal
This is not a regression. The behaviour in 1.056 is the same as in 1.054. In
1.055, it didn't generate any error messages, but that was because the compiler
was crashing!
Interestingly the code works on 2.043 and later.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2010









d-bugmail puremagic.com 