[Bug c++/83796] [6/7/8 Regression] Abstract classes allowed to be instantiated when initialised as default parameter to function or constructor

2018-02-01 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83796

--- Comment #5 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Thu Feb  1 15:36:04 2018
New Revision: 257298

URL: https://gcc.gnu.org/viewcvs?rev=257298=gcc=rev
Log:
/cp
2018-02-01  Paolo Carlini  

PR c++/83796
* call.c (convert_like_real): If w're initializing from {} explicitly
call abstract_virtuals_error_sfinae.

/testsuite
2018-02-01  Paolo Carlini  

PR c++/83796
* g++.dg/cpp0x/abstract-default1.C: New.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/abstract-default1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/83796] [6/7/8 Regression] Abstract classes allowed to be instantiated when initialised as default parameter to function or constructor

2018-01-24 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83796

Paolo Carlini  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |paolo.carlini at oracle 
dot com

--- Comment #4 from Paolo Carlini  ---
Mine.

[Bug c++/83796] [6/7/8 Regression] Abstract classes allowed to be instantiated when initialised as default parameter to function or constructor

2018-01-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83796

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |6.5

[Bug c++/83796] [6/7/8 Regression] Abstract classes allowed to be instantiated when initialised as default parameter to function or constructor

2018-01-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83796

--- Comment #3 from Jonathan Wakely  ---
Actually I think it's r194284

commit 6fb305c7c88b07c429e8a39fbd514a417c5b6127
Author: jason 
Date:   Fri Dec 7 04:54:27 2012 +

PR c++/54325
* tree.c (build_aggr_init_expr): Don't check for abstract class.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194284
138bc75d-0d04-0410-961f-82ee72b054a4

[Bug c++/83796] [6/7/8 Regression] Abstract classes allowed to be instantiated when initialised as default parameter to function or constructor

2018-01-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83796

Jonathan Wakely  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  ---
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();
}