This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This change makes sure the compiler produces a proper error (rather than crash) when compiling an (illegal) IF-expression where THEN-expression is overloaded, and none of its interpretation is compatible with the ELSE-expression. The following compilation must display: $ gcc -c badelse.adb badelse.adb:4:50: type incompatible with that of "then" expression package Badelse is type K is (Unknown, Blue, Red); type Tristate is (False, True, Unknown); Boo : Boolean; procedure P (X : K); end Badelse; package body Badelse is procedure P (X : K) is begin Boo := (if X = Unknown then Unknown else X = Blue); end P; end Badelse; Tested on x86_64-pc-linux-gnu, committed on trunk 2015-11-12 Thomas Quinot <quinot@adacore.com> * 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.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |