From ae8b4e25da919d069db7b595c9fc9741ffa62f86 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Thu, 8 Feb 2018 23:40:47 -0500 Subject: [PATCH] Bug 519091 - Do not bypass the caching mechanism for class member specializations Direct calls to CPPTemplates.createSpecialization() bypass the caching mechanism, resulting in the violation of invariants such as every binding being represented by a unique (AST-derived) binding object. ICPPClassSpecialization.specializeMember() should be used instead. Change-Id: I10ddb06d087d97cf05c6bed0d9f14a15440b87fe --- .../tests/IndexCPPTemplateResolutionTest.java | 31 +++++++++++++++++++ .../parser/cpp/semantics/CPPTemplates.java | 10 ++++++ .../parser/cpp/semantics/EvalFunctionSet.java | 4 +-- .../cpp/semantics/EvalMemberAccess.java | 2 +- .../parser/cpp/semantics/ExecDeclarator.java | 13 ++++++-- .../cpp/semantics/ExecRangeBasedFor.java | 17 +++++++--- 6 files changed, 68 insertions(+), 9 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java index f172faccb84..c5c65d39bfa 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java @@ -3167,4 +3167,35 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa public void testSpecializationOfAnonymousClass_528456() throws Exception { checkBindings(); } + + // // empty file + + // namespace std { + // template + // struct initializer_list { + // const E* array; + // int len; + // constexpr const E* begin() const { return array; } + // constexpr const E* end() const { return array + len; } + // }; + // } + // template + // struct QFlags { + // int i; + // constexpr QFlags(std::initializer_list flags) + // : i(initializer_list_helper(flags.begin(), flags.end())) {} + // constexpr static int initializer_list_helper(const Enum* it, const Enum* end) { + // return it == end ? 0 : (int(*it) | initializer_list_helper(it + 1, end)); + // } + // }; + // enum Option { + // ShowMessageBox = 0x02, + // Log = 0x04 + // }; + // struct MessageFunctionPrivate { + // QFlags