I've only just noticed this: I'd been using -gnatX (so that I could use 'Image on records), which meant that the original code was OK (in the
sense that it didn't raise any problems), but of course it's not
portable even within the GNAT family. I think -gnat2020 might solve the
issue too, but there's a bit of a skew between CE 2021 and GCC 11.
the compiler says
value for discriminant "Node_Test" must be static
non-static function call (RM 4.9(6,18))
OK, I get that (tiresome though it is, and I'm amazed I've never come
across it before), but how to approach it? I seem to be OK with
case Get_Node_Type_Test (T.Node_Type_Part.all) is
when Text_Node_Test =>
Location_Step.Node_Test :=
(Node_Test => Text_Node_Test,
Name => Null_Unbounded_String);
when ...
end case;
but this seems very ugly.
On 8/29/21 8:51 PM, Simon Wright wrote:
the compiler says
value for discriminant "Node_Test" must be static
non-static function call (RM 4.9(6,18))
This has always been the rule for aggregates.
"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message news:sgjkj4$kn4$1@dont-email.me...
On 8/29/21 8:51 PM, Simon Wright wrote:
the compiler says
value for discriminant "Node_Test" must be static
non-static function call (RM 4.9(6,18))
This has always been the rule for aggregates.
But Ada 202x relaxes it slightly. If the expression has a static
nominal subtype, and every value in the subtype selects the same
variant, then a dynamic discriminant is allowed in a aggregate. I
don't know if that is what is happening here or not; this relaxation
doesn't come up that often.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 349 |
Nodes: | 16 (3 / 13) |
Uptime: | 139:11:53 |
Calls: | 7,613 |
Calls today: | 1 |
Files: | 12,789 |
Messages: | 5,685,991 |