public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/105244] [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114
Date: Tue, 19 Apr 2022 13:08:45 +0000	[thread overview]
Message-ID: <bug-105244-4-2TG0fuIWDr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105244-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
template <class T>
struct S
{
  static T max ();
};

template <class A = double>
struct V
{
  double a = S<double>::max[0] ();
};

template <class T>
V<>
foo ()
{
  return {};
}

int
main ()
{
  V<> b = foo<double> ();
}

What happens is that synthesized_method_walk with diag = false calls get_nsdmi
with tf_none, and much deeper there is pointer_int_sum which has:
      if (complain && warn_pointer_arith)
        pedwarn (loc, OPT_Wpointer_arith,
                 "pointer to a function used in arithmetic");
      else if (!complain)
        return error_mark_node;
So, if get_nsdmi were called with tf_warning_or_error, we'd pedwarn on it, but
we are quite and just return error_mark_node from get_nsdmi in that case.
So, we end up with raises = error_mark_node and enter:
          /* Can happen, e.g., in C++98 mode for an ill-formed non-static data
             member initializer (c++/89914).  Also, in C++98, we might have
             failed to deduce RAISES, so try again but complain this time.  */
          if (cxx_dialect < cxx11)
            synthesized_method_walk (type, kind, const_p, &raises, nullptr,
                                     nullptr, nullptr, /*diag=*/true,
                                     &inherited_ctor, inherited_parms);
          /* We should have seen an error at this point.  */
          gcc_assert (seen_error ());
and ICE, because at this point whether we pedwarn or not depends on
-Wpointer-arith, and even if not, pedwarn can warn rather than error etc.

Not really sure what to do here, if it is intentional that with tf_none we are
stricter and fail even on things we could just warn or pedwarn without
-pedantic-errors.

  parent reply	other threads:[~2022-04-19 13:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 17:24 [Bug c++/105244] New: " gscfq@t-online.de
2022-04-12 17:41 ` [Bug c++/105244] " mpolacek at gcc dot gnu.org
2022-04-19 13:08 ` jakub at gcc dot gnu.org [this message]
2022-05-27  9:48 ` [Bug c++/105244] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:49 ` jakub at gcc dot gnu.org
2023-07-07 10:43 ` [Bug c++/105244] [11/12/13/14 " 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-105244-4-2TG0fuIWDr@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).