diff options
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ad39637c8b7..1466c4b4db8 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -9234,6 +9234,28 @@ extend_ref_init_temps (tree decl, tree init, vec<tree, va_gc> **cleanups) return init; } +/* Returns true iff an initializer for TYPE could contain temporaries that + need to be extended because they are bound to references or + std::initializer_list. */ + +bool +type_has_extended_temps (tree type) +{ + type = strip_array_types (type); + if (TREE_CODE (type) == REFERENCE_TYPE) + return true; + if (CLASS_TYPE_P (type)) + { + if (is_std_init_list (type)) + return true; + for (tree f = next_initializable_field (TYPE_FIELDS (type)); + f; f = next_initializable_field (DECL_CHAIN (f))) + if (type_has_extended_temps (TREE_TYPE (f))) + return true; + } + return false; +} + /* Returns true iff TYPE is some variant of std::initializer_list. */ bool |