summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/default_initialization_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/default_initialization_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/default_initialization_1.f9021
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/default_initialization_1.f90 b/gcc/testsuite/gfortran.dg/default_initialization_1.f90
new file mode 100644
index 000000000..b03b698f5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/default_initialization_1.f90
@@ -0,0 +1,21 @@
+!
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+! PR 20845; for F2008: PR fortran/43185
+!
+! In ISO/IEC 1539-1:1997(E), 4th constraint in section 11.3:
+!
+! If an object of a type for which component-initialization is specified
+! (R429) appears in the specification-part of a module and does not have
+! the ALLOCATABLE or POINTER attribute, the object shall have the SAVE
+! attribute.
+!
+module bad
+ implicit none
+ type default_initialization
+ integer :: x = 42
+ end type default_initialization
+ type (default_initialization) t ! { dg-error "default initialization" }
+end module bad
+
+! { dg-final { cleanup-modules "bad" } }