forked from qt-creator/qt-creator
C++: added missing cloning of AnonymousNameId
When instantiate a template with anonymous class/struct/union AnonymousNameId has to be cloned. Task-number: QTCREATORBUG-9227 Change-Id: Iedca5e41589e68a94a35cd4387241052c70c50df Reviewed-by: Sergey Shambir <sergey.shambir.auto@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
cd8cd4fdb1
commit
5dbcb974b0
@@ -2015,3 +2015,35 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data()
|
||||
<< code << completions;
|
||||
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_instantiate_template_with_anonymous_class()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText =
|
||||
"template <typename T>\n"
|
||||
"struct S\n"
|
||||
"{\n"
|
||||
" union { int i; char c; };\n"
|
||||
"};\n"
|
||||
"void fun()\n"
|
||||
"{\n"
|
||||
" S<int> s;\n"
|
||||
" @\n"
|
||||
" // padding so we get the scope right\n"
|
||||
"}\n"
|
||||
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("s.");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
QStringList completions = getCompletions(data);
|
||||
|
||||
QCOMPARE(completions.size(), 1);
|
||||
QVERIFY(completions.contains(QLatin1String("S")));
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ private slots:
|
||||
void test_completion_QTCREATORBUG9098();
|
||||
void test_completion_type_and_using_declaration();
|
||||
void test_completion_type_and_using_declaration_data();
|
||||
void test_completion_instantiate_template_with_anonymous_class();
|
||||
|
||||
void test_format_pointerdeclaration_in_simpledeclarations();
|
||||
void test_format_pointerdeclaration_in_simpledeclarations_data();
|
||||
|
||||
Reference in New Issue
Block a user