From 7408c4a5e0d6723e11b043d9705b4e5b6b3b8a66 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 12 Nov 2015 12:42:00 +0100 Subject: [PATCH] sem_ch4.adb (analyze_If_Expression): Reject IF-expression where THEN-expression is overloaded and none of its... 2015-11-12 Thomas Quinot * sem_ch4.adb (analyze_If_Expression): Reject IF-expression where THEN-expression is overloaded and none of its interpretation is compatible with the ELSE-expression. From-SVN: r230241 --- gcc/ada/ChangeLog | 18 ++++++++++++++++++ gcc/ada/sem_ch4.adb | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 13c2be14cb9..cd0764a4a86 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,21 @@ +2015-11-12 Thomas Quinot + + * sem_ch4.adb (analyze_If_Expression): Reject IF-expression where + THEN-expression is overloaded and none of its interpretation is + compatible with the ELSE-expression. + +2015-11-12 Jerome Lambourg + + * init.c: Do not try to mess with the MSR values in RTP mode: + not needed and forbidden. + +2015-11-12 Ed Schonberg + + * exp_attr.adb (Compile_Stream_Body_In_Scope): Do not install + full view of a type that has pragma Stream_Convert, because + this indicates special processing for the stream operations of + the type. + 2015-11-12 Jerome Lambourg * init.c: Do not try to mess with the MSR values in RTP mode: diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 55a41f1c156..bf134ba8640 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -2191,6 +2191,17 @@ package body Sem_Ch4 is Get_Next_Interp (I, It); end loop; + + -- If no valid interpretation has been found, then the type of + -- the ELSE expression does not match any interpretation of + -- the THEN expression. + + if Etype (N) = Any_Type then + Error_Msg_N + ("type incompatible with that of `THEN` expression", + Else_Expr); + return; + end if; end; end if; end Analyze_If_Expression; -- 2.30.2