public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dangelog at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/102396] New: ICE when using concepts, in get, at cp/constraint.cc:2637
Date: Sat, 18 Sep 2021 08:02:43 +0000	[thread overview]
Message-ID: <bug-102396-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 102396
           Summary: ICE when using concepts, in get, at
                    cp/constraint.cc:2637
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dangelog at gmail dot com
  Target Milestone: ---

Hello,

This testcase (which gets accepted by Clang and MSVC) causes an ICE under
GCC-12-trunk, and an erroneous compilation error on GCC 11.2.


#include <memory>
#include <span>
#include <ranges>
#include <concepts>

template <typename T> struct S;

template <typename C> constexpr bool is_S = false;
template <typename T> constexpr bool is_S<S<T>> = true;

template <typename T>
struct S {
    T data;

    S();
    explicit S(const T &);

    template <typename U,
              std::enable_if_t<!is_S<U>, bool> = false>
    requires std::equality_comparable_with<T, U>
    friend bool operator==(const S &s, const U &u) { return s.data == u; }
};

template <typename T>
bool operator==(const S<T> &a, const S<T> &b) { return a.data == b.data; }


int main() {
    using SD = S<double>;

    char data[sizeof(SD) * 10];
    std::span<SD> span((SD*)std::begin(data), (SD*)std::end(data));

    //static_assert(std::equality_comparable<std::span<SD>::iterator>);

    std::ranges::uninitialized_default_construct(span);
}



The error:



/opt/compiler-explorer/gcc-trunk-20210918/include/c++/12.0.0/concepts:280:17:
internal compiler error: in get, at cp/constraint.cc:2637
  280 |           { __t == __u } -> __boolean_testable;
      |             ~~~~^~~~~~
0x1fc77b9 internal_error(char const*, ...)
        ???:0
0x713d19 fancy_abort(char const*, int, char const*)
        ???:0
0x7970af satisfaction_cache::get()
        ???:0
0x79cd8a constraints_satisfied_p(tree_node*, tree_node*)
        ???:0
0x9ba323 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ???:0
0x73f150 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node**, int)
        ???:0
0xa2fc50 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node**, int)
        ???:0
0x79cd42 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x79cd8a constraints_satisfied_p(tree_node*, tree_node*)
        ???:0
0x9ba323 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ???:0
0x73f150 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node**, int)
        ???:0
0xa2fc50 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node**, int)
        ???:0
0x9816d7 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x9c3e1b instantiate_pending_templates(int)
        ???:0
0x82a899 c_parse_final_cleanups()
        ???:0

             reply	other threads:[~2021-09-18  8:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-18  8:02 dangelog at gmail dot com [this message]
2021-09-27 12:51 ` [Bug c++/102396] [11/12 Regression] ICE when using concepts, in get, at cp/constraint.cc:2637 since r11-6245-g79f57d5cb070bb02 marxin at gcc dot gnu.org
2021-11-05 13:23 ` rguenth at gcc dot gnu.org
2021-11-05 14:01 ` ppalka at gcc dot gnu.org
2021-12-09 18:52 ` dangelog at gmail dot com
2021-12-09 18:54 ` dangelog at gmail dot com
2021-12-11 16:13 ` ppalka at gcc dot gnu.org
2021-12-13 16:58 ` dangelog at gmail dot com

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-102396-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).