[Bug c++/65312] Implicitly-declared default constructor must be defined as deleted
radventure at yandex dot ru
gcc-bugzilla@gcc.gnu.org
Wed Mar 4 12:41:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65312
--- Comment #2 from radventure at yandex dot ru ---
(In reply to Jonathan Wakely from comment #1)
> I believe this is a GCC extension, G++ implements the proposed resolution of
> http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#253 and since
> all sub-objects of List are correctly initialized, no initializer is
> required for the member of that type.
Ok. Other question on a little bit another code. Why generated output so
dramatically changed when I removed initializer of 'data' member of Array
struct (//Here commented)
#include <cstdint>
#include <iostream>
constexpr uint64_t Fib(uint32_t i)
{
return (i < 2)? i: (Fib(i - 1) + Fib(i - 2));
}
template <uint32_t Z, uint32_t N> struct List
{
const uint64_t val = Fib(Z - N);
const List<Z, N - 1> next{};
};
template <uint32_t Z> struct List<Z, 0>
{
const uint64_t value = Fib(Z - 0);
};
template <uint32_t Z> struct Array
{
const List<Z - 1, Z - 1> data{}; //Here
const uint64_t *table = reinterpret_cast<const uint64_t*>(&data);
constexpr uint32_t size() const { return Z; }
};
Array<20u> array;
int main()
{
for (uint32_t i(0); i < array.size(); ++i)
std::cout << array.table[i] << " ";
}
More information about the Gcc-bugs
mailing list