[Bug libstdc++/80553] New: std::vector allows instantiation with type having a deleted destructor

marco at italiancpp dot org gcc-bugzilla@gcc.gnu.org
Fri Apr 28 08:56:00 GMT 2017


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

            Bug ID: 80553
           Summary: std::vector allows instantiation with type having a
                    deleted destructor
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marco at italiancpp dot org
  Target Milestone: ---

struct Foo
{
    ~Foo() = delete;
};

int main()
{
    vector<Foo> v;
}

This compiles just fine, although it shouldn't because 'Foo' is not Erasable.

Repro: https://wandbox.org/#wandbox-resultwindow-code-body-12

On the other hand, in the following code a compile error is legitimately
thrown:

struct Foo
{
private:
    ~Foo();
};

int main()
{
    vector<Foo> v;
}

std::list does not exhibit the same behavior:

struct Foo
{
    ~Foo() = delete;
};

int main()
{
    list<Foo> v;
}

which just fails. I have not tried other containers.


More information about the Gcc-bugs mailing list