https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68495
Bug ID: 68495
Summary: Error when expanding nontype variadic argument in
trailing return type
Product: gcc
Version: 5.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: sneves at dei dot uc.pt
Target Milestone: ---
Minimal example, works on Clang and MSVC but fails to compile on every GCC
version since 4.7:
template<int ...> struct int_seq {};
constexpr struct {
constexpr int operator()(int x) const { return x + 1; }
} f1 {};
template<typename F, int... As>
auto f2(F f, int_seq<As...>) -> int_seq<f(As)...> {
return {};
}
int main() {
f2(f1, int_seq<0, 1, 2, 3>{});
}
Replacing `int_seq<f(As)...>` by `int_seq<f1(As)...>` in the return type causes
the snippet to compile successfully.