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++/85049] New: Internal compiler error with __integer_pack


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

            Bug ID: 85049
           Summary: Internal compiler error with __integer_pack
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abigail.buccaneer at gmail dot com
  Target Milestone: ---

The following code:

    template <int...> struct index_sequence {};

    template <typename... Ts> using index_sequence_for = 
        index_sequence<__integer_pack(sizeof...(Ts))...>;

    template <typename...> struct tuple {};

    template <typename... Ts> int get(tuple<index_sequence_for<Ts...>, Ts...>);

    int x = get(tuple<index_sequence_for<>>{});

fails to compile with an internal compiler error.
On gcc.godbolt.org's "gcc trunk" compiler, the output is the following:

    <source>: In substitution of 'template<class ... Ts> int
get(tuple<index_sequence<__integer_pack(sizeof ... (Ts ...))...>, Ts ...>)
[with Ts = <missing>]':
    <source>:10:42:   required from here
    <source>:10:42: internal compiler error: tree check: expected
template_parm_index, have call_expr in template_parm_level_and_index, at
cp/pt.c:20594
     int x = get(tuple<index_sequence_for<>>{});
                                          ^
    mmap: Invalid argument
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <https://gcc.gnu.org/bugs/> for instructions.
    Compiler returned: 1

And the version info is:

    g++ (GCC-Explorer-Build) 8.0.1 20180322 (experimental)

On a version of g++-8 installed from the Ubuntu repositories, the output is the
following:

    tuple.cpp: In substitution of ‘template<class ... Ts> int
get(tuple<std::integer_sequence<long unsigned int, __integer_pack(sizeof ...
(_Types ...))...>, Ts ...>) [with Ts = <missing>]’:
    tuple.cpp:7:47:   required from here
    tuple.cpp:7:47: internal compiler error: Segmentation fault
     int x = get(tuple<std::index_sequence_for<>>{});
                                               ^
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.

And the version info is:

    g++-8 (Ubuntu 8-20170923-1ubuntu2) 8.0.0 20170923 (experimental) [trunk
revision 253118]

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