Don <> changed:

           What    |Removed                     |Added
                 CC|                            |
           Platform|Other                       |All
            Version|unspecified                 |2.032
         OS/Version|Linux                       |All
           Severity|normal                      |enhancement

--- Comment #1 from Don <> 2009-10-16 00:33:37 PDT ---
I've convinced myself that this isn't too difficult, but it contains a lot of
subtlties. I don't have a complete patch, but I've got basic cases working.
Basically in deduceFunctionTemplateMatch() you need to create variables for
each of the parameters (by analogy to func.c line 904).

    for (i = 0; i < nfparams; i++)
    Argument *fparam = Argument::getNth(fparameters, i);
    if (!fparam->ident) continue; // don't add it, if it has no name
    Type *vtype = // get the type, not sure how to do this properly
    ... deal with pure, etc.
    VarDeclaration *v = new VarDeclaration(loc, vtype, fparam->ident, NULL);

... set the storage class

    if (!paramscope->insert(v)) error("parameter %s.%s is already defined",
toChars(), v->toChars());

Not sure how to deal with deal with the different flavours of variadics,
I originally thought that in TemplateDeclaration::matchWithInstance() you'd be
able avoid checking the constraint again if it's a function template, but you
can't because of cases like:

T1[] find(T1, T2)(T1[] longer, T2[] shorter) if (false) 
   return longer;

void main() {
   double[] d1 = [ 6.0, 1.5, 2.4, 3 ];
   double[] d2 = [ 1.5, 2.4 ];
   assert(find!(double, double)(d1, d2) == d1[1 .. $]); // THIS MUST NOT

So it needs to have the same thing, wrapped in a 
     FuncDeclaration *fd = onemember->toAlias()->isFuncDeclaration();
     if (fd) {

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to