https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93001
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> --- I think the problem is in dfs_accessible_post: 757 tree scope = current_nonlambda_scope (); will for this line: enum class S::E : S::T { X }; give "::" so dfs_accessible_post returns NULL_TREE. But if it were a function, its scope would be "S".