www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2372] New: Template parameter types given as template parameter inhibits template instantiation

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

           Summary: Template parameter types given as template parameter
                    inhibits template instantiation
           Product: D
           Version: 2.019
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: simen.kjaras gmail.com


Passing the type of a template parameter as another template parameter causes
errors when compiling. Take the following code:

////

void foo(T, T t)(mystruct!(T, t) bar)
{
}

struct mystruct(T, T t)
{
}

void main()
{
        mystruct!(int, 2) baz;
        foo(baz);
}

////

Compiling it yields this result:

Error: identifier 'T' is not defined
Error: T is used as a type
foo.d(12): template foo.foo(T,T t) does not match any function template
declarat
ion
foo.d(12): template foo.foo(T,T t) cannot deduce template function from
argument
 types !()(mystruct!(int,2))

Note also that the first two messages have no line number.


-- 
Sep 24 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2372



--- Comment #1 from Simen Kjaeraas <simen.kjaras gmail.com> 2010-06-17 10:44:15
PDT ---
*** Issue 2239 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2010