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

            Bug ID: 59901
           Summary: internal compiler error: in retrieve_specialization
                    cp/pt.c:1012
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burrows.labs at gmail dot com

Created attachment 31914
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31914&action=edit
preprocessed source

Code and error below; I've also attached the preprocessed source. The problem
also seems to exist in 4.8

#include <tuple>
#include <iostream>

// designates a field to be serialized
template <typename Name, typename Type>
class MemberPair {
public:
    typedef Type type;
    typedef Name name;
};

template <typename... All>
class A {};

template <typename Base, typename Head, typename... Tail>
class A<Base, Head, Tail...> : A<Base, Tail...> {
public:
    template <typename NameAttemptHead, typename... NameAttemptTail>
    using Type =
        typename
            std::tuple<typename
                std::enable_if<std::is_same<NameAttemptHead,
                                            typename Head::name>::value,
                               typename Head::type>::type,
                typename A<Base, Tail...>::template Type<NameAttemptTail...> >;

};

template <typename Base>
class A<Base> {
public:
    template <typename... Empty>
    using Type = std::tuple<>;
};

namespace F {
    struct x;
    struct y;
    struct z;
}

class D : public A<D, MemberPair<F::x, int>,
                      MemberPair<F::y, int>,
                      MemberPair<F::z, std::string> > {

};

int
main()
{
    // D dee;
    // static_cast< A<D, MemberPair<F::y>, MemberPair<F::z> &>(dee);
    return 0;
}

// eof

$ g++-4.7 -std=c++0x -pedantic -Wall gettype.cpp -o gettype -g
gettype.cpp: In instantiation of ‘class A<D, MemberPair<F::z,
std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >’:
gettype.cpp:16:7:   recursively required from ‘class A<D, MemberPair<F::y,
int>, MemberPair<F::z, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > >’
gettype.cpp:16:7:   required from ‘class A<D, MemberPair<F::x, int>,
MemberPair<F::y, int>, MemberPair<F::z, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > >’
gettype.cpp:41:18:   required from here
gettype.cpp:32:30: internal compiler error: in retrieve_specialization, at
cp/pt.c:1012
Please submit a full bug report,

Reply via email to