This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82382] New: ICE for template auto parameter specialized for function pointer with variadic arguments


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

            Bug ID: 82382
           Summary: ICE for template auto parameter specialized for
                    function pointer with variadic arguments
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: witosx at gmail dot com
  Target Milestone: ---

### source code 

template<auto init>
struct A;

// this compiles fine (no variadic Args...)
// template<typename Arg, void(*fptr)(Arg)>
// struct A<fptr> {};

// this will cause ICE when trying to create an instance of A
template<typename... Args, void(*fptr)(Args...)>
struct A<fptr> {};

void f(int) {}

void test()
{
    // internal compiler error: in tsubst_pack_expansion, at cp/pt.c:11556
    A<f> a;
}


### g++ -c -std=c++17 other/gccbug.cpp

other/gccbug.cpp: In function ‘void test()’:
other/gccbug.cpp:17:10: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:11556
     A<f> a;
          ^
0x60c5ce tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        /home/witos/git/gcc/gcc/cp/pt.c:11556
0xa11d6a tsubst_arg_types
        /home/witos/git/gcc/gcc/cp/pt.c:13220
0xa24ea4 tsubst_function_type
        /home/witos/git/gcc/gcc/cp/pt.c:13382
0xa219b4 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/witos/git/gcc/gcc/cp/pt.c:14132
0xa2172e tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/witos/git/gcc/gcc/cp/pt.c:13636
0x601b71 unify
        /home/witos/git/gcc/gcc/cp/pt.c:20919
0xa1572f unify
        /home/witos/git/gcc/gcc/cp/pt.c:21111
0xa166c9 get_partial_spec_bindings
        /home/witos/git/gcc/gcc/cp/pt.c:21917
0xa16cc2 most_specialized_partial_spec
        /home/witos/git/gcc/gcc/cp/pt.c:22189
0xa3f3c0 instantiate_class_template_1
        /home/witos/git/gcc/gcc/cp/pt.c:10356
0xa3f3c0 instantiate_class_template(tree_node*)
        /home/witos/git/gcc/gcc/cp/pt.c:10924
0xa84c7d complete_type(tree_node*)
        /home/witos/git/gcc/gcc/cp/typeck.c:136
0x9358e9 start_decl_1(tree_node*, bool)
        /home/witos/git/gcc/gcc/cp/decl.c:5154
0x9571ef start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        /home/witos/git/gcc/gcc/cp/decl.c:5117
0x9eb57a cp_parser_init_declarator
        /home/witos/git/gcc/gcc/cp/parser.c:19490
0x9f1b5d cp_parser_simple_declaration
        /home/witos/git/gcc/gcc/cp/parser.c:13000
0x9f2968 cp_parser_block_declaration
        /home/witos/git/gcc/gcc/cp/parser.c:12825
0x9f3369 cp_parser_declaration_statement
        /home/witos/git/gcc/gcc/cp/parser.c:12419
0x9d1691 cp_parser_statement
        /home/witos/git/gcc/gcc/cp/parser.c:10897
0x9d25b0 cp_parser_statement_seq_opt
        /home/witos/git/gcc/gcc/cp/parser.c:11234
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

### g++ -v

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --disable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 7.2.0 (GCC)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]