template<int N>
struct S
{
    typedef int type;
};

template<typename T>
struct Get
{
    static T get();
};

#ifdef BUG
# define ELLIPSIS ...
#else
# define ELLIPSIS
#endif

template<typename F>
struct B
{
    template<typename ELLIPSIS Args>
        typename S<sizeof( Get<F>::get() (Get<Args>::get() ELLIPSIS) )>::type
        f(Args&& ELLIPSIS a);
};

struct X
{
    bool operator()(int) const;
};

int main()
{
    B<X> b;
    b.f(1);
} 

jwak...@gcc16:~/src/tests$ g++ -std=c++0x  -c pr.cc 
jwak...@gcc16:~/src/tests$ g++ -std=c++0x  -c pr.cc  -DBUG
pr.cc: In instantiation of ‘B<X>’:
pr.cc:35:10:   instantiated from here
pr.cc:25:9: internal compiler error: in tsubst, at cp/pt.c:9733
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The code compiles fine with a single template parameter, but not with a
parameter pack of size one.

I'm trying to use SFINAE to disable overloads when a function call expression
is invalid, which is needed to implement std::bind for C++0x


-- 
           Summary: ICE trying to use sfinae with variadic template pack
                    expansion
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jwakely dot gcc at gmail dot com


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

Reply via email to