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

           Summary: [C++0x][SFINAE] Failures with n-ary initialization
                    expressions (with template default argument)
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: daniel.krueg...@googlemail.com
                CC: ja...@redhat.com


Some n-ary initialization expressions in a SFINAE context used in function
template default arguments either give a hard error:

  a) any T => abstract class

or give the wrong result:

  b) when the destination is a class type constructed from valid arguments

#include <utility> // for declval

template<class T, class... Args,
 class = decltype(T(std::declval<Args>()...))
>
char f(int);

template<class, class...>
char (&f(...))[2];

struct A { virtual ~A() = 0; };
struct From2Ints { From2Ints(int, int); };

static_assert(sizeof(f<A, int, int>(0)) != 1, "Error"); // a
static_assert(sizeof(f<From2Ints, int, int>(0)) == 1, "Error"); // b

a) "error: cannot allocate an object of abstract type 'A' because the
following virtual functions are pure within 'A': virtual A::~A()"
b) Assertion triggers!

Reply via email to