diff options
author | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2014-07-03 13:53:22 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-07-08 09:53:48 +0200 |
commit | 059cfde67737fb1d0d1a4c46ee62a387a07ca0b4 (patch) | |
tree | b82df1e89dc0ea79df821fee94429dae837ae0c3 /src/libs/cplusplus/LookupContext.cpp | |
parent | ce4dc86d58507997d6611f7b4895c9d1cbf7aad0 (diff) | |
download | qt-creator-059cfde67737fb1d0d1a4c46ee62a387a07ca0b4.tar.gz |
C++: template base class and default argument for template class
Fix code completion for case:
struct Foo
{
int bar;
};
template <typename T>
struct Base
{
T t;
};
template <typename T1 = Foo>
struct Derived : Base<T1>
{};
int main()
{
Derived<> foo;
foo.t.// no code completion
return 0;
}
Task-number: QTCREATORBUG-12606
Change-Id: Iadf2fae172739d0a5844c6b437fd2686616e64e7
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/libs/cplusplus/LookupContext.cpp')
-rw-r--r-- | src/libs/cplusplus/LookupContext.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index aae1b25ff1..c90fdb005d 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -1158,11 +1158,13 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac } } else { SubstitutionMap map; - for (unsigned i = 0; - i < argumentCountOfSpecialization && i < argumentCountOfInitialization; - ++i) { - map.bind(templateSpecialization->templateParameterAt(i)->name(), - templId->templateArgumentAt(i)); + for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) { + const Name *name = templateSpecialization->templateParameterAt(i)->name(); + FullySpecifiedType ty = (i < argumentCountOfInitialization) ? + templId->templateArgumentAt(i): + templateSpecialization->templateParameterAt(i)->type(); + + map.bind(name, ty); } SubstitutionEnvironment env; env.enter(&map); |