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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

$ cat pr93275.ii
template <int __v> struct A { static constexpr int value = __v; };
template <bool, typename> struct B;
template <typename _Tp> struct B<true, _Tp> { typedef _Tp type; };
template <bool _Cond, typename _Tp>
using enable_if_t = typename B<_Cond, _Tp>::type;
template <typename> constexpr bool array_depth_v = A<1>::value;
template <typename T, int> struct C {
  template <typename Other,
            enable_if_t<array_depth_v<C>, decltype(nullptr)> = nullptr>
  void operator*(Other other) {
    [other](T t) { t *other; };
  }
};

int
main() {
  C<C<float, 4>, 1> a0;
  a0 * 4.f;
  return 0;
}

$ g++ -c pr93275.ii -std=c++17
pr93275.ii: In substitution of ‘template<class T, int <anonymous> >
template<class Other, typename B<array_depth_v<C<T, <anonymous> > >,
std::nullptr_t>::type <anonymous> > void C<T, <anonymous> >::operator*(Other)
[with Other = <missing>; typename B<array_depth_v<C<T, <anonymous> > >,
std::nullptr_t>::type <anonymous> = <missing>; T = float; int <anonymous> =
<missing>]’:
pr93275.ii:11:22:   required from ‘void C<T, <anonymous> >::operator*(Other)
[with Other = float; typename B<array_depth_v<C<T, <anonymous> > >,
std::nullptr_t>::type <anonymous> = nullptr; T = C<float, 4>; int <anonymous> =
1]’
pr93275.ii:18:8:   required from here
pr93275.ii:9:25: internal compiler error: unexpected expression ‘<anonymous>’
of kind template_parm_index
    9 |             enable_if_t<array_depth_v<C>, decltype(nullptr)> = nullptr>
      |                         ^~~~~~~~~~~~~~~~
0x961234 cxx_eval_constant_expression
        /home/marxin/Programming/gcc/gcc/cp/constexpr.c:6125
0x96174e cxx_eval_outermost_constant_expr
        /home/marxin/Programming/gcc/gcc/cp/constexpr.c:6323
0x9660a4 maybe_constant_value(tree_node*, tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/cp/constexpr.c:6593
0xa96124 convert_nontype_argument
        /home/marxin/Programming/gcc/gcc/cp/pt.c:7116
0xa96124 convert_template_argument
        /home/marxin/Programming/gcc/gcc/cp/pt.c:8350
0xa96124 convert_template_argument
        /home/marxin/Programming/gcc/gcc/cp/pt.c:8087
0xa9796b coerce_template_parms
        /home/marxin/Programming/gcc/gcc/cp/pt.c:8829
0xabce39 lookup_template_class_1
        /home/marxin/Programming/gcc/gcc/cp/pt.c:9666
0xabce39 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:10038
0xab88cf tsubst_aggr_type
        /home/marxin/Programming/gcc/gcc/cp/pt.c:13332
0xab0d3f tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:15033
0xab856b tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:13125
0xaab074 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:18999
0xa9f3b7 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:18590
0xab2c53 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:12047
0xab2c53 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:12058
0xab2c53 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:12046
0xab856b tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:13125
0xab88aa tsubst_aggr_type
        /home/marxin/Programming/gcc/gcc/cp/pt.c:13326
0xab08f5 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:15662
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to