[Bug c++/92590] [10 Regression] Cannot expose protected default constructor with "using" keyword in gcc 10

2020-01-15 Thread proski at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92590

--- Comment #5 from Pavel Roskin  ---
Confirming fix on the original code. Thank you!

[Bug c++/92590] [10 Regression] Cannot expose protected default constructor with "using" keyword in gcc 10

2020-01-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92590

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Jason Merrill  ---
Fixed.

[Bug c++/92590] [10 Regression] Cannot expose protected default constructor with "using" keyword in gcc 10

2020-01-14 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92590

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Jason Merrill :

https://gcc.gnu.org/g:08c8c973c082457a7d6192673e87475f1fdfdbef

commit r10-5949-g08c8c973c082457a7d6192673e87475f1fdfdbef
Author: Jason Merrill 
Date:   Tue Jan 14 13:59:54 2020 -0500

PR c++/92590 - wrong handling of inherited default ctor.

I thought my earlier fix for 91930 was an obvious bug fix, but apparently
an
inherited constructor does not count as user-declared.  So this patch
reverts that change and the other follow-on patches, and fixes 91930
differently, by not letting the inherited default constructor hide the
implicitly-declared default constructor.

* class.c (add_method): A constrained inherited ctor doesn't hide an
implicit derived ctor.

Revert:
PR c++/91930 - ICE with constrained inherited default ctor.
* name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
for inherited constructor.
PR c++/92552 - ICE with inherited constrained default ctor.
* pt.c (instantiate_class_template_1): Copy
TYPE_HAS_USER_CONSTRUCTOR.
PR c++/92594 - ICE with inherited trivial default ctor.
* method.c (trivial_fn_p): Treat an inherited default constructor
like a normal default constructor.

[Bug c++/92590] [10 Regression] Cannot expose protected default constructor with "using" keyword in gcc 10

2020-01-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92590

--- Comment #2 from Jason Merrill  ---
This is a consequence of the change Jonathan cites, to treat the inherited
constructor as a user-declared constructor that prevents the implicit
declaration of a default constructor in Derived.

The difference in access behavior follows from this; the standard says,

"A synonym created by a using-declaration has the usual accessibility for a
member-declaration. A using-declarator that names a constructor does not create
a synonym; instead, the additional constructors are accessible if they would be
accessible when used to construct an object of the corresponding base class,
and the accessibility of the using-declaration is ignored."

So if constructing 'd' calls the inherited constructor, it's ill-formed; if it
calls the implicitly-declared default constructor, it's well-formed.

I thought my change was an obvious bug fix, but it seems that other compilers
have the old semantics, so I should probably undo it.

[Bug c++/92590] [10 Regression] Cannot expose protected default constructor with "using" keyword in gcc 10

2020-01-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92590

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/92590] [10 Regression] Cannot expose protected default constructor with "using" keyword in gcc 10

2019-11-20 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92590

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-11-20
 CC||jason at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Jonathan Wakely  ---
Regressed with r276968:

PR c++/91930 - ICE with constrained inherited default ctor.

The testcase was crashing because lazily_declare_fn was failing to add a
defaulted constructor, because the implicit declaration was less
constrained
than the inherited default constructor.  But when we have an inherited
constructor, we shouldn't be trying to declare a default constructor in the
first place, because it counts as "a user-declared constructor".  With that
fixed I needed to adjust a couple of inherited constructor testcases that
previously had been diagnosing the default constructor as deleted rather
than not declared.

* name-lookup.c (do_class_using_decl): Set
TYPE_HAS_USER_CONSTRUCTOR
for inherited constructor.

[Bug c++/92590] [10 Regression] Cannot expose protected default constructor with "using" keyword in gcc 10

2019-11-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92590

Richard Biener  changed:

   What|Removed |Added

   Keywords||rejects-valid
  Known to work||9.2.0
   Target Milestone|--- |10.0
Summary|Cannot expose protected |[10 Regression] Cannot
   |default constructor with|expose protected default
   |"using" keyword in gcc 10   |constructor with "using"
   ||keyword in gcc 10