Commit 070d862d by Hristian Kirtchev Committed by Arnaud Charlet

sem_ch3.adb (Analyze_Object_Declaration): Do not consider internally generated expressions when...

2016-04-18  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch3.adb (Analyze_Object_Declaration): Do not consider
	internally generated expressions when trying to determine whether
	a formal parameter of a tagged type subject to Extensions_Visible
	False is used to initialize an object.
	* sem_ch4.adb (Analyze_Type_Conversion): Do not consider
	internally generated expressions when trying to determine whether
	a formal parameter of a tagged type subject to Extensions_Visible
	False is used in a type conversion.

From-SVN: r235117
parent 933aa0ac
2016-04-18 Hristian Kirtchev <kirtchev@adacore.com> 2016-04-18 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch3.adb (Analyze_Object_Declaration): Do not consider
internally generated expressions when trying to determine whether
a formal parameter of a tagged type subject to Extensions_Visible
False is used to initialize an object.
* sem_ch4.adb (Analyze_Type_Conversion): Do not consider
internally generated expressions when trying to determine whether
a formal parameter of a tagged type subject to Extensions_Visible
False is used in a type conversion.
2016-04-18 Hristian Kirtchev <kirtchev@adacore.com>
* sem_res.adb (Is_Protected_Operation_Call): * sem_res.adb (Is_Protected_Operation_Call):
Add guards to account for a non-decorated selected component. Add guards to account for a non-decorated selected component.
......
...@@ -3776,9 +3776,13 @@ package body Sem_Ch3 is ...@@ -3776,9 +3776,13 @@ package body Sem_Ch3 is
-- A formal parameter of a specific tagged type whose related -- A formal parameter of a specific tagged type whose related
-- subprogram is subject to pragma Extensions_Visible with value -- subprogram is subject to pragma Extensions_Visible with value
-- "False" cannot be implicitly converted to a class-wide type by -- "False" cannot be implicitly converted to a class-wide type by
-- means of an initialization expression (SPARK RM 6.1.7(3)). -- means of an initialization expression (SPARK RM 6.1.7(3)). Do
-- not consider internally generated expressions.
if Is_Class_Wide_Type (T) and then Is_EVF_Expression (E) then if Is_Class_Wide_Type (T)
and then Comes_From_Source (E)
and then Is_EVF_Expression (E)
then
Error_Msg_N Error_Msg_N
("formal parameter with Extensions_Visible False cannot be " ("formal parameter with Extensions_Visible False cannot be "
& "implicitly converted to class-wide type", E); & "implicitly converted to class-wide type", E);
......
...@@ -5158,9 +5158,13 @@ package body Sem_Ch4 is ...@@ -5158,9 +5158,13 @@ package body Sem_Ch4 is
-- A formal parameter of a specific tagged type whose related subprogram -- A formal parameter of a specific tagged type whose related subprogram
-- is subject to pragma Extensions_Visible with value "False" cannot -- is subject to pragma Extensions_Visible with value "False" cannot
-- appear in a class-wide conversion (SPARK RM 6.1.7(3)). -- appear in a class-wide conversion (SPARK RM 6.1.7(3)). Do not check
-- internally generated expressions.
if Is_Class_Wide_Type (Typ) and then Is_EVF_Expression (Expr) then if Is_Class_Wide_Type (Typ)
and then Comes_From_Source (Expr)
and then Is_EVF_Expression (Expr)
then
Error_Msg_N Error_Msg_N
("formal parameter with Extensions_Visible False cannot be " ("formal parameter with Extensions_Visible False cannot be "
& "converted to class-wide type", Expr); & "converted to class-wide type", Expr);
...@@ -6602,7 +6606,7 @@ package body Sem_Ch4 is ...@@ -6602,7 +6606,7 @@ package body Sem_Ch4 is
-- Boolean, then we know that the other operand cannot resolve to -- Boolean, then we know that the other operand cannot resolve to
-- Boolean (since we got no interpretations), but in that case we -- Boolean (since we got no interpretations), but in that case we
-- pretty much know that the other operand should be Boolean, so -- pretty much know that the other operand should be Boolean, so
-- resolve it that way (generating an error) -- resolve it that way (generating an error).
elsif Nkind_In (N, N_Op_And, N_Op_Or, N_Op_Xor) then elsif Nkind_In (N, N_Op_And, N_Op_Or, N_Op_Xor) then
if Etype (L) = Standard_Boolean then if Etype (L) = Standard_Boolean then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment