enum bool_range_state { BRS_FALSE, BRS_TRUE, BRS_EMPTY, BRS_FULL };
-// Return the summary information about boolean range LHS. Return an
-// "interesting" range in R. For EMPTY or FULL, return the equivalent
-// range for TYPE, for BRS_TRUE and BRS false, return the negation of
-// the bool range.
+// Return the summary information about boolean range LHS. If EMPTY/FULL,
+// return the equivalent range for TYPE in R; if FALSE/TRUE, do nothing.
static bool_range_state
get_bool_state (irange &r, const irange &lhs, tree val_type)
r.set_varying (val_type);
return BRS_FULL;
}
+
return BRS_TRUE;
}
break;
case BRS_FALSE:
- // If its true, the result is the same as OP2.
+ // If it's false, the result is the same as OP2.
r = op2;
break;
r = op2;
break;
default:
- gcc_unreachable ();
+ break;
}
return true;
}
--- /dev/null
+-- { dg-do compile }
+-- { dg-options "-O2 -gnata -gnatVa" }
+
+with Opt5_Pkg;
+
+package Opt5 is
+
+ type Object is new Opt5_Pkg.Object with private;
+
+ Undefined : constant Object;
+
+ overriding function Is_Defined (Self : Object) return Boolean;
+
+ function Create (Sloc : Opt5_Pkg.Object) return Integer is (0)
+ with Pre => Sloc.Is_Defined;
+
+private
+
+ type Object is new Opt5_Pkg.Object with null record;
+
+ Undefined : constant Object := (Opt5_Pkg.Undefined with others => <>);
+
+ overriding function Is_Defined (Self : Object) return Boolean is (Self /= Undefined);
+
+end Opt5;
--- /dev/null
+package Opt5_Pkg is
+
+ type Object is tagged private;
+
+ Undefined : constant Object;
+
+ function Is_Defined (Self : Object) return Boolean;
+
+private
+
+ type Object is tagged null record;
+
+ Undefined : constant Object := (others => <>);
+
+ function Is_Defined (Self : Object) return Boolean is (Self /= Undefined);
+
+end Opt5_Pkg;