diff options
author | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2014-07-09 09:01:36 +0200 |
---|---|---|
committer | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2014-07-31 22:53:14 +0200 |
commit | 0bc202d52fca029849e38b05f91efed4d1ee7bd1 (patch) | |
tree | f30ce593cea17836ce280dc079b893d1fd09d889 /src/plugins/cpptools/cppcompletion_test.cpp | |
parent | 916d3dfa13d0bf8af4b381b10504d69ee96843f4 (diff) | |
download | qt-creator-0bc202d52fca029849e38b05f91efed4d1ee7bd1.tar.gz |
C++: use pointer in template specialization and initialization
Fix code completion for using pointer in template specialization and
initialization.
Example:
template <typename T>
struct S {};
template <typename T>
struct S<T*> { T* t; };
struct Foo { int foo; };
int main()
{
S<Foo*> s;
s.t-> //no code completion
return 0;
}
Task-number: QTCREATORBUG-12638
Change-Id: Idcd461806a22f08b76236f2db6346f157b12f5d3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcompletion_test.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index 3f8e3419ba..e96c790c6c 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -2295,6 +2295,35 @@ void CppToolsPlugin::test_completion_data() ) << _("derived.t.") << (QStringList() << QLatin1String("foo") << QLatin1String("Foo")); + + QTest::newRow("template_specialization_and_initialization_with_pointer1") << _( + "template <typename T>\n" + "struct S {};\n" + "template <typename T>\n" + "struct S<T*> { T *t; };\n" + "struct Foo { int foo; };\n" + "void fun() {\n" + " S<Foo*> s;\n" + " @\n" + "}\n" + ) << _("s.t->") << (QStringList() + << QLatin1String("foo") + << QLatin1String("Foo")); + + // this is not a valid code(is not compile) but it caused a crash + QTest::newRow("template_specialization_and_initialization_with_pointer2") << _( + "template <typename T1, typename T2 = int>\n" + "struct S {};\n" + "template <typename T1, typename T2>\n" + "struct S<T1*> { T1 *t; };\n" + "struct Foo { int foo; };\n" + "void fun() {\n" + " S<Foo*> s;\n" + " @\n" + "}\n" + ) << _("s.t->") << (QStringList() + << QLatin1String("foo") + << QLatin1String("Foo")); } void CppToolsPlugin::test_completion_member_access_operator() |