C++: Improve accuracy in findSpecialization
* If a template type is specialized as a pointer, accept only pointers (of any
type)
* Same for references and arrays
* Only if the specialized type is not part of the template, match it
against the input.
Fixes resolving of partial specialization with pointers.
Use-cases:
// 1
struct b {};
struct a : b {};
template<class X, class Y> struct s { float f; };
template<class X> struct s<X, b*> { int i; };
template<class X> struct s<X, a*> { char j; };
void f()
{
s<int, a*> var;
var.j; // j not highlighted
}
// 2
template <typename T> struct Temp { T variable; };
template <typename T> struct Temp<T &> { T reference; };
void func()
{
Temp<int&> templ;
templ.reference; // reference not highlighted
}
// 3
class false_type {};
class true_type {};
template<class T1, class T2> class and_type { false_type f; };
template<> class and_type<true_type, true_type> { true_type t; };
void func2()
{
and_type<true_type, false_type> a;
a.f; // f not highlighted
}
Task-number: QTCREATORBUG-14036
Change-Id: Idee5e3f41d15c0772318d3837cbcd442cb80293a
Reviewed-by:
Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Showing
Please register or sign in to comment