aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_aggr.adb
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2008-07-31 15:53:55 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-07-31 15:53:55 +0200
commiteff332d9a543eca97da3214564b0e91913980ebd (patch)
treed32a2d444d55981ab36ed3dcad9aec83d002a196 /gcc/ada/sem_aggr.adb
parent2653cbda9e00269e7668ec10b38215c59bc8cd10 (diff)
downloadgcc-eff332d9a543eca97da3214564b0e91913980ebd.zip
gcc-eff332d9a543eca97da3214564b0e91913980ebd.tar.gz
gcc-eff332d9a543eca97da3214564b0e91913980ebd.tar.bz2
2008-07-31 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb: (Resolve_Record_Aggregate): Bypass error that a type without components must have a "null record" aggregate when compiling for Ada 2005, since it's legal to give an aggregate of form (others => <>) for such a type. From-SVN: r138412
Diffstat (limited to 'gcc/ada/sem_aggr.adb')
-rw-r--r--gcc/ada/sem_aggr.adb12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 4f50dc0..d16b7d6 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -2770,7 +2770,17 @@ package body Sem_Aggr is
Error_Msg_N ("record aggregate cannot be null", N);
return;
- elsif No (First_Entity (Typ)) then
+ -- If the type has no components, then the aggregate should either
+ -- have "null record", or in Ada 2005 it could instead have a single
+ -- component association given by "others => <>". For Ada 95 we flag
+ -- an error at this point, but for Ada 2005 we proceed with checking
+ -- the associations below, which will catch the case where it's not
+ -- an aggregate with "others => <>". Note that the legality of a <>
+ -- aggregate for a null record type was established by AI05-016.
+
+ elsif No (First_Entity (Typ))
+ and then Ada_Version < Ada_05
+ then
Error_Msg_N ("record aggregate must be null", N);
return;
end if;