summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r--gcc/testsuite/gfortran.dg/generic_32.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/generic_33.f9027
2 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/generic_32.f90 b/gcc/testsuite/gfortran.dg/generic_32.f90
new file mode 100644
index 00000000000..61e8a2ab123
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/generic_32.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+!
+! PR 45521: [F08] GENERIC resolution with ALLOCATABLE/POINTER and PROCEDURE
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+
+ INTERFACE gen
+ SUBROUTINE suba(a) ! { dg-error "Ambiguous interfaces" }
+ REAL,ALLOCATABLE :: a(:)
+ END SUBROUTINE
+ SUBROUTINE subp(p) ! { dg-error "Ambiguous interfaces" }
+ REAL,POINTER,INTENT(IN) :: p(:)
+ END SUBROUTINE
+ END INTERFACE
+end
diff --git a/gcc/testsuite/gfortran.dg/generic_33.f90 b/gcc/testsuite/gfortran.dg/generic_33.f90
new file mode 100644
index 00000000000..540d73b23f0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/generic_33.f90
@@ -0,0 +1,27 @@
+! { dg-do compile }
+!
+! PR 45521: [F08] GENERIC resolution with ALLOCATABLE/POINTER and PROCEDURE
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+ type :: t
+ end type
+
+ interface test
+ procedure testAlloc
+ procedure testPtr
+ end interface
+
+contains
+
+ logical function testAlloc(obj)
+ class(t), allocatable :: obj
+ testAlloc = .true.
+ end function
+
+ logical function testPtr(obj)
+ class(t), pointer :: obj
+ testPtr = .false.
+ end function
+
+end