[Bug c++/123642] [reflection] error in case of splice with reflection of an anonymous union member
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Feb 22 15:02:31 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123642
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:403ffd5d11ccaa5cf68d0220c4b2b793b6b7d3f7
commit r16-7625-g403ffd5d11ccaa5cf68d0220c4b2b793b6b7d3f7
Author: Valentyn Yukhymenko <valentin.yukhymenko@gmail.com>
Date: Fri Feb 20 16:31:36 2026 +0000
c++/reflection: anon union member from splice [PR123642]
Fixes a bogus "'Cls::<unnamed union>' is not a base of 'const Cls'" error
when user tries to do a class member lookup using splice with reflection of
anon union member.
PR c++/123642
gcc/cp/ChangeLog:
* typeck.cc (finish_class_member_access_expr): Change context
lookup
to handle anon union members.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/member4.C: Remove expected error.
* g++.dg/reflect/anon4.C: New test based on original bug report.
Signed-off-by: Valentyn Yukhymenko <valentin.yukhymenko@gmail.com>
More information about the Gcc-bugs
mailing list