https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126867
Bug ID: 126867
Summary: ICE after failed static_assert using
__has_unique_object_representations in a concept
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: s.kimura.h41104 at gmail dot com
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/9Pr8Wv41b
Reproducer:
```
struct S {};
template <class T>
concept U = __has_unique_object_representations(T);
static_assert(U<S>);
```
Backtrace:
<source>:5:15: error: static assertion failed
5 | static_assert(U<S>);
| ^~~~
• constraints not satisfied
• required by the constraints of 'template<class T> concept U'
<source>:3:9:
3 | concept U = __has_unique_object_representations(T);
| ^
• the expression '__has_unique_object_representations(T) [with T = S]'
evaluated to 'false'
<source>:3:13:
3 | concept U = __has_unique_object_representations(T);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
• 'S' does not have unique object representations, because
<source>:1:8:
1 | struct S {};
| ^
• internal compiler error: tree check: expected tree that contains 'decl
minimal' structure, have 'record_type' in
record_has_unique_obj_representations, at cp/tree.cc:5277
<source>:3:13:
3 | concept U = __has_unique_object_representations(T);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x2bb9ec8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2baeb0b internal_error(char const*, ...)
???:0
0xa3dd5b tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
???:0
0xe6d347 type_has_unique_obj_representations(tree_node const*, bool)
???:0
0xbd36a6 diagnose_trait_expr(unsigned long, tree_node*, tree_node*)
???:0
0xbda7f8 diagnose_constraints(unsigned long, tree_node*, tree_node*)
???:0
0xbcc445 diagnose_failing_condition(tree_node*, unsigned long, bool,
constexpr_ctx const*)
???:0
0xe47941 finish_static_assert(tree_node*, tree_node*, unsigned long, bool,
bool, bool)
???:0
0xd9a313 c_parse_file()
???:0
0xf2d8a9 c_common_parse_file()
???:0
This ICE goes back to gcc-16:
https://godbolt.org/z/xac3a4vhj