public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "chfast at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/105481] New: ICE: unexpected expression of kind template_parm_index
Date: Wed, 04 May 2022 14:48:42 +0000	[thread overview]
Message-ID: <bug-105481-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105481
           Summary: ICE: unexpected expression of kind template_parm_index
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chfast at gmail dot com
  Target Milestone: ---

I get 

intx_reduced.cpp: In substitution of ‘template<unsigned int N, class T, class>
uint<N> f(const T&) [with unsigned int N = N; T = uint<N>;
<template-parameter-1-3> = <missing>]’:
intx_reduced.cpp:18:31:   required from here
intx_reduced.cpp:13:5: internal compiler error: unexpected expression ‘N’ of
kind template_parm_index
   13 |     typename = typename std::enable_if<std::is_convertible<T,
uint<N>>::value>::type>
      |     ^~~~~~~~


for code:

#include <type_traits>

template <unsigned N>
struct uint
{
   int words_[N];
};

template <unsigned N>
uint<N> f(const uint<N>& y) noexcept;

template <unsigned N, typename T,
    typename = typename std::enable_if<std::is_convertible<T,
uint<N>>::value>::type>
uint<N> f(const T& y) noexcept;

using X = uint<1>;

X (*fp)(X const&) noexcept = &f;


The reduced version (cvise):

template <typename _Tp, _Tp __v> struct integral_constant {
  static constexpr _Tp value = __v;
};
using true_type = integral_constant<bool, true>;
using false_type = integral_constant<bool, false>;
template <bool __v> using __bool_constant = integral_constant<bool, __v>;
template <bool, typename, typename> struct conditional;
template <typename...> struct __or_;
template <typename _B1, typename _B2>
struct __or_<_B1, _B2> : conditional<_B1::value, _B1, _B2>::type {};
template <typename> struct is_const;
template <typename> struct is_array : false_type {};
template <typename _Tp>
struct is_function : __bool_constant<!is_const<_Tp>::value> {};
template <typename> struct is_const : true_type {};
template <typename, typename _To,
          bool = __or_<is_function<_To>, is_array<_To>>::value>
struct __is_convertible_helper {
  template <typename> static true_type __test(int);
  typedef decltype(__test<_To>(0)) type;
};
template <typename _From, typename _To>
struct is_convertible : __is_convertible_helper<_From, _To>::type {};
template <bool, typename _Tp = void> struct enable_if { typedef _Tp type; };
template <typename _Iftrue, typename _Iffalse>
struct conditional<false, _Iftrue, _Iffalse> {
  typedef _Iffalse type;
};
template <unsigned> struct uint;
template <unsigned N> uint<N> f(const uint<N> &);
template <
    unsigned N, typename T,
    typename = typename enable_if<is_convertible<T, uint<N>>::value>::type>
uint<N> f(T);
using X = uint<1>;
X (*fp)(X const &) = f;

             reply	other threads:[~2022-05-04 14:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 14:48 chfast at gmail dot com [this message]
2022-05-04 14:57 ` [Bug c++/105481] [9/10/11/12/13 Regression] " mpolacek at gcc dot gnu.org
2022-05-04 15:03 ` mpolacek at gcc dot gnu.org
2022-05-05 11:57 ` ppalka at gcc dot gnu.org
2022-05-05 12:29 ` ppalka at gcc dot gnu.org
2022-05-05 12:32 ` ppalka at gcc dot gnu.org
2022-05-27  9:48 ` [Bug c++/105481] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:49 ` jakub at gcc dot gnu.org
2023-03-23 21:50 ` jason at gcc dot gnu.org
2023-03-24 16:32 ` cvs-commit at gcc dot gnu.org
2023-04-18 20:46 ` [Bug c++/105481] [10/11/12 " cvs-commit at gcc dot gnu.org
2023-07-07 10:43 ` [Bug c++/105481] [11 " rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105481-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).