[Bug c++/87663] Exorbitant compile times

lumosimann at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Oct 26 20:46:00 GMT 2018


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

--- Comment #3 from Lukas Mosimann <lumosimann at gmail dot com> ---
```
template <typename T, T v>
struct integral_constant {
    static constexpr T value = v;
    using value_type = T;
    using type = integral_constant<T, v>;
};

template <int X, int A, int Z>
struct F : integral_constant<int,  //
                             F<X + (1 << A), A - 1, Z + (1 << A)>::value -
                                 F<X + (1 << A), A - 2, Z>::value> {};
template <int X, int A, int Z>
struct P : integral_constant<int,  //
                             P<X + (1 << A), A - 1, Z + (1 << A)>::value -
                                 P<X + (1 << A), A - 1, Z>::value> {};

template <int X, int Z>
struct F<X, 0, Z> : integral_constant<int, X> {};
template <int X, int Z>
struct F<X, 1, Z> : integral_constant<int, X + 1> {};

template <int X, int Z>
struct P<X, 0, Z> : integral_constant<int, X> {};
template <int X, int Z>
struct P<X, 1, Z> : integral_constant<int, X + 1> {};

int main() {
    P_OR_F<0, N, 0>::value;
    return 0;
}
```

This is a shorter reproducible without other headers. The problem is the line
`using value_type = T`. I would love to debug this, but I don't know where to
start.


More information about the Gcc-bugs mailing list