C++ PATCH for c++/54325 (wrong error initializing abstract base class)

Paolo Carlini paolo.carlini@oracle.com
Fri Dec 21 11:38:00 GMT 2012


Hi,

On 12/07/2012 06:05 AM, Jason Merrill wrote:
> It's perfectly OK to initialize a base class of abstract type; it's 
> only an error to create a full object of such a type.  So this patch 
> moves the check from more generic initialization code out into a 
> function that's definitely creating a new object.
>
> Tested x86_64-pc-linux-gnu, applying to trunk and 4.7.
I was looking a bit more into this Bug, and something seems still weird 
about the testcase in Comment #1 of the audit trail, which we also 
didn't reject with 4.6.x:

class base
{
     protected:
         base()
         {}
};

class derived : public base
{
     public:
         derived()
             : base{} // <-- Note the c++11 curly brace syntax
         {}
};

int main()
{
     derived d1;
     return 0;
}

???

Thanks,
Paolo.



More information about the Gcc-patches mailing list