mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Bug 434467 - Fix NPE caused by incorrect caching of enumerators
Change-Id: I7b0df5ea7d7b89ac89c42e8dc4091b3d5bf944f2 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/26696 Tested-by: Hudson CI Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
80c32be4b6
commit
92e5739ba6
2 changed files with 27 additions and 1 deletions
|
@ -2525,4 +2525,30 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public void testSpecializationOfConstexprFunction_420995() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
// template <class TYPE>
|
||||
// class waldo {
|
||||
// enum {
|
||||
// X = sizeof(TYPE),
|
||||
// Y = 1
|
||||
// };
|
||||
//
|
||||
// int value = X && 1;
|
||||
// };
|
||||
//
|
||||
// template <int> struct A {};
|
||||
//
|
||||
// template <class TYPE>
|
||||
// struct impl : A<waldo<TYPE>::value> {};
|
||||
//
|
||||
// template <class TYPE>
|
||||
// struct meta : impl<TYPE>::type {};
|
||||
//
|
||||
// template <>
|
||||
// struct meta<int> {};
|
||||
|
||||
// int z;
|
||||
public void testEnumerationWithMultipleEnumerators_434467() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ class PDOMCPPEnumScope implements ICPPEnumScope, IIndexScope {
|
|||
Reference<CharArrayMap<IPDOMCPPEnumerator>> cached= (Reference<CharArrayMap<IPDOMCPPEnumerator>>) pdom.getCachedResult(key);
|
||||
CharArrayMap<IPDOMCPPEnumerator> map= cached == null ? null : cached.get();
|
||||
if (map != null) {
|
||||
map.put(enumType.getNameCharArray(), enumItem);
|
||||
map.put(enumItem.getNameCharArray(), enumItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue