summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch4.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-15 09:57:47 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-15 09:57:47 +0000
commit46f942b1635d1d2b5828d204c914e86d58d52082 (patch)
tree71361ae103915a536a466c140fbb0b0baa9c0e6d /gcc/ada/sem_ch4.adb
parent555c63a669bf0ad0343938c048251c4cb11d7b80 (diff)
downloadgcc-46f942b1635d1d2b5828d204c914e86d58d52082.tar.gz
2009-04-15 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb: improve error message on exponentiation. 2009-04-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Move constant Epoch_Offset from package Conversion_Operations to top level. (Delay_Operations.To_Duration): Define a constant which represents "end of time" and use it as a guard against very distant delay dates. Protect the code against overflow when performing the origin shift to Unix time. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146095 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r--gcc/ada/sem_ch4.adb14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index e8199b5efeb..e9a20c5a70d 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -5213,6 +5213,20 @@ package body Sem_Ch4 is
Error_Msg_N ("access parameter is not allowed to be null", L);
Error_Msg_N ("\(call would raise Constraint_Error)", L);
return;
+
+ -- Another special case for exponentiation, where the right
+ -- operand must be Natural, independently of the base.
+
+ elsif Nkind (N) = N_Op_Expon
+ and then Is_Numeric_Type (Etype (L))
+ and then not Is_Overloaded (R)
+ and then
+ First_Subtype (Base_Type (Etype (R))) /= Standard_Integer
+ and then Base_Type (Etype (R)) /= Universal_Integer
+ then
+ Error_Msg_NE
+ ("exponent must be of type Natural, found}", R, Etype (R));
+ return;
end if;
-- If we fall through then just give general message. Note that in