g++ 2.96 fails to enforce an access restriction to an eliminated copy ctor

Martin Sebor sebor@roguewave.com
Sat Jul 22 15:00:00 GMT 2000


Hi,

the program below should produce a diagnostic since the private copy
ctor, A::A(const A&), is inaccessible in the context of main. The
diagnostic is required even if the ctor has been eliminated (12.2, p1).

Regards
Martin


class A
{
    A (const A&);
};

struct B {
    A foo ();
};


int main ()
{
    const A &a = B().foo ();
}


More information about the Gcc-bugs mailing list