diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-11-15 12:24:38 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-11-15 12:24:38 -0500 |
commit | b126f3ffbef59b0b08c2c2a664133d7d6f5ca235 (patch) | |
tree | eaf2d443fca590d755f137401793a03c219e4350 /gcc/cp | |
parent | 40a7707a7ea3568cee2cd80cd7e83b7eda678410 (diff) | |
download | gcc-b126f3ffbef59b0b08c2c2a664133d7d6f5ca235.zip gcc-b126f3ffbef59b0b08c2c2a664133d7d6f5ca235.tar.gz gcc-b126f3ffbef59b0b08c2c2a664133d7d6f5ca235.tar.bz2 |
c++: direct enum init from type-dep elt [PR112515]
The NON_DEPENDENT_EXPR removal exposed that is_direct_enum_init can be
called in a template context on a CONSTRUCTOR that isn't type-dependent
but whose element is.
PR c++/112515
gcc/cp/ChangeLog:
* decl.cc (is_direct_enum_init): Check type-dependence of the
single element.
gcc/testsuite/ChangeLog:
* g++.dg/template/non-dependent30.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/decl.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index d2ed46b..b8e1098 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -6614,6 +6614,7 @@ is_direct_enum_init (tree type, tree init) && CONSTRUCTOR_NELTS (init) == 1 /* DR 2374: The single element needs to be implicitly convertible to the underlying type of the enum. */ + && !type_dependent_expression_p (CONSTRUCTOR_ELT (init, 0)->value) && can_convert_arg (ENUM_UNDERLYING_TYPE (type), TREE_TYPE (CONSTRUCTOR_ELT (init, 0)->value), CONSTRUCTOR_ELT (init, 0)->value, |