public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cuzdav at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails
Date: Fri, 13 May 2022 01:25:54 +0000	[thread overview]
Message-ID: <bug-105589-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105589
           Summary: [ICE] templated type alias over std::array with bound
                    type in template function fails
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cuzdav at gmail dot com
  Target Milestone: ---

Created attachment 52969
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52969&action=edit
preprocessed code

Internal compiler error - new in gcc12

COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/imc/gcc-12.1.0/libexec/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-12.1.0/configure --prefix=/opt/imc/gcc-12.1.0
--enable-languages=c,c++,fortran,lto --disable-multilib
--with-build-time-tools=/home/trading/cuzdav/code/imc-gcc/gcc/12.1.0/INSTALLDIR//opt/imc/gcc-12.1.0/bin
--enable-libstdcxx-time=rt
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.1.0 (GCC) 


Spent a long time minimizing it to this example, so it's contrived but small. 

The user-provided constructor in the element type seems related.
The auto parameter in form() is also necessary, even if unused.

///////////////////////////////////////////////
#include <array>

struct X {
    X() {}
};

template<int N>
using C = std::array<X, N>;

void form(auto) {
  auto w = C<16>{};
}
///////////////////////////////////////////////

LIVE:
(Also visible on the 12.1 on godbolt)
https://godbolt.org/z/qWba56onf

OUTPUT:
foo2.cpp: In function ‘void form(auto:3)’:
foo2.cpp:11:18: internal compiler error: in build_value_init, at cp/init.cc:347
   11 |   auto w = C<16>{};
      |                  ^
0x1b1211a diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, __va_list_tag (*) [1], diagnostic_t)
        ???:0
0x13637ff internal_error(char const*, ...)
        ???:0
0x13638d1 fancy_abort(char const*, int, char const*)
        ???:0
0x7665e6 build_value_init(tree_node*, int) [clone .cold]
        ???:0
0x1901bb1 build_vec_init_expr(tree_node*, tree_node*, int)
        ???:0
0x809217 digest_init_r(tree_node*, tree_node*, int, int, int) [clone .cold]
        ???:0
0x157c0ca massage_init_elt(tree_node*, tree_node*, int, int, int)
        ???:0
0x8096e7 digest_init_r(tree_node*, tree_node*, int, int, int) [clone .cold]
        ???:0
0x18ff96c finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        ???:0
0x15453de cp_parser_functional_cast(cp_parser*, tree_node*)
        ???:0
0x153e4ac cp_parser_postfix_expression(cp_parser*, bool, bool, bool, bool,
cp_id_kind*)
        ???:0
0x153c5dc cp_parser_binary_expression(cp_parser*, bool, bool, bool,
cp_parser_prec, cp_id_kind*)
        ???:0
0x153c2b2 cp_parser_assignment_expression(cp_parser*, cp_id_kind*, bool, bool)
        ???:0
0x153c130 cp_parser_constant_expression(cp_parser*, int, bool*, bool)
        ???:0
0x153bf7b cp_parser_initializer(cp_parser*, bool*, bool*, bool)
        ???:0
0x7a2ea4 cp_parser_init_declarator(cp_parser*, int, cp_decl_specifier_seq*,
vec<deferred_access_check, va_gc, vl_embed>*, bool, bool, int, bool*,
tree_node**, unsigned int*, tree_node**) [clone .cold]
        ???:0
0x15300c5 cp_parser_simple_declaration(cp_parser*, bool, tree_node**)
        ???:0
0x1542170 cp_parser_declaration_statement(cp_parser*)
        ???:0
0x1540bf3 cp_parser_statement(cp_parser*, tree_node*, bool, bool*,
vec<tree_node*, va_heap, vl_ptr>*, unsigned int*)
        ???:0
0x1540657 cp_parser_compound_statement(cp_parser*, tree_node*, int, bool)
        ???: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.


Preprocessed code attached.

             reply	other threads:[~2022-05-13  1:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13  1:25 cuzdav at gmail dot com [this message]
2022-05-13  7:57 ` [Bug c++/105589] [12/13 Regression] " rguenth at gcc dot gnu.org
2022-05-13 13:28 ` ppalka at gcc dot gnu.org
2022-05-13 19:56 ` jason at gcc dot gnu.org
2022-05-15 16:24 ` jason at gcc dot gnu.org
2022-05-15 16:25 ` jason at gcc dot gnu.org
2022-05-15 16:28 ` cvs-commit at gcc dot gnu.org
2022-05-15 16:29 ` cvs-commit at gcc dot gnu.org
2022-05-15 16:29 ` jason at gcc dot gnu.org
2022-10-04 18:25 ` pinskia 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-105589-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).