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

            Bug ID: 117462
           Summary: internal compiler error: comptypes(tree_node*,
                    tree_node*, int)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yihan4845 at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/MrdYMGq6G

The following program:
```cpp
struct A {};
struct Nested { union { int k; int arr[2]; }; };
struct Derived2 : A, Nested { virtual void g(); };
struct D4 { void (Derived2::*p)(); };
template <D4> struct S1 { static void fn() {} };
template void S1<D4{&Derived2::g}>::fn();
```

will trigger segmentation fault for gcc trunk.

Stack dump:
```
0x28849d5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x289b3c5 internal_error(char const*, ...)
        ???:0
0xd5f47f comptypes(tree_node*, tree_node*, int)
        ???:0
0xbd70d6 mangle_decl(tree_node*)
        ???:0
0x1748a85 decl_assembler_name(tree_node*)
        ???:0
0xece0c1 symbol_table::finalize_compilation_unit()
        ???:0
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.
Compiler returned: 1
```

Reply via email to