aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/abstract_type_3.f03
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gfortran.dg/abstract_type_3.f03
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/abstract_type_3.f03')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.dg/abstract_type_3.f0351
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/abstract_type_3.f03 b/gcc-4.9/gcc/testsuite/gfortran.dg/abstract_type_3.f03
new file mode 100644
index 000000000..e7a9d9b63
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.dg/abstract_type_3.f03
@@ -0,0 +1,51 @@
+! { dg-do compile }
+
+! Abstract Types.
+! Check for errors when using abstract types in an inappropriate way.
+
+MODULE m
+ USE ISO_C_BINDING
+ IMPLICIT NONE
+
+ TYPE, ABSTRACT, BIND(C) :: bindc_t ! { dg-error "must not be ABSTRACT" }
+ INTEGER(C_INT) :: x
+ END TYPE bindc_t
+
+ TYPE, ABSTRACT :: sequence_t ! { dg-error "must not be ABSTRACT" }
+ SEQUENCE
+ INTEGER :: x
+ END TYPE sequence_t
+
+ TYPE, ABSTRACT :: abst_t
+ INTEGER :: x = 0
+ END TYPE abst_t
+
+ TYPE, EXTENDS(abst_t) :: concrete_t
+ INTEGER :: y = 1
+ END TYPE concrete_t
+
+ TYPE :: myt
+ TYPE(abst_t) :: comp ! { dg-error "is of the ABSTRACT type 'abst_t'" }
+ END TYPE myt
+
+ ! This should be ok.
+ TYPE, ABSTRACT, EXTENDS(concrete_t) :: again_abst_t
+ INTEGER :: z = 2
+ END TYPE again_abst_t
+
+CONTAINS
+
+ TYPE(abst_t) FUNCTION func () ! { dg-error "of the ABSTRACT type 'abst_t'" }
+ END FUNCTION func
+
+ SUBROUTINE sub (arg) ! { dg-error "is of the ABSTRACT type 'again_abst_t'" }
+ IMPLICIT NONE
+ TYPE(again_abst_t) :: arg
+ arg = again_abst_t () ! { dg-error "Can't construct ABSTRACT type 'again_abst_t'" }
+ END SUBROUTINE sub
+
+ SUBROUTINE impl ()
+ IMPLICIT TYPE(abst_t) (a-z) ! { dg-error "ABSTRACT type 'abst_t' used" }
+ END SUBROUTINE impl
+
+END MODULE m