public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/115114] New: aggregate initialization with parens fails when there is a base class @ 2024-05-15 20:52 eric.niebler at gmail dot com 2024-05-17 4:47 ` [Bug c++/115114] " pinskia at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: eric.niebler at gmail dot com @ 2024-05-15 20:52 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115114 Bug ID: 115114 Summary: aggregate initialization with parens fails when there is a base class Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eric.niebler at gmail dot com Target Milestone: --- I believe the following is valid C++20: struct get_answer {}; template <class Query, class Value> struct with : Query { Value value; }; int main() { with w1{get_answer(), 42}; // works with w2(get_answer(), 42); // fails } clang and msvc accept this code. gcc-trunk rejects it. See https://godbolt.org/z/KvGjn47f9. If I change the definition of the `with` class template to the following, the code compiles: template <class Query, class Value> struct with { Query query; Value value; }; ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/115114] aggregate initialization with parens fails when there is a base class 2024-05-15 20:52 [Bug c++/115114] New: aggregate initialization with parens fails when there is a base class eric.niebler at gmail dot com @ 2024-05-17 4:47 ` pinskia at gcc dot gnu.org 2024-05-17 13:03 ` cvs-commit at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-05-17 4:47 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115114 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2024-05-17 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651935.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/115114] aggregate initialization with parens fails when there is a base class 2024-05-15 20:52 [Bug c++/115114] New: aggregate initialization with parens fails when there is a base class eric.niebler at gmail dot com 2024-05-17 4:47 ` [Bug c++/115114] " pinskia at gcc dot gnu.org @ 2024-05-17 13:03 ` cvs-commit at gcc dot gnu.org 2024-05-20 13:51 ` cvs-commit at gcc dot gnu.org 2024-05-20 13:53 ` ppalka at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2024-05-17 13:03 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115114 --- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:5aaf47cb1987bbc5508c4b9b7dad5ea7d69af2c2 commit r15-630-g5aaf47cb1987bbc5508c4b9b7dad5ea7d69af2c2 Author: Patrick Palka <ppalka@redhat.com> Date: Fri May 17 09:02:52 2024 -0400 c++: aggregate CTAD w/ paren init and bases [PR115114] During aggregate CTAD with paren init, we're accidentally overlooking base classes since TYPE_FIELDS of a template type doesn't contain corresponding base fields. So we need to consider them separately. PR c++/115114 gcc/cp/ChangeLog: * pt.cc (maybe_aggr_guide): Consider bases in the paren init case. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/class-deduction-aggr15.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/115114] aggregate initialization with parens fails when there is a base class 2024-05-15 20:52 [Bug c++/115114] New: aggregate initialization with parens fails when there is a base class eric.niebler at gmail dot com 2024-05-17 4:47 ` [Bug c++/115114] " pinskia at gcc dot gnu.org 2024-05-17 13:03 ` cvs-commit at gcc dot gnu.org @ 2024-05-20 13:51 ` cvs-commit at gcc dot gnu.org 2024-05-20 13:53 ` ppalka at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2024-05-20 13:51 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115114 --- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:a9837934203d41c96b5cf05e34f68c0d3311c973 commit r14-10221-ga9837934203d41c96b5cf05e34f68c0d3311c973 Author: Patrick Palka <ppalka@redhat.com> Date: Fri May 17 09:02:52 2024 -0400 c++: aggregate CTAD w/ paren init and bases [PR115114] During aggregate CTAD with paren init, we're accidentally overlooking base classes since TYPE_FIELDS of a template type doesn't contain corresponding base fields. So we need to consider them separately. PR c++/115114 gcc/cp/ChangeLog: * pt.cc (maybe_aggr_guide): Consider bases in the paren init case. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/class-deduction-aggr15.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com> (cherry picked from commit 5aaf47cb1987bbc5508c4b9b7dad5ea7d69af2c2) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/115114] aggregate initialization with parens fails when there is a base class 2024-05-15 20:52 [Bug c++/115114] New: aggregate initialization with parens fails when there is a base class eric.niebler at gmail dot com ` (2 preceding siblings ...) 2024-05-20 13:51 ` cvs-commit at gcc dot gnu.org @ 2024-05-20 13:53 ` ppalka at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: ppalka at gcc dot gnu.org @ 2024-05-20 13:53 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115114 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org CC| |ppalka at gcc dot gnu.org Target Milestone|--- |14.2 Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> --- Fixed for GCC 14.2, thanks for the bug report. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-20 13:53 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-05-15 20:52 [Bug c++/115114] New: aggregate initialization with parens fails when there is a base class eric.niebler at gmail dot com 2024-05-17 4:47 ` [Bug c++/115114] " pinskia at gcc dot gnu.org 2024-05-17 13:03 ` cvs-commit at gcc dot gnu.org 2024-05-20 13:51 ` cvs-commit at gcc dot gnu.org 2024-05-20 13:53 ` 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).