public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/94922] New: Functional cast from base class to derived class incorrectly accepted with -std=c++2a @ 2020-05-02 12:53 ppalka at gcc dot gnu.org 2020-05-02 12:57 ` [Bug c++/94922] " ppalka at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: ppalka at gcc dot gnu.org @ 2020-05-02 12:53 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94922 Bug ID: 94922 Summary: Functional cast from base class to derived class incorrectly accepted with -std=c++2a Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ppalka at gcc dot gnu.org Target Milestone: --- $ cat testcase.C struct base {}; struct derived : base {}; template <typename T, typename R, typename = decltype(T(R()))> void foo(); void bar() { foo<derived, base>(); } $ g++-10 -std=c++2a testcase.C $ g++-10 -std=c++17 testcase.C testcase.C: In function ‘void bar()’: testcase.C:10:22: error: no matching function for call to ‘foo<derived, base>()’ 13 | foo<derived, base>(); | ^ ... ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/94922] Functional cast from base class to derived class incorrectly accepted with -std=c++2a 2020-05-02 12:53 [Bug c++/94922] New: Functional cast from base class to derived class incorrectly accepted with -std=c++2a ppalka at gcc dot gnu.org @ 2020-05-02 12:57 ` ppalka at gcc dot gnu.org 2020-05-02 13:00 ` ppalka at gcc dot gnu.org 2020-05-03 4:31 ` ppalka at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: ppalka at gcc dot gnu.org @ 2020-05-02 12:57 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94922 --- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> --- The above appears to be a 10/11 regression, but note that all versions of GCC >= 4.7 also incorrectly accept the following testcase: struct base {}; struct derived : base {}; template <typename = decltype(derived(base()))> void foo(); void bar() { foo(); } ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/94922] Functional cast from base class to derived class incorrectly accepted with -std=c++2a 2020-05-02 12:53 [Bug c++/94922] New: Functional cast from base class to derived class incorrectly accepted with -std=c++2a ppalka at gcc dot gnu.org 2020-05-02 12:57 ` [Bug c++/94922] " ppalka at gcc dot gnu.org @ 2020-05-02 13:00 ` ppalka at gcc dot gnu.org 2020-05-03 4:31 ` ppalka at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: ppalka at gcc dot gnu.org @ 2020-05-02 13:00 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94922 --- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> --- Another testcase that exhibits the 10/11 regression: struct base {}; struct derived : base {}; void foo() { derived a = derived(base()); } ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/94922] Functional cast from base class to derived class incorrectly accepted with -std=c++2a 2020-05-02 12:53 [Bug c++/94922] New: Functional cast from base class to derived class incorrectly accepted with -std=c++2a ppalka at gcc dot gnu.org 2020-05-02 12:57 ` [Bug c++/94922] " ppalka at gcc dot gnu.org 2020-05-02 13:00 ` ppalka at gcc dot gnu.org @ 2020-05-03 4:31 ` ppalka at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: ppalka at gcc dot gnu.org @ 2020-05-03 4:31 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94922 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> --- Upon closer investigation I think we're correct to accept these testcases. As I understand it the construction 'Derived(Base())' is valid in C++20 as a direct consequence of C++17's aggregate init of classes with base classes (P0017R1) in conjunction with C++20's parenthesized init of aggregates (P0960R3). Thus closing this bug as invalid, sorry for the noise. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-03 4:31 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-05-02 12:53 [Bug c++/94922] New: Functional cast from base class to derived class incorrectly accepted with -std=c++2a ppalka at gcc dot gnu.org 2020-05-02 12:57 ` [Bug c++/94922] " ppalka at gcc dot gnu.org 2020-05-02 13:00 ` ppalka at gcc dot gnu.org 2020-05-03 4:31 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).