]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Spurious error on protected call in inherited postcondition
authorEd Schonberg <schonberg@adacore.com>
Sun, 24 Jan 2021 18:18:28 +0000 (13:18 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 7 May 2021 09:28:51 +0000 (05:28 -0400)
gcc/ada/

* exp_util.adb (Build_Class_Wide_Expression, Replace_Entity):
Add guard to verify that the enclosing pragma is a precondition.

gcc/ada/exp_util.adb

index 2955fd7f498656cca9ea803ad44b5704a490a434..30e1aff37b223baf0778bcc9fc87c92ce5ddcc5d 100644 (file)
@@ -1327,6 +1327,7 @@ package body Exp_Util is
                  and then Is_Primitive_Wrapper (New_E)
                  and then Is_Primitive_Wrapper (Subp)
                  and then Scope (Subp) = Scope (New_E)
+                 and then Chars (Pragma_Identifier (Prag)) = Name_Precondition
                then
                   Error_Msg_Node_2 := Wrapped_Entity (Subp);
                   Error_Msg_NE