C++: Fix code compl. for instantiation of template specialization

It works for full specialization. Instantiate of the partial
specialization has to be implemented(finding appropriate partial
specialization-on going)

Added unit test.

Change-Id: I8ef5ea963e7c665e0d67d390b3a833486773dab0
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Przemyslaw Gorszkowski
2013-01-12 22:05:41 +01:00
parent 0135609973
commit ffba28d26a
13 changed files with 149 additions and 23 deletions

View File

@@ -128,6 +128,27 @@ bool TemplateNameId::isEqualTo(const Name *other) const
return true;
}
bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
const TemplateNameId *other) const
{
const Identifier *id = name->identifier();
const Identifier *otherId = other->identifier();
if (id == otherId) {
// we have to differentiate TemplateNameId with respect to specialization or instantiation
if (name->isSpecialization() == other->isSpecialization()) {
return std::lexicographical_compare(name->firstTemplateArgument(),
name->lastTemplateArgument(),
other->firstTemplateArgument(),
other->lastTemplateArgument());
} else {
return name->isSpecialization();
}
}
return id < otherId;
}
OperatorNameId::OperatorNameId(Kind kind)
: _kind(kind)
{ }