Skip to content

Commit

Permalink
Add tdummy for specialized type parameter matching
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Dec 26, 2011
1 parent 4d9f2e7 commit 01c2d59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/template.c
Expand Up @@ -3012,6 +3012,8 @@ TemplateThisParameter *TemplateParameter::isTemplateThisParameter()

// type-parameter

Type *TemplateTypeParameter::tdummy = NULL;

TemplateTypeParameter::TemplateTypeParameter(Loc loc, Identifier *ident, Type *specType,
Type *defaultType)
: TemplateParameter(loc, ident)
Expand Down Expand Up @@ -3137,6 +3139,9 @@ MATCH TemplateTypeParameter::matchArg(Scope *sc, Objects *tiargs,

if (specType)
{
if (!ta || ta == tdummy)
goto Lnomatch;

//printf("\tcalling deduceType(): ta is %s, specType is %s\n", ta->toChars(), specType->toChars());
MATCH m2 = ta->deduceType(sc, specType, parameters, dedtypes);
if (m2 == MATCHnomatch)
Expand Down Expand Up @@ -3228,7 +3233,9 @@ void *TemplateTypeParameter::dummyArg()
t = specType;
else
{ // Use this for alias-parameter's too (?)
t = new TypeIdentifier(loc, ident);
if (!tdummy)
tdummy = new TypeIdentifier(loc, ident);
t = tdummy;
}
return (void *)t;
}
Expand Down
2 changes: 2 additions & 0 deletions src/template.h
Expand Up @@ -159,6 +159,8 @@ struct TemplateTypeParameter : TemplateParameter
Type *specType; // type parameter: if !=NULL, this is the type specialization
Type *defaultType;

static Type *tdummy;

TemplateTypeParameter(Loc loc, Identifier *ident, Type *specType, Type *defaultType);

TemplateTypeParameter *isTemplateTypeParameter();
Expand Down

0 comments on commit 01c2d59

Please sign in to comment.