C++: Do not set binding block as instantiationOrigin

The binding in a block should not be used as an instantiationOrigin,
because it will be deleted if it does not contain any blocks or
namespaces or classes or enums.
Instead of that we should look for first enclosing class or namespace.

Task-number: QTCREATORBUG-11424
Change-Id: I0fc6e935495478f71372b0fe6f611887f45b2eda
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Przemyslaw Gorszkowski
2014-03-25 09:23:31 -04:00
committed by Nikolai Kosjar
parent a7d3340685
commit 5d3c070174
2 changed files with 20 additions and 0 deletions

View File

@@ -2190,6 +2190,22 @@ void CppToolsPlugin::test_completion_data()
"}\n"
) << _("mem") << (QStringList()
<< QLatin1String("member"));
QTest::newRow("no_binding_block_as_instantiationOrigin_QTCREATORBUG-11424") << _(
"template <typename T>\n"
"class QVector\n"
"{\n"
"public:\n"
" inline const_iterator constBegin() const;\n"
"};\n"
"\n"
"typedef struct { double value; } V;\n"
"\n"
"double getValue(const QVector<V>& d) const {\n"
" typedef QVector<V>::ConstIterator Iter;\n"
" double val = @\n"
"}\n"
) << _("d.constBegin()->") << (QStringList());
}
void CppToolsPlugin::test_completion_member_access_operator()