http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48452
Summary: [C++0x][SFINAE] Failures with n-ary initialization
expressions (in return type)
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Some n-ary initialization expressions in a SFINAE context used in a return type
definition either give hard errors:
a) any T => abstract class
b) cv void => T (T is a class type)
or give the wrong result:
c) when void is initialized with more than one argument
#include <utility> // for declval
template<class T, class... Args>
decltype(T(std::declval<Args>()...), char()) f(int);
template<class, class...>
char (&f(...))[2];
struct A { virtual ~A() = 0; };
struct B {};
static_assert(sizeof(f<A, int, int>(0)) != 1, "Error"); // a
static_assert(sizeof(f<B, void, int>(0)) != 1, "Error"); // b
static_assert(sizeof(f<void, int, int>(0)) != 1, "Error"); // c
a) "error: cannot allocate an object of abstract type 'A' because the
following virtual functions are pure within 'A': virtual A::~A()"
b) "error: invalid use of void expression"
c) Assertion triggers!