This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68876] New: Segmentation fault with variadic templates, std::forward and decltype
- From: "vittorio.romeo at outlook dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 12 Dec 2015 15:07:40 +0000
- Subject: [Bug c++/68876] New: Segmentation fault with variadic templates, std::forward and decltype
- Auto-submitted: auto-generated
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;
}