This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/68876] New: Segmentation fault with variadic templates, std::forward and decltype


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68876

            Bug ID: 68876
           Summary: Segmentation fault with variadic templates,
                    std::forward and decltype
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vittorio.romeo at outlook dot com
  Target Milestone: ---

Not sure what's causing the segmentation fault, but here's a minimal example.
The segfault happens with g++ 5.1, 5.2 and 5.3.

gcc.godbolt.org link: https://goo.gl/eQhvm4



#include <utility>

struct static_for_result
{
    template <typename... Ts>
    constexpr decltype(auto) operator()(Ts&&... xs)
    {
        auto fn_call = [this, &xs...]()
        {
            return ([](auto&&...)
                {
                })(std::forward<decltype(xs)>(xs)...);
        };

        return int{};
    }
};

template <typename TF>
constexpr decltype(auto) static_for(TF&&)
{
    return static_for_result{};
}

int main()
{
    auto empty_for = static_for([&](auto, auto)
        {
        })(0);

    return 0;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]