From: Jason Merrill Date: Tue, 21 Mar 2023 15:12:42 +0000 (-0400) Subject: c++: less invalidate_class_lookup_cache X-Git-Tag: basepoints/gcc-15~9728 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9861511a1fa0f9e386f3f7bcee84b6e3ca3c579;p=thirdparty%2Fgcc.git c++: less invalidate_class_lookup_cache In the testcase below, we push_to_top_level to instantiate f and g, and they can both use the previous_class_level cache from instantiating A. Wiping the cache in pop_from_top_level is not helpful; we'll do that in pushclass if needed. template struct A { int i; void f() { i = 42; } void g() { i = 24; } }; int main() { A a; a.f(); a.g(); } gcc/cp/ChangeLog: * name-lookup.cc (pop_from_top_level): Don't invalidate_class_lookup_cache. --- diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index 7c61bc3bf611..8fd5733c1e24 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -8205,9 +8205,6 @@ pop_from_top_level (void) auto_cond_timevar tv (TV_NAME_LOOKUP); - /* Clear out class-level bindings cache. */ - if (previous_class_level) - invalidate_class_lookup_cache (); pop_class_stack (); release_tree_vector (current_lang_base);