[Bug c++/48449] New: [C++0x][SFINAE] Hard errors during value-initialization expressions
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Tue Apr 5 06:33:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48449
Summary: [C++0x][SFINAE] Hard errors during
value-initialization expressions
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
CC: jason@redhat.com
The following code involving reference types, function types, and abstract
class type should be well-formed, but are not:
template<class T, class = decltype(T())>
char f(int);
template<class>
char (&f(...))[2];
struct A { virtual ~A() = 0; };
static_assert(sizeof(f<int&>(0)) != 1, "Error"); // a
static_assert(sizeof(f<void()>(0)) != 1, "Error"); // b
static_assert(sizeof(f<A>(0)) != 1, "Error"); // c
The corresponding error messages are:
a) "error: invalid value-initialization of reference type"
b) "error: conversion from 'int' to non-scalar type 'void()' requested"
c) "error: cannot allocate an object of abstract type 'A' because the
following virtual functions are pure within 'A': virtual A::~A()"
More information about the Gcc-bugs
mailing list