Boost logo

Boost :

Subject: [boost] [type_traits] is_enum on scoped enums doesn't works as expected
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-08-21 05:26:09


Hi,

The following file fails to compile under clang 2.9 c++0x

#include <boost/static_assert.hpp>
#include <boost/type_traits/is_enum.hpp>

enum E {E_a,E_b,E_c};
BOOST_STATIC_ASSERT((boost::is_enum<E>::value));
enum class EC {a,b,c};
BOOST_STATIC_ASSERT((boost::is_enum<EC>::value));

//#include <type_traits>

The command line and error is

     "/Users/viboes/clang/clang+llvm-2.9/bin/clang++" -x c++ -std=c++0x
-O0 -g -Wextra -Wno-long-long -pedantic -O0 -fno-inline -Wall -pedantic
-g -DBOOST_ALL_NO_LIB=1 -DBOOST_CONVERSION_DOUBLE_CP
-DBOOST_ENABLE_WARNINGS -I"." -I"../../.." -c -o
"../../../bin.v2/libs/enums/test/is_enum_pass.test/clang-darwin-2.9x/debug/is_enum_pass.o"
"enum_class/is_enum_pass.cpp"

enum_class/is_enum_pass.cpp:7:1: error: static_assert failed
"(boost::is_enum<EC>::value)"
BOOST_STATIC_ASSERT((boost::is_enum<EC>::value));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from enum_class/is_enum_pass.cpp:1:

Am I missing something evident?
Is this a known bug of is_enum?

BTW, I have tried to use directly the type_traits standard file and my
build configuration is unable to find it.

enum_class/is_enum_pass.cpp:9:10: fatal error: 'type_traits' file not found
#include <type_traits>

Which is the default library when buildding with Boost.Build (bjam) and
clang 2.9 c++0x?

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk