This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/54325 (wrong error initializing abstract base class)
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 21 Dec 2012 12:38:43 +0100
- Subject: Re: C++ PATCH for c++/54325 (wrong error initializing abstract base class)
- References: <50C1790B.3040704@redhat.com>
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.