diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-22 13:15:08 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-22 13:15:08 +0000 |
commit | 0c6022602c0531dbafa2e9f9411ca805bacaa7bb (patch) | |
tree | 6125b7f8442e33eeeb9d44c9f01c87cbce2e5066 /gcc/ada/freeze.adb | |
parent | f15d3bdc564b13672f679bcf95afdc455d23535e (diff) | |
download | gcc-0c6022602c0531dbafa2e9f9411ca805bacaa7bb.tar.gz |
2009-06-22 Javier Miranda <miranda@adacore.com>
* sem_ch3.adb (Analyze_Object_Declaration, Freeze_Entity): Move to the
freezing point the check on the use of abstract types in object
declarations. Done to allow the declaration of C++ imported variables
or constants whose type corresponds with an imported C++ classes for
which the constructor is not imported.
2009-06-22 Thomas Quinot <quinot@adacore.com>
* sem_ch6.adb: Minor reformatting
2009-06-22 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb (Build_Initialization_Call): If a discriminated record
component is constrained with an expression rather than with a
discriminant of the enclosing type, use that expression when building
the call to default-initialize the component, when the call is part of
an aggregate with box initialization.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r-- | gcc/ada/freeze.adb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index e68086cdc98..5a7d0ef47de 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -2670,6 +2670,28 @@ package body Freeze is if Nkind (Declaration_Node (E)) = N_Object_Declaration then + -- Abstract type allowed only for C++ imported variables or + -- constants. + + -- Note: we inhibit this check for objects that do not come + -- from source because there is at least one case (the + -- expansion of x'class'input where x is abstract) where we + -- legitimately generate an abstract object. + + if Is_Abstract_Type (Etype (E)) + and then Comes_From_Source (Parent (E)) + and then not (Is_Imported (E) + and then Is_CPP_Class (Etype (E))) + then + Error_Msg_N ("type of object cannot be abstract", + Object_Definition (Parent (E))); + + if Is_CPP_Class (Etype (E)) then + Error_Msg_NE ("\} may need a cpp_constructor", + Object_Definition (Parent (E)), Etype (E)); + end if; + end if; + -- For object created by object declaration, perform required -- categorization (preelaborate and pure) checks. Defer these -- checks to freeze time since pragma Import inhibits default |