diff --git a/gcc/testsuite/g++.dg/ext/is_enum2.C b/gcc/testsuite/g++.dg/ext/is_enum2.C new file mode 100644 index 0000000000000000000000000000000000000000..de14d6abea93ac5031e09250dbe3d48d162cfc90 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/is_enum2.C @@ -0,0 +1,10 @@ +// PR c++/99968 +// { dg-do compile { target c++11 } } +// { dg-additional-options -g } + +template <class T> struct A { + using type = T; + static const bool value = false; +}; + +enum E { e0 = __is_enum(E), e1 = A<E>::value }; diff --git a/gcc/tree.c b/gcc/tree.c index 0741e3b01af642574f28c537329f27dc9a6502f2..d68d6946aa263091ef90dfde18a4fa603e600cca 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -13704,6 +13704,7 @@ verify_type (const_tree t) error_found = true; } if (TREE_CODE (TREE_TYPE (value)) != INTEGER_TYPE + && TREE_CODE (TREE_TYPE (value)) != BOOLEAN_TYPE && !useless_type_conversion_p (const_cast <tree> (t), TREE_TYPE (value))) { error ("enum value type is not %<INTEGER_TYPE%> nor convertible "