https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126867
--- 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:318e6a4640420d5cc213df779bf751485fa56063 commit r17-3386-g318e6a4640420d5cc213df779bf751485fa56063 Author: Jakub Jelinek <[email protected]> Date: Tue Aug 18 20:15:45 2026 +0200 c++: Fix ICE during explanation of failed __has_unique_object_representation [PR126867] The following testcase ICEs since r16-5520 added explain arguments to type_has_unique_obj_representations and record_has_unique_obj_representations. Most of the location_t arguments in that change look correct, either DECL_SOURCE_LOCATION of some FIELD_DECL or in type_has_unique_obj_representations use loc, which is initialized to location_t loc = input_location; if (tree m = TYPE_MAIN_DECL (t)) loc = DECL_SOURCE_LOCATION (m); But in record_has_unique_obj_representations we don't have a variable like that and t at that point is the RECORD_TYPE or UNION_TYPE, so using DECL_SOURCE_LOCATION on it will surely ICE in a checking compiler. location_of call does the above dances, so it seems easiest to call it rather than duplicate it by hand. 2026-08-18 Jakub Jelinek <[email protected]> PR c++/126867 * tree.cc (record_has_unique_obj_representations): Use location_of (const_cast <tree> (t)) rather than DECL_SOURCE_LOCATION (t). * g++.dg/cpp1z/has-unique-obj-representations6.C: New test. Reviewed-by: Jason Merrill <[email protected]>
