[cfe-dev] clang hangs when compiling generic lambda with -fdelayed-template-parsing

Nico Weber via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 15 07:19:46 PST 2018


This is https://bugs.llvm.org/show_bug.cgi?id=33561

On Thu, Feb 15, 2018 at 5:11 AM, Han Wang via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> 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
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180215/8b840e50/attachment.html>


More information about the cfe-dev mailing list