https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123684
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:7d30e58e45c7fe0ccd22305567f0100176cc1294 commit r16-7011-g7d30e58e45c7fe0ccd22305567f0100176cc1294 Author: Jakub Jelinek <[email protected]> Date: Sat Jan 24 09:56:23 2026 +0100 c++: Fix ICE on namespace attributes [PR123684] The following testcase ICEs sionce my r14-650 PR109756 change to set TREE_VALUE (attr) to error_mark_node for unsupported attributes for which we've just skipped over balanced tokens for arguments in order to differentiate that from no arguments. The problem is that handle_namespace_attrs doesn't go through the normal attribute handling and just checked attributes by name. So, if user uses [[visibility (whatever)]] or [[whatever::visibility (whatever)]] or similarly abi_tag or for deprecated (which is valid as both [[deprecated ("foo")]] and [[gnu::deprecated ("foo")]] ) [[whatever::deprecated (whatever)]] on a namespace, we handle it as if it was a gnu or gnu or standard attribute even when it is not and can ICE on error_mark_node attributes. The following patch makes sure we handle it only in the right namespaces and emit a warning on anything else. Not sure about backports, the patch changes behavior for say inline namespace [[foo::abi_tag]] N or inline namespace [[abi_tag]] N where previously it would use the name of the namespace as abi tag and now it will ignore it and emit a warning. One possibility is to just deal with args == error_mark_node and warn on that attribute only in that case (that is where it would previously ICE). But perhaps I'm worrying too much and no code in the wild is relying on non-gnu attributes on namespaces with the same names as the gnu ones behaving like the gnu ones. 2026-01-24 Jakub Jelinek <[email protected]> PR c++/123684 * name-lookup.cc (handle_namespace_attrs): Only handle visibility and abi_tag attributes in the gnu namespace and deprecated attribute in the standard or gnu namespaces. * g++.dg/cpp0x/gen-attrs-90.C: New test.
