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: unassig...@gcc.gnu.org

        ReportedBy: daniel.krueg...@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.

Reply via email to