http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57870

            Bug ID: 57870
           Summary: Internal compiler error in use of emplace
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eyakubovich at gmail dot com

In the following code, S lacks a constructor that accepts an int. Subsequently,
g++ crashes on use of emplace:

#include <queue>

struct S {
    int x;

    friend bool operator<(S const&, S const&) { return false; }
};

int main() {
    std::priority_queue<S> q;
    q.emplace(1);

    return 0;
}

A similar problem occurs with use of std::vector, however a correct error is
first issued:

#include <vector>

struct S {
    int x;
};

int main() {
    std::vector<S> q;
    q.emplace(q.begin(), 1);

    return 0;
}

Reply via email to