static tree
mangle_referenced_decls (tree *tp, int *walk_subtrees, void *)
{
- if (! EXPR_P (*tp) && ! CONSTANT_CLASS_P (*tp))
+ if (! EXPR_P (*tp)
+ && ! CONSTANT_CLASS_P (*tp)
+ && TREE_CODE (*tp) != CONSTRUCTOR)
*walk_subtrees = 0;
if (VAR_OR_FUNCTION_DECL_P (*tp))
/* For early_dwarf force mangling of all referenced symbols. */
tree initializer = init;
STRIP_NOPS (initializer);
- /* rtl_for_decl_init punts on other aggregates, and complex values. */
- if (AGGREGATE_TYPE_P (type)
- || (TREE_CODE (initializer) == VIEW_CONVERT_EXPR
- && AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (initializer, 0))))
- || TREE_CODE (type) == COMPLEX_TYPE)
- ;
- else if (initializer_constant_valid_p (initializer, type))
+ if (initializer_constant_valid_p (initializer, type))
walk_tree (&initializer, mangle_referenced_decls, NULL, NULL);
}
/* If the host and target are sane, try harder. */
--- /dev/null
+// { dg-lto-do assemble }
+// { dg-lto-options { { -flto -ffat-lto-objects -g } } }
+
+template <typename T> void foo (void *, void *) { new T; }
+using C = void (*) (void *, void *);
+template <typename T> struct D { static constexpr C foo = ::foo <T>; };
+struct E { void (*bar) (void *, void *); };
+constexpr bool v = false;
+template <typename T, typename> void baz () { E { D<T>::foo }; }
+template <class, class, bool> struct F;
+template <class R, class E> struct F <R, E, false> { static void qux () { baz <R, E> (); } };
+template <typename... T> void corge () { (F <T, void, v>::qux (), ...); }
+template <auto S> struct G { long long val = 0; };
+struct H {
+ virtual void garply ();
+ void plugh (const int &);
+ G <&H::plugh> h;
+};
+void fred () { corge <H> (); }