https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127255
Bug ID: 127255
Summary: ICE on contracts and aliased source_location
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ivan.lazaric.gcc at gmail dot com
Target Milestone: ---
```cpp
namespace std {
using source_location = int;
}
void foo() pre(true) {} // ICE
```
```
test3.cpp: In function 'void foo()':
test3.cpp:5:23: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have integer_type in
get_contracts_source_location_impl_type, at cp/contracts.cc:2695
5 | void foo() pre(true) {}
| ^
0x2b25cdb internal_error(char const*, ...)
gcc/diagnostic-global-context.cc:787
0x9e272c tree_check_failed(tree_node const*, char const*, int, char const*,
...)
gcc/tree.cc:9241
0x7ce097 tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
gcc/tree.h:3871
0x7ce097 get_contracts_source_location_impl_type
gcc/cp/contracts.cc:2695
0x7ce097 get_src_loc_impl_ptr
gcc/cp/contracts.cc:2750
0x7ce097 build_contract_violation_ctor
gcc/cp/contracts.cc:2806
0x7ce097 build_contract_check(tree_node*)
gcc/cp/contracts.cc:2987
0xb95497 cp_genericize_r
gcc/cp/cp-gimplify.cc:2212
0x18fe800 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
gcc/tree.cc:11864
0xb94789 cp_genericize_tree
gcc/cp/cp-gimplify.cc:2659
0xb94b2e cp_genericize(tree_node*)
gcc/cp/cp-gimplify.cc:2801
0xbef557 finish_function(bool)
gcc/cp/decl.cc:20978
0xcfa5d1 cp_parser_function_definition_after_declarator
gcc/cp/parser.cc:36383
0xd2c921 cp_parser_function_definition_from_specifiers_and_declarator
gcc/cp/parser.cc:36295
0xd2c921 cp_parser_init_declarator
gcc/cp/parser.cc:26206
0xd2df87 cp_parser_simple_declaration
gcc/cp/parser.cc:18223
0xd3c3af cp_parser_declaration
gcc/cp/parser.cc:17760
0xd3ee6b cp_parser_toplevel_declaration
gcc/cp/parser.cc:17864
0xd3ee6b cp_parser_translation_unit
gcc/cp/parser.cc:5599
0xd3ee6b c_parse_file()
gcc/cp/parser.cc:57926
```
Flags: "-std=c++26 -fcontracts"
Godbolt: https://godbolt.org/z/44Wef6qzb