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++/110197] [13/14 Regression] Empty constexpr object constructor erronously claims out of range access
Date: Tue, 18 Jul 2023 18:15:37 +0000	[thread overview]
Message-ID: <bug-110197-4-BhjeqowfGB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110197-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
// PR c++/110197

namespace std {
constexpr bool __is_constant_evaluated() {
  return __builtin_is_constant_evaluated();
}
template <bool, typename _Tp> using enable_if_t = _Tp;
template <typename _Tp, int _Nm> struct __array_traits {
  typedef _Tp _Type[_Nm];
};
template <typename _Tp, int _Nm> struct array {
  typename __array_traits<_Tp, _Nm>::_Type _M_elems;
};
template <typename _Tp> array(_Tp) -> array<enable_if_t<0, _Tp>, 1>;
struct char_traits {
  static constexpr unsigned length() {
    __is_constant_evaluated();
    return 0;
  }
};
struct basic_string_view {
  using traits_type = char_traits;
  constexpr basic_string_view(const char *)
      : _M_len{traits_type::length()}, _M_str{} {}
  long _M_len;
  char _M_str;
};
} // namespace std
struct Currency {
  constexpr Currency(std::basic_string_view) {}
};
void get_c() { constexpr std::array c{Currency{""}}; }

  parent reply	other threads:[~2023-07-18 18:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 18:29 [Bug c++/110197] New: " matt at godbolt dot org
2023-06-09 18:37 ` [Bug c++/110197] [13/14 Regression] " mpolacek at gcc dot gnu.org
2023-06-09 18:40 ` mpolacek at gcc dot gnu.org
2023-07-18 18:15 ` mpolacek at gcc dot gnu.org [this message]
2023-07-19 15:14 ` ppalka at gcc dot gnu.org
2023-07-20 16:51 ` ppalka at gcc dot gnu.org
2023-07-27  9:26 ` rguenth at gcc dot gnu.org
2023-07-27 13:10 ` cvs-commit at gcc dot gnu.org
2023-07-27 13:11 ` [Bug c++/110197] [13 " ppalka at gcc dot gnu.org
2023-07-27 13:27 ` matt at godbolt dot org
2023-08-07 23:27 ` cvs-commit at gcc dot gnu.org
2023-08-21 14:04 ` ppalka at gcc dot gnu.org
2023-08-21 14:09 ` matt at godbolt dot 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-110197-4-BhjeqowfGB@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).