diff options
author | Janus Weil <janus@gcc.gnu.org> | 2009-08-31 21:08:03 +0200 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2009-08-31 21:08:03 +0200 |
commit | e74f1cc83c20eff2e1d0f9b3363075a1d7fd6a78 (patch) | |
tree | e381e09a17810c8b05f37fdbd76ea44cf8c23cb2 /gcc/fortran/decl.c | |
parent | e2abde5f35ace69607e6664daa9765f50635ad1d (diff) | |
download | gcc-e74f1cc83c20eff2e1d0f9b3363075a1d7fd6a78.zip gcc-e74f1cc83c20eff2e1d0f9b3363075a1d7fd6a78.tar.gz gcc-e74f1cc83c20eff2e1d0f9b3363075a1d7fd6a78.tar.bz2 |
re PR fortran/40940 ([F03] CLASS statement)
2009-08-31 Janus Weil <janus@gcc.gnu.org>
Paul Thomas <pault@gcc.gnu.org>
PR fortran/40940
* array.c (gfc_match_array_constructor): Rename gfc_match_type_spec.
* decl.c (gfc_match_type_spec): Rename to gfc_match_decl_type_spec,
and reject CLASS with -std=f95.
(gfc_match_implicit, gfc_match_data_decl,gfc_match_prefix,
match_procedure_interface): Rename gfc_match_type_spec.
* gfortran.h (gfc_type_compatible): Add prototype.
* match.h (gfc_match_type_spec): Rename to gfc_match_decl_type_spec.
* match.c (match_intrinsic_typespec): Rename to match_type_spec, and
add handling of derived types.
(gfc_match_allocate): Rename match_intrinsic_typespec and check
type compatibility of derived types.
* symbol.c (gfc_type_compatible): New function to check if two types
are compatible.
2009-08-31 Janus Weil <janus@gcc.gnu.org>
PR fortran/40940
* gfortran.dg/allocate_derived_1.f90: New.
* gfortran.dg/class_3.f03: New.
Co-Authored-By: Paul Thomas <pault@gcc.gnu.org>
From-SVN: r151244
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 40622e2..52796a6 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2267,8 +2267,8 @@ done: } -/* Matches a type specification. If successful, sets the ts structure - to the matched specification. This is necessary for FUNCTION and +/* Matches a declaration-type-spec (F03:R502). If successful, sets the ts + structure to the matched specification. This is necessary for FUNCTION and IMPLICIT statements. If implicit_flag is nonzero, then we don't check for the optional @@ -2276,7 +2276,7 @@ done: statement correctly. */ match -gfc_match_type_spec (gfc_typespec *ts, int implicit_flag) +gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) { char name[GFC_MAX_SYMBOL_LEN + 1]; gfc_symbol *sym; @@ -2377,6 +2377,10 @@ gfc_match_type_spec (gfc_typespec *ts, int implicit_flag) return m; ts->is_class = 1; + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: CLASS statement at %C") + == FAILURE) + return MATCH_ERROR; + /* TODO: Implement Polymorphism. */ gfc_warning ("Polymorphic entities are not yet implemented. " "CLASS will be treated like TYPE at %C"); @@ -2599,7 +2603,7 @@ gfc_match_implicit (void) gfc_clear_new_implicit (); /* A basic type is mandatory here. */ - m = gfc_match_type_spec (&ts, 1); + m = gfc_match_decl_type_spec (&ts, 1); if (m == MATCH_ERROR) goto error; if (m == MATCH_NO) @@ -3675,7 +3679,7 @@ gfc_match_data_decl (void) num_idents_on_line = 0; - m = gfc_match_type_spec (¤t_ts, 0); + m = gfc_match_decl_type_spec (¤t_ts, 0); if (m != MATCH_YES) return m; @@ -3780,7 +3784,7 @@ gfc_match_prefix (gfc_typespec *ts) loop: if (!seen_type && ts != NULL - && gfc_match_type_spec (ts, 0) == MATCH_YES + && gfc_match_decl_type_spec (ts, 0) == MATCH_YES && gfc_match_space () == MATCH_YES) { @@ -4178,7 +4182,7 @@ match_procedure_interface (gfc_symbol **proc_if) /* Get the type spec. for the procedure interface. */ old_loc = gfc_current_locus; - m = gfc_match_type_spec (¤t_ts, 0); + m = gfc_match_decl_type_spec (¤t_ts, 0); gfc_gobble_whitespace (); if (m == MATCH_YES || (m == MATCH_NO && gfc_peek_ascii_char () == ')')) goto got_ts; |