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

Stephane Kaloustian <stephane.kaloust...@optimo-medical.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stephane.kaloustian@optimo-
                   |                            |medical.com

--- Comment #3 from Stephane Kaloustian 
<stephane.kaloust...@optimo-medical.com> ---
In my understanding, this is related to the creation of a copy. 
Using g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4):

struct B{
    B(){}
    ~B(){}
    B(const B&) = delete;
};

int main (int argc, char** argv)
{
    B myB;
    const B & bref1 = myB; // OK
    const B & bref2(myB);  // OK
    const B & bref3{myB};  // ERROR
    return 0;
}

delref.cpp: In function ‘int main(int, char**)’:
delref.cpp:14:24: error: use of deleted function ‘B::B(const B&)’
     const B & bref3{myB};
                        ^
delref.cpp:5:5: error: declared here
     B(const B&) = delete;
     ^

Reply via email to