[cfe-dev] clang hangs when compiling generic lambda with -fdelayed-template-parsing
Han Wang via cfe-dev
cfe-dev at lists.llvm.org
Thu Feb 15 02:11:17 PST 2018
Hi all,
The simple code listed below will make clang hang with compiler
option -fdelayed-template-parsing.
#include <vector>
template <typename Func, typename Args>
auto test_func_wrapper(Func const& func, Args const& args) {
return func(args);
}
void clang_bug_test() {
std::vector<int> vecn{1,2,3};
auto f = [](auto const& vecn) -> int {
return vecn[0];
};
test_func_wrapper(f, vecn);
}
int main() {
return 0;
}
It happens on my mac (Apple LLVM version 9.0.0 (clang-900.0.38)) and also
on godbolt.org and wandbox.org with all clang versions.
If we remove the trailing return type of the generic lambda, it compiles.
If we don't use vecn at all in the lambda and simply return 0, it also
compiles.
If we remove the -fdelayed-template-parsing, it compiles.
Best regards,
Han
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180215/60480061/attachment.html>
More information about the cfe-dev
mailing list