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

            Bug ID: 82279
           Summary: [C++17] ICE in tsubst_pack_expansion, at cp/pt.c:11514
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s.gesemann at gmail dot com
  Target Milestone: ---

The following code reproduces the error:

    template<auto T>
    struct foo;

    template<class Class, class Ret, class...Args, Ret (Class::*PMF)(Args...)>
    struct foo<PMF> {};

    struct bar {
        void memfun() {}
    };

    int main() {
        foo<&bar::memfun>();
    }

I used g++ with -std=c++17 option and it resulted in:

    <source>: In function 'int main()':
    12 : <source>:12:23: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:11514
         foo<&bar::memfun>();
                           ^
    mmap: Cannot allocate memory
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <https://gcc.gnu.org/bugs/> for instructions.
    Compiler exited with result code 1

See also https://godbolt.org/g/CMfzHt

Reply via email to