public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/94489] ICE: unexpected expression ‘std::min’ of kind overload
Date: Mon, 06 Apr 2020 23:50:30 +0000	[thread overview]
Message-ID: <bug-94489-4-qYggnra6b5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94489-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #2)
> Doesn't seem like valid code; clang++ trunk also rejects it:
> 94489.C:28:61: error: no matching constructor for initialization of
> 'std::plus<void>'
> 
> I think the fix should be
> 
> --- a/gcc/cp/pt.c
> +++ b/gcc/cp/pt.c
> @@ -3748,6 +3748,7 @@ expand_integer_pack (tree call, tree args,
> tsubst_flags_t complain,
>      }
>    else
>      {
> +      hi = instantiate_non_dependent_expr_sfinae (hi, complain);
>        hi = cxx_constant_value (hi);
>        int len = valid_constant_size_p (hi) ? tree_to_shwi (hi) : -1;
>  
> 
> but it'd be nice to have a reduced version.

This is not a complete fix because this one ICEs even with that:

template <typename, int...> struct b;
template <typename T, T... d> using e = b<T, __integer_pack(d)...>;
template <unsigned d> using f = e<unsigned, d>;
template <typename T> constexpr long g(T) { return 1l; }
struct array { };
template <typename> constexpr unsigned h{};
template<typename T, long dim = g(h<T>), class X = decltype(f<dim>{})> struct k
{ int n; };

template<typename T, typename U>
auto m(T t, U)
{
  [t] <unsigned> () {
      m(array{}, array{});
      return k<T, 1>::n;
  };
}

  parent reply	other threads:[~2020-04-06 23:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-05  1:50 [Bug c++/94489] New: " bisqwit at iki dot fi
2020-04-06  6:39 ` [Bug c++/94489] " marxin at gcc dot gnu.org
2020-04-06 20:30 ` mpolacek at gcc dot gnu.org
2020-04-06 23:19 ` mpolacek at gcc dot gnu.org
2020-04-06 23:50 ` mpolacek at gcc dot gnu.org [this message]
2024-02-19 15:44 ` ppalka 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-94489-4-qYggnra6b5@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).