public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sphink at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/97419] crash in decl_as_string(TFF_DECL_SPECIFIERS | TFF_CHASE_TYPEDEF) from plugin using std::declval()
Date: Fri, 16 Oct 2020 15:21:48 +0000	[thread overview]
Message-ID: <bug-97419-4-Duprbhbm7N@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97419-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Steve Fink <sphink at gmail dot com> ---
I can workaround the bug by avoiding declval:

-   using Iter = decltype(std::declval<const Container>().begin());
-   using Elem = decltype(*std::declval<Iter>());
+   using Iter = decltype(static_cast<const Container*>(nullptr)->begin());
+   using Elem = decltype(*static_cast<const Container*>(nullptr)->begin());

fixes it in my original code. In the minimized testcase, it would be the more
pedestrian

-   using Iter = typename Container::ValueType*;
-   using Elem = decltype(*std::declval<Iter>());
+   using Iter = typename Container::ValueType*;
+   using Elem = typename Container::ValueType;

      parent reply	other threads:[~2020-10-16 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 13:46 [Bug c++/97419] New: " sphink at gmail dot com
2020-10-14 13:48 ` [Bug c++/97419] " sphink at gmail dot com
2020-10-14 13:49 ` sphink at gmail dot com
2020-10-14 14:07 ` sphink at gmail dot com
2020-10-14 14:08 ` sphink at gmail dot com
2020-10-14 14:11 ` sphink at gmail dot com
2020-10-15 18:37 ` sphink at gmail dot com
2020-10-16 15:21 ` sphink at gmail dot com [this message]

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-97419-4-Duprbhbm7N@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).