Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.ArrayIndexOutOfBoundsException in CPPFunction.resolveParameter() while index rebuild #902

Open
gemtmp opened this issue Sep 13, 2024 · 0 comments

Comments

@gemtmp
Copy link

gemtmp commented Sep 13, 2024

Describe the bug
Indexer does not work on files with #include <vector> from clang 16 and c++20 code .

To Reproduce
Steps to reproduce the behavior:

  1. create C++ project and create cpp file:
struct fn {
  template <class A>
  auto operator()(A) requires (true) {}
};

template<typename a, typename b> struct bb {};

using sentinel_t = decltype(fn{}(1));

using common_range =  bb<int, sentinel_t>;

void someF(int...);
void someF(int...) {}
  1. Go to Project ->Index ->Rebuild
  2. Indexer fails with exception
Indexer: start PDOMRebuildTask
Indexer: parsing /common/aa.cpp
Indexer: exception: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction.resolveParameter(CPPFunction.java:419)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameter.resolveFinalBinding(CPPParameter.java:312)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase.resolveFinalBinding(CPPASTNameBase.java:161)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase.getBinding(CPPASTNameBase.java:150)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTranslationUnit$ProblemBindingClearer.visit(CPPASTTranslationUnit.java:235)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName.accept(CPPASTName.java:158)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator.accept(CPPASTDeclarator.java:206)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTParameterDeclaration.accept(CPPASTParameterDeclaration.java:108)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator.postAccept(CPPASTFunctionDeclarator.java:292)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator.accept(CPPASTDeclarator.java:220)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclaration.accept(CPPASTSimpleDeclaration.java:116)
	at org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit.accept(ASTTranslationUnit.java:289)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTranslationUnit.resolveAmbiguities(CPPASTTranslationUnit.java:249)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.resolveAmbiguities(AbstractGNUSourceCodeParser.java:707)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parse(AbstractGNUSourceCodeParser.java:690)
	at org.eclipse.cdt.core.dom.parser.AbstractCLikeLanguage.getASTTranslationUnit(AbstractCLikeLanguage.java:171)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.createAST(AbstractIndexerTask.java:1244)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseFile(AbstractIndexerTask.java:1102)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseLinkage(AbstractIndexerTask.java:910)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.runTask(AbstractIndexerTask.java:572)
	at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.run(PDOMIndexerTask.java:164)
	at org.eclipse.cdt.internal.core.pdom.indexer.PDOMRebuildTask.run(PDOMRebuildTask.java:94)
	at org.eclipse.cdt.internal.core.pdom.PDOMIndexerJob.run(PDOMIndexerJob.java:160)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Expected behavior
Indexer should parse source file.

Version Information (please complete the following information):

  • Eclipse Version: 2024-09 (4.33.0)
  • C/C++ Development Tools 11.6.1.202407022008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant