public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108059] New: internal compiler error: in tsubst_copy, at cp/pt.c:16425
@ 2022-12-11 13:32 lh_mouse at 126 dot com
  2022-12-11 13:34 ` [Bug c++/108059] " lh_mouse at 126 dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: lh_mouse at 126 dot com @ 2022-12-11 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108059
           Summary: internal compiler error: in tsubst_copy, at
                    cp/pt.c:16425
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lh_mouse at 126 dot com
  Target Milestone: ---

This was reported on IRC by Vladimir_Kozelko:


https://godbolt.org/z/oMjTc1813

```
#include <utility>

struct unused {
    template <typename T>
    constexpr unused(T&&) noexcept {}
};

template <int>
using ignore_index_t = unused;

template <int index, typename... Tp>
constexpr inline auto pack_element(Tp&&... arr) noexcept {
    auto unpack = [&](auto... v){
        auto impl = [](ignore_index_t<v>..., auto&& out, auto&&) {
            return out;
        };
    };
}

template <int index, typename... Tp>
using pack_element_t = decltype(pack_element<index>(std::declval<Tp>()...));

void f1() { using H = pack_element_t<1, int, int&>; }

//idea (and it works):

auto test = [](auto v){
    constexpr auto vv = v;
};

void f2() { test(std::integral_constant<int, 0>()); }
```

which ICEs:

```
<source>: In instantiation of 'constexpr auto pack_element(Tp&& ...) [with int
index = 1; Tp = {int, int&}]':
<source>:21:52:   required by substitution of 'template<int index, class ...
Tp> using pack_element_t = decltype (pack_element<index>((declval<Tp>)()...))
[with int index = 1; Tp = {int, int&}]'
<source>:23:50:   required from here
<source>:14:21: internal compiler error: in tsubst_copy, at cp/pt.cc:16949
   14 |         auto impl = [](ignore_index_t<v>..., auto&& out, auto&&) {
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   15 |             return out;
      |             ~~~~~~~~~~~
   16 |         };
      |         ~            
0x1bb069e internal_error(char const*, ...)
        ???:0
0x6ff396 fancy_abort(char const*, int, char const*)
        ???:0
0x88d46f tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x87aa08 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x87a50a tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x887353 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x87a817 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x89084a tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x890a58 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x87d4f7 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x7a1e03 maybe_instantiate_decl(tree_node*)
        ???:0
0x72588e build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0x8aaf0c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0x87abbd tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x87b097 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x891f4a instantiate_template(tree_node*, tree_node*, int)
        ???:0
0x87a682 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x88495f lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ???:0
0x8aa461 finish_template_type(tree_node*, tree_node*, int)
        ???:0
0x861eaa c_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/108059] internal compiler error: in tsubst_copy, at cp/pt.c:16425
  2022-12-11 13:32 [Bug c++/108059] New: internal compiler error: in tsubst_copy, at cp/pt.c:16425 lh_mouse at 126 dot com
@ 2022-12-11 13:34 ` lh_mouse at 126 dot com
  2022-12-12  3:56 ` lh_mouse at 126 dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: lh_mouse at 126 dot com @ 2022-12-11 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

LIU Hao <lh_mouse at 126 dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.3.0, 11.1.0
             Target|                            |x86_64-linux-gnu
               Host|                            |x86_64-linux-gnu

--- Comment #1 from LIU Hao <lh_mouse at 126 dot com> ---
Reduced testcase, also ICEs with GCC 10.3.0 and 11.1.0, but 9.4.0 is fine:

```
template <int> using a = int;
template <int> auto b() {
  [](auto... c) { [](a<c>...) {}; };
}
template <int d> using e = decltype(b<d>);
e<1> f;

```


```
$ g++-10 -std=c++17 test.cc
test.cc: In instantiation of ‘auto b() [with int <anonymous> = 1]’:
test.cc:5:24:   required by substitution of ‘template<int d> using e = decltype
(b<d>) [with int d = 1]’
test.cc:6:4:   required from here
test.cc:3:19: internal compiler error: in tsubst_copy, at cp/pt.c:16425
    3 |   [](auto... c) { [](a<c>...) {}; };
      |                   ^~~~~~~~~~~~~~
0x7f76079c809a __libc_start_main
        ../csu/libc-start.c:308
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

```

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/108059] internal compiler error: in tsubst_copy, at cp/pt.c:16425
  2022-12-11 13:32 [Bug c++/108059] New: internal compiler error: in tsubst_copy, at cp/pt.c:16425 lh_mouse at 126 dot com
  2022-12-11 13:34 ` [Bug c++/108059] " lh_mouse at 126 dot com
@ 2022-12-12  3:56 ` lh_mouse at 126 dot com
  2022-12-12 13:24 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: lh_mouse at 126 dot com @ 2022-12-12  3:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from LIU Hao <lh_mouse at 126 dot com> ---
