Community
Participate
Working Groups
Using HEAD as of today. #include <vector> template<typename T> std::vector<T> test(){}; int main() { test<int>(); return 0; } Try extracting 'test<int>()', it will assert: java.lang.AssertionError at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTemplateId.setTemplateName(CPPASTTemplateId.java:71) at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTemplateId.<init>(CPPASTTemplateId.java:46) at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNodeFactory.newTemplateId(CPPNodeFactory.java:538) at org.eclipse.cdt.internal.core.dom.rewrite.DeclarationGeneratorImpl.getDeclSpecForTemplate(DeclarationGeneratorImpl.java:307) at org.eclipse.cdt.internal.core.dom.rewrite.DeclarationGeneratorImpl.createDeclSpecFromType(DeclarationGeneratorImpl.java:119)
BTW, assertions need to be enable to reproduce this, by adding -ea in the VM arguments.
Created attachment 187425 [details] DeclarationGenerator, template with namespace patch Here is a patch. There is no need for a new test because if assertions are enabled, the namespace test from bug 331963 will fail.
Comment on attachment 187425 [details] DeclarationGenerator, template with namespace patch Oops, this patch is missing a change
Created attachment 187435 [details] DeclarationGenerator, template with namespace patch NameWriter.isDependentName(...) contains a call to resolveBinding so the index needs to be locked in CRefactoring.createChange
Comment on attachment 187435 [details] DeclarationGenerator, template with namespace patch Fixed in HEAD.
Emanuel, can you review?
*** cdt cvs genie on behalf of mlaperle *** Bug 335122 - DeclarationGenerator asserts for templated types with namespace. Restored assert in CPPASTTemplateId [*] CRefactoring.java 1.22 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java?root=Tools_Project&r1=1.21&r2=1.22 [*] DeclarationGeneratorImpl.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java?root=Tools_Project&r1=1.4&r2=1.5 [*] CPPASTTemplateId.java 1.40 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateId.java?root=Tools_Project&r1=1.39&r2=1.40
*** cdt cvs genie on behalf of mlaperle *** Bug 335122 - Fix index locking issue discovered by running the 'old' ImplementMethod test (new one being Bug 292851). Should fix build not ending. [*] CRefactoring.java 1.23 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java?root=Tools_Project&r1=1.22&r2=1.23
we need to have a look at the index locking, the AST is created in the checkInitialConditions method and used in all the following methods. So the lock should be held the hole time. The lockIndex() method has a side effect to initialize the fIndex field, so locking the index in the Runner class will effect the AST produced in the inital conditions check.