C++: Fix regression when binding qualified names

This was introduced in function extraction refactoring intended
to fix an issue with invalid class names: a66e344b42
The patch fixes only the regression itself - the previous fix
is correct.

The report below consists two parts. The other one is not a
regression but nevertheless is fixed by the previous patch.

Task-number: QTCREATORBUG-7730
Change-Id: I6f65584902619b542c9ce56cd0f37218a3d50104
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Leandro Melo
2012-08-22 16:26:49 +02:00
parent 11f6ae4a14
commit 15a67c41c3

View File

@@ -3131,13 +3131,12 @@ void Bind::ensureValidClassName(const Name **name, unsigned sourceLocation)
return; return;
const QualifiedNameId *qName = (*name)->asQualifiedNameId(); const QualifiedNameId *qName = (*name)->asQualifiedNameId();
if (qName) const Name *uqName = qName ? qName->name() : *name;
*name = qName->name();
if (!(*name)->isNameId() && !(*name)->isTemplateNameId()) { if (!uqName->isNameId() && !uqName->isTemplateNameId()) {
translationUnit()->error(sourceLocation, "expected a class-name"); translationUnit()->error(sourceLocation, "expected a class-name");
*name = (*name)->identifier(); *name = uqName->identifier();
if (qName) if (qName)
*name = control()->qualifiedNameId(qName->base(), *name); *name = control()->qualifiedNameId(qName->base(), *name);
} }