c++: -Wdangling-reference tweak to unbreak aarch64
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wdangling-reference21.C
blobe1b6e3dd94ccf7ddb188ca09ea48b2f2a558d10a
1 // { dg-do compile { target c++11 } }
2 // { dg-options "-Wdangling-reference" }
3 // Reduced from config/aarch64/aarch64-early-ra.cc.
5 template <typename T> struct array_slice {
6   using iterator = T *;
7   iterator begin();
8   iterator end();
9   iterator m_base;
12 struct allocno_group_info { };
14 char recog_data_2;
15 int record_constraints_op;
16 struct early_ra {
17   using operand_mask = int;
18   struct allocno_info {
19     int is_earlyclobbered;
20   };
21   struct allocno_subgroup {
22     array_slice<allocno_info> allocnos();
23     allocno_group_info *group;
24   };
25   allocno_subgroup get_allocno_subgroup(int);
26   void record_constraints();
28 void early_ra::record_constraints() {
29   operand_mask earlyclobber_operands, matched_operands, unmatched_operands,
30       matches_operands, op_mask = operand_mask();
31   auto record_operand = [&](int, int) {
32     operand_mask overlaps;
33     matches_operands |= overlaps;
34   };
35   for (int opno = 0; recog_data_2; ++opno) {
36     operand_mask op_mask = earlyclobber_operands |= op_mask;
37     if (0)
38       record_operand(1, 0);
39   }
40   if (op_mask || (matched_operands & unmatched_operands && 0))
41     for (auto &allocno : get_allocno_subgroup(record_constraints_op).allocnos())
42       allocno.is_earlyclobbered = true;