@@ -1364,6 +1364,46 @@ namespace
13641364 CHECK_CLOSE (type_identity_test_add (1 .5f , 2 ), 3 .5f , 0 .01f );
13651365 }
13661366
1367+ // *************************************************************************
1368+ #if ETL_USING_BUILTIN_UNDERLYING_TYPE
1369+ TEST (test_underlying_type)
1370+ {
1371+ enum enum0_t : char
1372+ {
1373+ };
1374+
1375+ enum enum1_t : uint32_t
1376+ {
1377+ };
1378+
1379+ enum class enum2_t : short
1380+ {
1381+ };
1382+
1383+ enum class enum3_t : size_t
1384+ {
1385+ };
1386+
1387+ using enum4_t = enum1_t ;
1388+ using enum5_t = std::add_const<enum2_t >::type;
1389+
1390+ CHECK_TRUE ((std::is_same<etl::underlying_type<enum0_t >::type, char >::value));
1391+ CHECK_TRUE ((std::is_same<etl::underlying_type<enum1_t >::type, uint32_t >::value));
1392+ CHECK_TRUE ((std::is_same<etl::underlying_type<enum2_t >::type, short >::value));
1393+ CHECK_TRUE ((std::is_same<etl::underlying_type<enum3_t >::type, size_t >::value));
1394+ CHECK_TRUE ((std::is_same<etl::underlying_type<enum4_t >::type, uint32_t >::value));
1395+ CHECK_TRUE ((std::is_same<etl::underlying_type<enum5_t >::type, short >::value));
1396+ #if ETL_USING_CPP11
1397+ CHECK_TRUE ((std::is_same<etl::underlying_type_t <enum0_t >, char >::value));
1398+ CHECK_TRUE ((std::is_same<etl::underlying_type_t <enum1_t >, uint32_t >::value));
1399+ CHECK_TRUE ((std::is_same<etl::underlying_type_t <enum2_t >, short >::value));
1400+ CHECK_TRUE ((std::is_same<etl::underlying_type_t <enum3_t >, size_t >::value));
1401+ CHECK_TRUE ((std::is_same<etl::underlying_type_t <enum4_t >, uint32_t >::value));
1402+ CHECK_TRUE ((std::is_same<etl::underlying_type_t <enum5_t >, short >::value));
1403+ #endif
1404+ }
1405+ #endif
1406+
13671407 // *************************************************************************
13681408 TEST (test_has_duplicates)
13691409 {
0 commit comments