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

            Bug ID: 125971
           Summary: ICE when CTAD occurs before member variable template
                    partial specialization with dependent type
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: attackerj1113 at gmail dot com
  Target Milestone: ---

The following code causes ICE out on x86-64 gcc since version 11.1(with
-std=c++17 since 8.4) and reproducible on trunk, while Clang/EDG accepted the
code:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
template<class T>
struct A {
  A(T) {}

  template<class, class = void>
  static constexpr int v = 0;
};

A(int) -> A<int>;

A a(0);// CTAD before specialization

template<class T>
template<class U>
constexpr int A<T>::v<U, typename U::type> = 1;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
https://godbolt.org/z/vcEbsqWdq


GCC crashes if class template argument deduction (CTAD) is performed before a
member variable template partial specialization involving a dependent type
(typename U::type) is declared. Reordering the specialization before CTAD
avoids the crash.
  • [Bug c++/125971] New: ICE when... attackerj1113 at gmail dot com via Gcc-bugs

Reply via email to