aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-tree.h
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2023-03-29 23:27:38 -0400
committerJason Merrill <jason@redhat.com>2023-03-30 18:25:58 -0400
commit58df5350753c00f140c86e60ba5ce0cac686ec4b (patch)
treeb8daec4b5229dd4df17937a52382b8eab4abd06e /gcc/cp/cp-tree.h
parent85131af0603c0af2aa6b40de6cc929905f22bd50 (diff)
downloadgcc-58df5350753c00f140c86e60ba5ce0cac686ec4b.zip
gcc-58df5350753c00f140c86e60ba5ce0cac686ec4b.tar.gz
gcc-58df5350753c00f140c86e60ba5ce0cac686ec4b.tar.bz2
c++: anonymous union member reference [PR105452]
While parsing the anonymous union, we don't yet know that it's an anonymous union, so we build the reference to 'v' in the static_assert relative to the union type. But at instantiation time we know it's an anonymous union, so we need to avoid trying to check access for 'v' in the union again; the simplest approach seemed to be to make accessible_p step out to the containing class. While looking at this I also noticed that we were having trouble with DMI in an anonymous union referring to members of the containing class; there we just need to give current_class_ptr the right type. PR c++/105452 gcc/cp/ChangeLog: * search.cc (type_context_for_name_lookup): New. (accessible_p): Handle anonymous union. * init.cc (maybe_instantiate_nsdmi_init): Use type_context_for_name_lookup. * parser.cc (cp_parser_class_specifier): Likewise. * cp-tree.h (type_context_for_name_lookup): Declare. gcc/testsuite/ChangeLog: * g++.dg/lookup/anon8.C: New test.
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r--gcc/cp/cp-tree.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 0e37d40..d450b3d 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -7534,6 +7534,7 @@ extern int at_function_scope_p (void);
extern bool at_class_scope_p (void);
extern bool at_namespace_scope_p (void);
extern tree context_for_name_lookup (tree);
+extern tree type_context_for_name_lookup (tree);
extern tree lookup_conversions (tree);
extern tree binfo_from_vbase (tree);
extern tree binfo_for_vbase (tree, tree);