summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2015-06-07 11:47:50 +0300
committerOrgad Shaneh <orgads@gmail.com>2015-06-09 14:18:17 +0000
commit97d3d9ac0946f3be0e036b70401352e3ddaeb8fc (patch)
tree3bba03e6e4aa9025e07cdfce94b52f45570b9c74 /src/plugins/cpptools/cppcompletion_test.cpp
parent1c7e465c30bb0d46ec43fe571b9c6aa0e3499754 (diff)
downloadqt-creator-97d3d9ac0946f3be0e036b70401352e3ddaeb8fc.tar.gz
C++: Support default template argument lookup for specialization
This fixes std::vector, although it doesn't really resolve numeric template arguments. It just picks the first specialization. Use-case: class Foo {}; template<class T1 = Foo> class Temp; template<> class Temp<Foo> { int var; }; void func() { Temp<> t; t.var; // var not highlighted } Task-number: QTCREATORBUG-8922 Change-Id: I593515beb3a6d901b6088db8bc1b8e16c39083d3 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.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index 563a6b9a1c..3bf0904c65 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -2689,6 +2689,19 @@ void CppToolsPlugin::test_completion_data()
<< QLatin1String("f")
<< QLatin1String("and_type"));
+ QTest::newRow("specialization_with_default_value") << _(
+ "class Foo {};\n"
+ "template<class T1 = Foo> class Temp;\n"
+ "template<> class Temp<Foo> { int var; };\n"
+ "void func()\n"
+ "{\n"
+ " Temp<> t;\n"
+ " @\n"
+ "}\n"
+ ) << _("t.") << (QStringList()
+ << QLatin1String("var")
+ << QLatin1String("Temp"));
+
QTest::newRow("auto_declaration_in_if_condition") << _(
"struct Foo { int bar; };\n"
"void fun() {\n"