]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
proc_ptr_24.f90: New test.
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 23 Aug 2009 04:58:31 +0000 (04:58 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 23 Aug 2009 04:58:31 +0000 (04:58 +0000)
2009-08-22  Steven G. Kargl  <kargl@gcc.gnu.org>

* gfortran.dg/proc_ptr_24.f90: New test.

2009-08-22  Steven G. Kargl  <kargl@gcc.gnu.org>

* fortran/decl.c: Disallow procedure pointers with -std=f95.

From-SVN: r151026

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/proc_ptr_24.f90 [new file with mode: 0644]

index 4869fe82fb99ca1e70f737e8244a737c6aee8f32..d6d6a9119f736625cfc3fa2e2c1a56e4b38358b8 100644 (file)
@@ -1,3 +1,7 @@
+2009-08-22  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       * fortran/decl.c: Disallow procedure pointers with -std=f95.
+
 2009-08-22 Steven K. kargl  <kargl@gcc.gnu.org>
 
        * fortran/decl.c (match_char_spec): Rename to gfc_match_char_spec,
index 1533af54eaa85e77267a5dc35ea686ac60fcd559..40622e2e93f0b87fe6ad524ab9af34ea3228b8da 100644 (file)
@@ -4449,6 +4449,10 @@ match_ppc_decl (void)
       return MATCH_ERROR;
     }
 
+  if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Procedure pointer "
+                     "component at %C") == FAILURE)
+    return MATCH_ERROR;
+
   /* Match PPC names.  */
   ts = current_ts;
   for(num=1;;num++)
index 2c8997d15ce0906d88bdcd7d599d53aafc94784f..db8a19598171b6ff1524c0f40b36b8cd5d1d4894 100644 (file)
@@ -1,3 +1,7 @@
+2009-08-22  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       * gfortran.dg/proc_ptr_24.f90: New test.
+
 2009-08-22 Steven K. kargl  <kargl@gcc.gnu.org>
 
        * gfortran.dg/allocate_alloc_opt_4.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_24.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_24.f90
new file mode 100644 (file)
index 0000000..6bd4709
--- /dev/null
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! { dg-options -std=f95 }
+!
+! Code was posted to comp.lang.fortran by Richard Maine.
+! http://groups.google.com/group/comp.lang.fortran/browse_frm/thread/fff9b3426211c018#
+!
+module m
+  type :: foo
+    real, pointer :: array(:)
+    procedure (), pointer, nopass :: f ! { dg-error "Procedure pointer component" }
+  end type
+contains
+    elemental subroutine fooAssgn (a1, a2)
+        type(foo), intent(out) :: a1
+        type(foo), intent(in) :: a2
+        allocate (a1%array(size(a2%array)))
+
+        a1%array = a2%array
+        a1%f => a2%f         ! { dg-error "not a member of the" }
+    end subroutine
+end module m