c++: ICE on enum with bool value [PR99968]
BOOLEAN_TYPE also counts as integral, so verify_type should allow it. PR c++/99968 gcc/ChangeLog: * tree.c (verify_type): Allow enumerator with BOOLEAN_TYPE. gcc/testsuite/ChangeLog: * g++.dg/ext/is_enum2.C: New test.
This commit is contained in:
parent
9258ac53cf
commit
db25655fa5
2 changed files with 11 additions and 0 deletions
10
gcc/testsuite/g++.dg/ext/is_enum2.C
Normal file
10
gcc/testsuite/g++.dg/ext/is_enum2.C
Normal file
|
@ -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 };
|
|
@ -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 "
|
||||
|
|
Loading…
Add table
Reference in a new issue