summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2015-05-22 10:22:01 +0300
committerOrgad Shaneh <orgads@gmail.com>2015-05-22 08:40:11 +0000
commitb5f6a9e6e57c0b43878167e3f1036516f21018e4 (patch)
tree91c1dc16b8105e17468f7c54ef7918a70df5e32b /src/plugins/cpptools/cppcompletion_test.cpp
parent04c4043e13f1d83067a1e4bbee5880b37050e876 (diff)
downloadqt-creator-b5f6a9e6e57c0b43878167e3f1036516f21018e4.tar.gz
C++: Fix decltype resolving for nested instantiated class
The enclosingScope of a cloned nested class is not the original class but the cloned parent. Use-case: template <typename T> struct Temp { struct Nested { static T f(); typedef decltype(f()) type; }; }; struct Foo { int bar; }; void fun() { Temp<Foo>::Nested::type s; s.bar; // bar not highlighted } Task-number: QTCREATORBUG-14483 Change-Id: I3e15399a78a7492f740db8d0c7d5c84adf77d1d0 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index 2fab0bed6e..e9c35198cb 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -2962,6 +2962,28 @@ void CppToolsPlugin::test_completion_data()
) << _("s.") << (QStringList()
<< QLatin1String("Foo")
<< QLatin1String("bar"));
+
+ QTest::newRow("nested_instantiation_typedefed_decltype_declaration") << _(
+ "template <typename T>\n"
+ "struct Temp\n"
+ "{\n"
+ " struct Nested\n"
+ " {\n"
+ " static T f();\n"
+ " typedef decltype(f()) type;\n"
+ " };\n"
+ "};\n"
+ "\n"
+ "struct Foo { int bar; };\n"
+ "\n"
+ "void fun()\n"
+ "{\n"
+ " Temp<Foo>::Nested::type s;\n"
+ " @\n"
+ "}\n"
+ ) << _("s.") << (QStringList()
+ << QLatin1String("Foo")
+ << QLatin1String("bar"));
}
void CppToolsPlugin::test_completion_member_access_operator()