public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "lewissbaker.opensource at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/101247] New: ICE when using static constexpr bool defined in base-class in derived class constructor requires-clause
Date: Tue, 29 Jun 2021 01:15:14 +0000	[thread overview]
Message-ID: <bug-101247-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 101247
           Summary: ICE when using static constexpr bool defined in
                    base-class in derived class constructor
                    requires-clause
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lewissbaker.opensource at gmail dot com
  Target Milestone: ---

Compiling the following code with GCC trunk and flags: -std=c++20

```
template<typename T>
struct in_place_type_t {};

template<typename T>
inline constexpr in_place_type_t<T> in_place_type;

template<typename T, typename... Ts>
inline constexpr bool outer_helper_v = true;

template<typename... Ts>
struct foo {
    struct type;

    template<typename U>
    static constexpr bool helper_v = outer_helper_v<U, Ts...>;
};

template<typename... Ts>
struct foo<Ts...>::type {
    template<typename U>
        requires helper_v<U>
    type(in_place_type_t<U>) {}
};

int main() {
    foo<int>::type x(in_place_type<int>);
}
```

results in an internal compiler-error

```
<source>: In substitution of 'template<class U>  requires  helper_v<U>
foo<int>::type::type(in_place_type_t<T>) [with U = {int}]':
<source>:26:40:   required from here
<source>:21:18: internal compiler error: tree check: accessed elt 1 of
'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:13084
   21 |         requires helper_v<U>
      |                  ^~~~~~~~~~~
0x1d4c179 internal_error(char const*, ...)
        ???:0
0x685746 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
        ???:0
0x99e0bc tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x9afa62 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x9b064b tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x9afa04 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x983ebd tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7abcda constraints_satisfied_p(tree_node*, tree_node*)
        ???:0
0x9c26c3 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ???:0
0x74abc9 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ???:0
0x74c8c0 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        ???:0
0x8611c8 build_aggr_init(tree_node*, tree_node*, int, int)
        ???:0
0x81f0d9 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ???:0
0x94f36d c_parse_file()
        ???:0
0xad2922 c_common_parse_file()
        ???:0
```

See https://godbolt.org/z/ebnxfsMs9 for an example.

             reply	other threads:[~2021-06-29  1:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  1:15 lewissbaker.opensource at gmail dot com [this message]
2021-06-29  8:11 ` [Bug c++/101247] " marxin at gcc dot gnu.org
2021-06-30 18:16 ` [Bug c++/101247] ICE when using static constexpr bool defined in parent-class in nested " ppalka at gcc dot gnu.org
2021-07-02 17:55 ` cvs-commit at gcc dot gnu.org
2021-07-09 14:22 ` cvs-commit at gcc dot gnu.org
2021-07-13 14:03 ` cvs-commit at gcc dot gnu.org
2021-07-13 14:03 ` cvs-commit at gcc dot gnu.org
2021-07-13 14:09 ` 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-101247-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).