diff options
author | Janus Weil <janus@gcc.gnu.org> | 2009-11-15 15:54:05 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2009-11-15 15:54:05 +0100 |
commit | bd09b73784558d04b6e897550043a8de776f42b1 (patch) | |
tree | dba3aa33fa9d8756b8c2f17e584103d18f2a26df /gcc | |
parent | 4b12152c8f4f0f9d2f6753d11d38b2a1ac5bf7f0 (diff) | |
download | gcc-bd09b73784558d04b6e897550043a8de776f42b1.zip gcc-bd09b73784558d04b6e897550043a8de776f42b1.tar.gz gcc-bd09b73784558d04b6e897550043a8de776f42b1.tar.bz2 |
re PR fortran/42048 ([F03] Erroneous syntax error message on TBP call)
2009-11-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/42048
* match.c (gfc_match_call): If we're inside a function with derived
type return value, allow calling a TBP of the result variable.
2009-11-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/42048
* gfortran.dg/typebound_call_11.f03: New test.
From-SVN: r154190
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/match.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/typebound_call_11.f03 | 40 |
4 files changed, 52 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6f1aadd..19e4a29 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2009-11-15 Janus Weil <janus@gcc.gnu.org> + + PR fortran/42048 + * match.c (gfc_match_call): If we're inside a function with derived + type return value, allow calling a TBP of the result variable. + 2009-11-12 Tobias Burnus <burnus@net-b.de> * intrinsic.texi (XOR): Refer also to .NEQV. diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 24e292b..13f68ab 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -2975,7 +2975,7 @@ gfc_match_call (void) /* If this is a variable of derived-type, it probably starts a type-bound procedure call. */ - if (sym->attr.flavor != FL_PROCEDURE + if ((sym->attr.flavor != FL_PROCEDURE || sym == gfc_current_ns->proc_name) && (sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS)) return match_typebound_call (st); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dacc1c1..3c5f5f0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-11-15 Janus Weil <janus@gcc.gnu.org> + + PR fortran/42048 + * gfortran.dg/typebound_call_11.f03: New test. + 2009-11-15 Hans-Peter Nilsson <hp@axis.com> * gcc.dg/lto/lto.exp: For non-lto, bail out before calling diff --git a/gcc/testsuite/gfortran.dg/typebound_call_11.f03 b/gcc/testsuite/gfortran.dg/typebound_call_11.f03 new file mode 100644 index 0000000..14f3232 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_call_11.f03 @@ -0,0 +1,40 @@ +! { dg-do compile } +! +! PR 42048: [F03] Erroneous syntax error message on TBP call +! +! Contributed by Damian Rouson <rouson@sandia.gov> + +module grid_module + implicit none + type grid + contains + procedure :: new_grid + end type +contains + subroutine new_grid(this) + class(grid) :: this + end subroutine +end module + +module field_module + use grid_module + implicit none + + type field + type(grid) :: mesh + end type + +contains + + type(field) function new_field() + call new_field%mesh%new_grid() + end function + + function new_field2() result(new) + type(field) :: new + call new%mesh%new_grid() + end function + +end module + +! { dg-final { cleanup-modules "grid_module field_module" } } |