Reconfirmed with all the following versions:

* g++-10 (Ubuntu 10.4.0-4ubuntu1~22.04) 10.4.0
* g++-11 (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
* g++-12 (Ubuntu 12.2.0-3ubuntu1~22.04) 12.2.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/108059] internal compiler error: in tsubst_copy, at cp/pt.c:16425
  2022-12-11 13:32 [Bug c++/108059] New: internal compiler error: in tsubst_copy, at cp/pt.c:16425 lh_mouse at 126 dot com
  2022-12-11 13:34 ` [Bug c++/108059] " lh_mouse at 126 dot com
  2022-12-12  3:56 ` lh_mouse at 126 dot com
@ 2022-12-12 13:24 ` marxin at gcc dot gnu.org
  2022-12-12 16:30 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-12 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2022-12-12
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started to be rejected since r8-6334-g018e9cb5e6050e03 and it crashes since
r10-7835-ga3a4f6be0c7ac153.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/108059] internal compiler error: in tsubst_copy, at cp/pt.c:16425
  2022-12-11 13:32 [Bug c++/108059] New: internal compiler error: in tsubst_copy, at cp/pt.c:16425 lh_mouse at 126 dot com
                   ` (2 preceding siblings ...)
  2022-12-12 13:24 ` marxin at gcc dot gnu.org
@ 2022-12-12 16:30 ` pinskia at gcc dot gnu.org
  2024-04-30 13:42 ` andrew at ishiboo dot com
  2024-04-30 13:52 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-12 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There might be a dup of this bug already but I can't seem to find it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/108059] internal compiler error: in tsubst_copy, at cp/pt.c:16425
  2022-12-11 13:32 [Bug c++/108059] New: internal compiler error: in tsubst_copy, at cp/pt.c:16425 lh_mouse at 126 dot com
                   ` (3 preceding siblings ...)
  2022-12-12 16:30 ` pinskia at gcc dot gnu.org
@ 2024-04-30 13:42 ` andrew at ishiboo dot com
  2024-04-30 13:52 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: andrew at ishiboo dot com @ 2024-04-30 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Paprocki <andrew at ishiboo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrew at ishiboo dot com

--- Comment #5 from Andrew Paprocki <andrew at ishiboo dot com> ---
Reconfirmed with all the following versions:

* g++-11 11.3.0 internal compiler error: in tsubst_copy, at cp/pt.c:16767
* g++-12 12.2.0 internal compiler error: in tsubst_copy, at cp/pt.cc:16949
* g++-13 13.1.0 internal compiler error: in tsubst_copy, at cp/pt.cc:17275

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/108059] internal compiler error: in tsubst_copy, at cp/pt.c:16425
  2022-12-11 13:32 [Bug c++/108059] New: internal compiler error: in tsubst_copy, at cp/pt.c:16425 lh_mouse at 126 dot com
                   ` (4 preceding siblings ...)
  2024-04-30 13:42 ` andrew at ishiboo dot com
@ 2024-04-30 13:52 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-30 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
FWIW a workaround for most valid code is to replace e.g. ignore_index_t<v>,
where v is the problematic NTTP argument, with ignore_index_t<decltype(v){}>.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-30 13:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-11 13:32 [Bug c++/108059] New: internal compiler error: in tsubst_copy, at cp/pt.c:16425 lh_mouse at 126 dot com
2022-12-11 13:34 ` [Bug c++/108059] " lh_mouse at 126 dot com
2022-12-12  3:56 ` lh_mouse at 126 dot com
2022-12-12 13:24 ` marxin at gcc dot gnu.org
2022-12-12 16:30 ` pinskia at gcc dot gnu.org
2024-04-30 13:42 ` andrew at ishiboo dot com
2024-04-30 13:52 ` ppalka at gcc dot gnu.org

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