[Bug libstdc++/56609] New: [C++11] Several type traits give incorrect results for std::nullptr_t
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Wed Mar 13 07:31:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56609
Bug #: 56609
Summary: [C++11] Several type traits give incorrect results for
std::nullptr_t
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
The following code is rejected when compiled with gcc 4.8.0 20130310
(experimental) or with gcc 4.7.2 using the flags
-Wall -std=c++11 -pedantic
//--------------------------------------------------
#include <type_traits>
typedef decltype(nullptr) np_t;
static_assert(std::is_scalar<np_t>::value, "");
static_assert(!std::is_class<np_t>::value, "");
static_assert(std::is_fundamental<np_t>::value, ""); // #7
static_assert(!std::is_compound<np_t>::value, ""); // #8
//--------------------------------------------------
"7|error: static assertion failed: |
8|error: static assertion failed: |"
According to 3.9 p9 std::nullptr_t is a scalar type, I also read 3.9.1 p10 that
it is a fundamental type. This is confirmed by 3.9.2 not listing anything that
can be applied to std::nullptr_t.
I think the code should be accepted.
More information about the Gcc-bugs
mailing list