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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.7.2
           Keywords|diagnostic                  |
   Last reconfirmed|                            |2018-01-12
                 CC|                            |jason at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|Abstract classes allowed to |[6/7/8 Regression] Abstract
                   |be instantiated when        |classes allowed to be
                   |initialised as default      |instantiated when
                   |parameter to function or    |initialised as default
                   |constructor                 |parameter to function or
                   |                            |constructor
      Known to fail|                            |4.7.3, 4.8.4, 4.9.3, 5.4.0,
                   |                            |6.3.0, 7.2.0, 8.0

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
r194820 is a likely candidate, thanks.

Valid testcase (the one above doesn't compile) which calls a pure virtual at
runtime when compiled with G++ or EDG:

struct MyAbstractClass
{
    virtual int foo() const = 0;
};

struct TestClass
{
    TestClass(const MyAbstractClass& m = {}) // should generate compiler error
        : value_(m.foo()) {}

    int value_;
};

int TestFunction(const MyAbstractClass& m = {}) // should generate compiler
error
{
    return m.foo();
}

int main(int argc, char *argv[])
{
    TestClass testInstance;
    TestFunction();
}

Reply via email to