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

--- Comment #2 from Benjamin Buch <benni.buch at gmail dot com> ---
The ICE is fixed in trunk, but the wrong argument pack lengths mismatch does
still exist:


constexpr auto calc = [](auto, auto dim)noexcept{ return dim; };

template < typename ... Ds >
constexpr auto f(Ds ...)noexcept{
    return [](auto ... n){ return (calc(n, Ds{}), ...); }(Ds{} ...);
}

int main(){
    f();      // Wrong error
    f(0);     // OK
    f(0, 0);  // Wrong error
}


$ g++ -std=c++1z main.cpp
main.cpp: In instantiation of 'constexpr auto f(Ds ...) [with Ds = {}]':
main.cpp:9:7:   required from here
main.cpp:5:57: error: mismatched argument pack lengths while expanding 'calc(n,
Ds{})'
     return [](auto ... n){ return (calc(n, Ds{}), ...); }(Ds{} ...);
                                                         ^
main.cpp: In instantiation of 'constexpr auto f(Ds ...) [with Ds = {int,
int}]':
main.cpp:11:11:   required from here
main.cpp:5:57: error: mismatched argument pack lengths while expanding 'calc(n,
Ds{})'


$ g++ --version
g++ (GCC) 8.0.0 20171201 (experimental)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to