Initialisierung des const-Referenzmembers mit gelöschtem Kopierkonstruktor

Dieser Code mit einemconst A& a Mitglied inB, woA hat einen gelöschten Kopierkonstruktor, wird in GCC 4.8.1 nicht kompiliert, funktioniert aber in Clang 3.4 einwandfrei:

class A {
public:
    A() = default;
    A(const A&) = delete;
    A& operator=(const A&) = delete;
};

class B{
public:
    B(const A& a)
        : a{a}
    { }
private:
    const A& a;
};

int main()
{
    A a{};
    B b{a};
}

Welcher der Compiler hat Recht?

Der Fehler in GCC ist:

prog.cpp: In constructor ‘B::B(const A&)’:
prog.cpp:11:14: error: use of deleted function ‘A::A(const A&)’
        : a{a}
            ^
prog.cpp:4:5: error: declared here
    A(const A&) = delete;
    ^

Ideone:http://ideone.com/x1CVwx

Antworten auf die Frage(1)

Ihre Antwort auf die Frage