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

Use of lambda expression in noexcept operator causes clang crash #97980

Closed
Life4gal opened this issue Jul 8, 2024 · 2 comments
Closed

Use of lambda expression in noexcept operator causes clang crash #97980

Life4gal opened this issue Jul 8, 2024 · 2 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] duplicate Resolved as duplicate lambda C++11 lambda expressions

Comments

@Life4gal
Copy link

Life4gal commented Jul 8, 2024

I wrote a piece of code for testing purposes:

#include <algorithm>
#include <functional>
#include <ranges>

template<typename T>
struct foo
{
    template<typename U>
    constexpr static auto bar(
        const U from,
        const std::type_identity_t<U> to
    )
    {
        return 42;
    }

    template<typename Container, typename U>
    constexpr static auto bar(
        Container& container,
        const U from,
        const std::type_identity_t<U> to,
        const std::size_t count
    )
    noexcept(noexcept(
        std::ranges::generate_n(
                            std::back_inserter(container),
                            count,
                            [from, to]() noexcept(noexcept(foo::bar(from, to))) { return foo::bar(from, to); }) //
    )) -> void
    {
        std::ranges::generate_n(
                            std::back_inserter(container),
                            count,
                            [from, to]() noexcept(noexcept(foo::bar(from, to))) { return foo::bar(from, to); });
    }
};

int main() {
    return 0;
}

The result of the compilation is shown below (you can also check out the godbolt link)
image

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Jul 8, 2024
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] lambda C++11 lambda expressions and removed clang Clang issues not falling into any other category labels Jul 8, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 8, 2024

@llvm/issue-subscribers-clang-frontend

Author: Life4gal (Life4gal)

I wrote a piece of code for testing purposes: ```cpp #include <algorithm> #include <functional> #include <ranges>

template<typename T>
struct foo
{
template<typename U>
constexpr static auto bar(
const U from,
const std::type_identity_t<U> to
)
{
return 42;
}

template&lt;typename Container, typename U&gt;
constexpr static auto bar(
    Container&amp; container,
    const U from,
    const std::type_identity_t&lt;U&gt; to,
    const std::size_t count
)
noexcept(noexcept(
    std::ranges::generate_n(
                        std::back_inserter(container),
                        count,
                        [from, to]() noexcept(noexcept(foo::bar(from, to))) { return foo::bar(from, to); }) //
)) -&gt; void
{
    std::ranges::generate_n(
                        std::back_inserter(container),
                        count,
                        [from, to]() noexcept(noexcept(foo::bar(from, to))) { return foo::bar(from, to); });
}

};

int main() {
return 0;
}


The result of the compilation is shown below (you can also check out the [godbolt link](https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGIAGykrgAyeAyYAHI%2BAEaYxCBmAMykAA6oCoRODB7evgGp6ZkCoeFRLLHxSbaY9o4CQgRMxAQ5Pn6BdpgOWQ1NBCWRMXEJyQqNza15HeP9YYPlw0kAlLaoXsTI7BzmiWHI3lgA1CaJbmLAJIQILCfYJhoAgjt7B5jHp1ReDN0CYrf3TySLy8RxObmIhmAmAU/0eAIImBYKQMCLBBAAnilGKw3gAVWEPMbELwOQ78VAAkwAdisj0O9MOCKRKMwaMx2LYhzkBIZhzQDDGmFUKWIhzGTEcyEOTC8REO0SaEABvN5/LGXLJxFQLFIypV9LVBDFBHQIBAGKxAH08FhBIR0ZaCGDuYlsIyKXSGUs9fTqbSHvr6cRMAR1gxDpIzCd/bzqQARSme%2BlM5ES1mnC0ct4eQRMOZkRns5icl13JN8gSC4Wi8WS6Wy1DyxU%2BlU5xr58z%2BCu5/O68uqytGuSa7V9gOBw3G03m9nW22ODGO523d1jwPd9VjacZABemEdFa%2BTvL3vLDFQQs2KQIEHPl8w16V/YZW7NEKM0LNUPCEIRloYT7juuwHAa%2BIAKsgAD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GKtBDa0qRbTDhofwesqROOFSAfCd0lW4agy7SJhGtXJJ1Uk/VB9mApAUAgVABBWPms46nW1Nr052tKXnKaQmXU1PbmJr19dJO8Gk4sgN7Su4KcRkp3pKnI1qcGbwTToyMABt09MuIsz16GaWSZszGy83bPzjZ7GEgS340c8/BIrnLnueud/Lz/8fMtueW2gLFhO3dvC327FyDUE5bixQhdqXks5dZwwedWKl0MHRauzLy6%2BHlYXbwjFJXRdc9PcIqrYiatSIrjIq98jgDIClHekWD6n1cp63hgxn7jFqx/aQBec35c4cgyq5bCtYMrQ0GtObkZvE%2BKWlYtaTisNm5CbruaTizC1dpZBtVKxl4ZGcJIIAA%3D%3D))
![image](https://github.com/llvm/llvm-project/assets/52756109/0226eb97-0d38-4a3f-858f-309a518fb959)



</details>

@zyn0217
Copy link
Contributor

zyn0217 commented Jul 8, 2024

Duplicate of #97453.

@zyn0217 zyn0217 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2024
@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] duplicate Resolved as duplicate lambda C++11 lambda expressions
Projects
None yet
Development

No branches or pull requests

4 participants