diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-11-07 21:37:28 +1100 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-12-14 12:28:23 +1100 |
commit | a6a15bc5b77c8703a95130f410a944f5408a5cc4 (patch) | |
tree | 672bd2203a09d3237b558fc6996c8e07a68bcd61 /gcc/fortran/trans-expr.cc | |
parent | 7238b074b59d1e9356456c709df321bc9f6ab8bf (diff) | |
download | gcc-a6a15bc5b77c8703a95130f410a944f5408a5cc4.zip gcc-a6a15bc5b77c8703a95130f410a944f5408a5cc4.tar.gz gcc-a6a15bc5b77c8703a95130f410a944f5408a5cc4.tar.bz2 |
c++: Disallow decomposition of lambda bases [PR90321]
Decomposition of lambda closure types is not allowed by
[dcl.struct.bind] p6, since members of a closure have no name.
r244909 made this an error, but missed the case where a lambda is used
as a base. This patch moves the check to find_decomp_class_base to
handle this case.
As a drive-by improvement, we also slightly improve the diagnostics to
indicate why a base class was being inspected. Ideally the diagnostic
would point directly at the relevant base, but there doesn't seem to be
an easy way to get this location just from the binfo so I don't worry
about that here.
PR c++/90321
gcc/cp/ChangeLog:
* decl.cc (find_decomp_class_base): Check for decomposing a
lambda closure type. Report base class chains if needed.
(cp_finish_decomp): Remove no-longer-needed check.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/decomp62.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Marek Polacek <polacek@redhat.com>
Diffstat (limited to 'gcc/fortran/trans-expr.cc')
0 files changed, 0 insertions, 0 deletions