www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 954] New: Recursive templates with values, Error: T is used as a type

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=954

           Summary: Recursive templates with values, Error: T is used as a
                    type
           Product: D
           Version: 1.005
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: lio lunesu.com


template Foo( char C ) 
{
    const Foo = true;
}
template Bar(char[] T, int F )
{
    const Bar = Foo!(T[F]); //line 7
}
static assert( Bar!("asd",1) );

Results in:
t.d(7): Error: T is used as a type
t.d(7): template instance Foo!(void[1]) does not match any template declaration
t.d(7): variable t.Bar!("asd",1).Bar voids have no value

Workaround: change the reference to F in that line to "F+0"


-- 
Feb 12 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=954






Forgot to emphasize: direct references to T[F] work fine, for example:

template Foo(char[] T, int F)
{
  const Foo = T[F];
}


-- 
Feb 12 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=954


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All





Added to DStress as
http://dstress.kuehne.cn/compile/t/template_59_A.d
http://dstress.kuehne.cn/compile/t/template_59_B.d


-- 
Apr 06 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=954


lio+bugzilla lunesu.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





This seems to have been fixed in version 1.030


-- 
Mar 08 2009