-
- Downloads
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>
Loading
Please register or sign in to comment