-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
clang-format crashes when trying to format the following (admittedly syntactically incorrect) code snippet
template <class T>
requires(requires { std::declval<T>()
with the following call stack:
clang-format.exe!clang::format::UnwrappedLineParser::parseRequiresClause(clang::format::FormatToken * RequiresToken) Line 3636 C++
clang-format.exe!clang::format::UnwrappedLineParser::parseRequires() Line 3505 C++
clang-format.exe!clang::format::UnwrappedLineParser::parseStructuralElement(const clang::format::FormatToken * OpeningBrace,clang::format::UnwrappedLineParser::IfStmtKind * IfKind, clang::format::FormatToken * * IfLeftBrace, bool * HasDoWhile, bool * HasLabel) Line 1794 C++
clang-format.exe!clang::format::UnwrappedLineParser::parseLevel(const clang::format::FormatToken * OpeningBrace, clang::format::UnwrappedLineParser::IfStmtKind * IfKind,clang::format::FormatToken * * IfLeftBrace) Line 479 C++
clang-format.exe!clang::format::UnwrappedLineParser::parseFile() Line 289 C++
clang-format.exe!clang::format::UnwrappedLineParser::parse() Line 217 C++
clang-format.exe!clang::format::TokenAnalyzer::process(bool SkipAnnotation) Line 116 C++
[Inline Frame] clang-format.exe!clang::format::internal::reformat::__l39::<lambda_6>::operator()(const clang::format::Environment &) Line 3796 C++
[Inline Frame] clang-format.exe!std::invoke(clang::format::internal::reformat::__l39::<lambda_6> &) Line 1705 C++
clang-format.exe!std::_Func_impl_no_alloc<`clang::format::internal::reformat'::`39'::<lambda_6>,std::pair<clang::tooling::Replacements,unsigned int>clang::format::Environment const &>::_Do_call(const clang::format::Environment & <_Args_0>) Line 876 C++
[Inline Frame] clang-format.exe!std::_Func_class<std::pair<clang::tooling::Replacements,unsigned int>,clang::format::Environment const &>::operator()(constclang::format::Environment &) Line 920 C++
clang-format.exe!clang::format::internal::reformat(const clang::format::FormatStyle & Style, llvm::StringRef Code, llvm::ArrayRef<clang::tooling::Range> Ranges, unsignedint FirstStartColumn, unsigned int NextStartColumn, unsigned int LastStartColumn, llvm::StringRef FileName, clang::format::FormattingAttemptStatus * Status) Line 3843 ++
clang-format.exe!clang::format::reformat(const clang::format::FormatStyle & Style, llvm::StringRef Code, llvm::ArrayRef<clang::tooling::Range> Ranges, llvm::StringRefFileName, clang::format::FormattingAttemptStatus * Status) Line 3886 C++
clang-format.exe!clang::format::format(llvm::StringRef FileName, bool ErrorOnIncompleteFormat) Line 511 C++
clang-format.exe!main(int argc, const char * * argv) Line 738 C++
Happens in main as well as 19.1.x, did not tried other versions.