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

--- Comment #4 from Kyrylo Bohdanenko <kyrylo.bohdanenko at gmail dot com> ---
The problem can also be worked around by manually specifying "the holy trio" of
constructors and providing empty bodies (= default does not work)

This code compiles with GCC 8.3.0 and trunk (20190919):

  template<typename _Tp, _Tp __v>
    struct integral_constant
    {
      static constexpr _Tp value = __v;
      typedef _Tp value_type;
      constexpr operator value_type() const noexcept { return value; }

      // all of these constructors are needed for the code to compile
      constexpr integral_constant(const integral_constant&) noexcept {}
      constexpr integral_constant(integral_constant&&) noexcept {}
      constexpr integral_constant() noexcept {}
    };

int main() {
  auto l = [](auto value) {
    constexpr auto i = value;
    static_cast<void>(i);
  };
  l(integral_constant<unsigned, 0>{});
}

Reply via email to