https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127959

            Bug ID: 127959
           Summary: internal compiler error: tree check: expected
                    record_type or union_type or qual_union_type, have
                    typename_type in lookup_base, at cp/search.cc
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 0599jiangyc at gmail dot com
  Target Milestone: ---

The following code:
```cpp
template<typename T> typename T::X v1;
struct A { constexpr A(int) { } };
template<A> struct B { };
B<v1> *p;
```

Output:
```
<source>:4:5: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have typename_type in lookup_base, at
cp/search.cc:265
    4 | B<v1> *p;
      |     ^
0x2c5d178 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2c51dbb internal_error(char const*, ...)
        ???:0
0xa4d330 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xe43d43 coerce_template_parms(tree_node*, tree_node*, tree_node*, int, bool)
        ???:0
0xe2f5ba lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int)
        ???:0
0xe9a33c finish_template_type(tree_node*, tree_node*, int)
        ???:0
0xdf7823 c_parse_file()
        ???:0
0xf8b949 c_common_parse_file()
        ???:0
/cefs/81/8173abd0586c295ccb0046dd_gcc-trunk-20261016/bin/../libexec/gcc/x86_64-linux-gnu/17.0.0/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/81/8173abd0586c295ccb0046dd_gcc-trunk-20261016/bin/../lib/gcc/x86_64-linux-gnu/17.0.0/
-D_GNU_SOURCE <source> -quiet -dumpdir /app/output.s- -dumpbase example.cpp
-dumpbase-ext .cpp -mtune=generic -march=x86-64 -g -fdiagnostics-color=always
-fno-verbose-asm -fsyntax-only -o /dev/null
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
x86-64 gcc (trunk) - 1304ms

```

Trunk: https://godbolt.org/z/dWv9EGo3T

Reply via email to