public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65312] New: Implicitly-declared default constructor must be defined as deleted
@ 2015-03-04 12:10 radventure at yandex dot ru
  2015-03-04 12:16 ` [Bug c++/65312] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: radventure at yandex dot ru @ 2015-03-04 12:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65312
           Summary: Implicitly-declared default constructor must be
                    defined as deleted
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: radventure at yandex dot ru

I think the next code should not be successfully compiled because of
implicitly-declared default constructor of Array struct should be deleted

#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);
    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;
    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] << " ";
}


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-17  9:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 12:10 [Bug c++/65312] New: Implicitly-declared default constructor must be defined as deleted radventure at yandex dot ru
2015-03-04 12:16 ` [Bug c++/65312] " redi at gcc dot gnu.org
2015-03-04 12:41 ` radventure at yandex dot ru
2015-03-16 10:50 ` mpolacek at gcc dot gnu.org
2015-03-17  9:47 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).