diff mbox series

[Ada] Fix assertion failure on qualified type names in predicates

Message ID 20200616130745.GA86899@adacore.com
State New
Headers show
Series [Ada] Fix assertion failure on qualified type names in predicates | expand

Commit Message

Pierre-Marie de Rodat June 16, 2020, 1:07 p.m. UTC
An assertion is code for static membership tests was failing on this
code:

   subtype A is Integer with
     predicate => A > 0;

   subtype B is Integer with
     predicate => B in P.A;

where a qualified type name "P.A" appears in the predicate of type B.
The fix is trivial and the problem didn't affect production builds.

Tested on x86_64-pc-linux-gnu, committed on trunk

2020-06-16  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_ch13.adb (Membership_Entry): Relax assertion to also
	recognize qualified identifiers.
diff mbox series

Patch

--- gcc/ada/sem_ch13.adb
+++ gcc/ada/sem_ch13.adb
@@ -8566,7 +8566,7 @@  package body Sem_Ch13 is
 
          --  Identifier (other than static expression) case
 
-         else pragma Assert (Nkind (N) = N_Identifier);
+         else pragma Assert (Nkind_In (N, N_Expanded_Name, N_Identifier));
 
             --  Type case