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++/59964] New: gcc segfault on compiling nested parameter pack code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59964

            Bug ID: 59964
           Summary: gcc segfault on compiling nested parameter pack code
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tinlyx at gmail dot com

Created attachment 31965
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31965&action=edit
code to produce the error.

I was trying to write a code (using mingw32 gcc4.8.1 as of Jan 2014) involving
two parameter packs Args1... and Args2... . I used a nested class. Args1... and
Args2... are similar and of same lengths. I wrote a shorthand using statement
for the trivial when Args1... and Args2... are the same:
--
template <typename R, typename ...Args>
using zip_t = zip<R, Args...>::with<Args...>;

However, gcc generates a segment fault when compiling this statement.
"
g++ -c -o testUsing.o -std=c++11 -I..  -Wall -Wextra -fno-strict-aliasing
-fwrapv testUsing.cpp
testUsing.cpp: In substitution of 'template<class R, class ... Args> using
zip_t = zip<R, Args1 ...>::with<Args ...> [with R = A; Args = {}]':
testUsing.cpp:19:15:   required from here
testUsing.cpp:16:45: internal compiler error: Segmentation fault
 using zip_t = zip<R, Args...>::with<Args...>;
......
"

A minimal code is as follows (also attached):

---------

template<typename...> struct Tuple {};
template<typename T1, typename T2> struct Pair {};

template<class R,class ...Args1>  struct zip {
    template<class ...Args2> struct with {
        R flag;
        typedef Tuple<Pair<Args1, Args2>...> type;
    };
};

typedef zip<bool,short, int>::with<unsigned short, unsigned>::type T1;
T1 make_zip1(bool) {return T1();}

template <typename R, typename ...Args>
using zip_t = zip<R, Args...>::with<Args...>;

template<typename A>
static zip_t<A>::type make_zip(A) {
  return zip_t<A>::type{};
}


//test code
int main() { return 0; }


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