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

            Bug ID: 91706
           Summary: [8/9/10 Regression] ICE: tree check: expected class
                    'type', have 'exceptional' (error_mark) in
                    equate_type_number_to_die, at dwarf2out.c:5782
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: szotsaki at gmail dot com
  Target Milestone: ---

The following test case causes internal compiler error:

#include <type_traits>
#include <vector>

struct A {
  template <typename>
  static std::false_type fn(...);
};

template <class T>
struct B : public A  {
  using fn = decltype(fn<T>(0));
  using type = typename std::conditional<fn::value, std::true_type,
std::false_type>::type;
};

int main(){
  static_assert(B<std::vector<int>>::type::value, "assertion failed");
}

If you change either of them, the bug will go away:
- Move A::fn() out of its structure thus make "B : public A" inheritance
unnecessary
- Rename B::fn to something else, like B::fn_alias.

The issue first appeared in 8.1 (7.4 is fine) and still occurs with 10.0.0
20190908.

Error messages:

GCC 10.0:
internal compiler error: tree check: expected class 'type', have 'exceptional'
(error_mark) in equate_type_number_to_die, at dwarf2out.c:5782

9.2 - 8.1:
internal compiler error: in is_base_type, at dwarf2out.c:12987

Related issue: Bug 87772 (though I don't know whether the path is the same
which led to a similar ICE message).

Reply via email to