aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch3.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-01-21 17:20:24 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2014-01-21 17:20:24 +0100
commit84f80f5bf11215999e2e5461bcdd8a2adae2c127 (patch)
tree04b17f97d18e8ae8d8089ea8f767487bd5f16ed4 /gcc/ada/exp_ch3.adb
parent6c3c671e4d2659884d01f384723910b0966d2c6d (diff)
downloadgcc-84f80f5bf11215999e2e5461bcdd8a2adae2c127.zip
gcc-84f80f5bf11215999e2e5461bcdd8a2adae2c127.tar.gz
gcc-84f80f5bf11215999e2e5461bcdd8a2adae2c127.tar.bz2
[multiple changes]
2014-01-21 Robert Dewar <dewar@adacore.com> * sem_ch3.adb, sem_prag.adb, sem_prag.ads, sem_ch12.adb, sem_res.adb, sem_ch6.adb, a-except-2005.adb: Minor reformatting. 2014-01-21 Ed Schonberg <schonberg@adacore.com> * exp_ch3.adb (Expand_N_Object_Declaration): When a class-wide object is declared, it is rewritten as a renaming of an dynamic expression that wraps the initial value. The renaming declaration is first given an internal name, to prevent collisions with the entity already declared, and then the name is modified to reflect the original one. the modification of the name must preserve the source location of the original, to prevent spurious errors when compiling with style checks if the declaration involves more than one entity. From-SVN: r206887
Diffstat (limited to 'gcc/ada/exp_ch3.adb')
-rw-r--r--gcc/ada/exp_ch3.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 4a0fdf6..ce7f01f 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -5504,7 +5504,9 @@ package body Exp_Ch3 is
-- itypes may have been generated already, and the full
-- chain must be preserved for final freezing. Finally,
-- preserve Comes_From_Source setting, so that debugging
- -- and cross-referencing information is properly kept.
+ -- and cross-referencing information is properly kept, and
+ -- preserve source location, to prevent spurious errors when
+ -- entities are declared (they must have their own Sloc).
declare
New_Id : constant Entity_Id := Defining_Identifier (N);
@@ -5519,6 +5521,7 @@ package body Exp_Ch3 is
Set_Chars (Defining_Identifier (N), Chars (Def_Id));
Set_Homonym (Defining_Identifier (N), Homonym (Def_Id));
Set_Ekind (Defining_Identifier (N), Ekind (Def_Id));
+ Set_Sloc (Defining_Identifier (N), Sloc (Def_Id));
Set_Comes_From_Source (Def_Id, False);
Exchange_Entities (Defining_Identifier (N), Def_Id);