access_spec_2.f90

来自「用于进行gcc测试」· F90 代码 · 共 41 行

F90
41
字号
! { dg-do compile }! { dg-options "-std=f95" }! PR fortran/31472! Access specifications: Invalid Fortran 95 codemodule test  implicit none  integer, public :: x  public :: x  ! { dg-error "was already specified" }  private :: x ! { dg-error "was already specified" }end module testmodule mod  implicit none  private  type, public :: bar    PRIVATE    integer, public :: y  ! { dg-error "Fortran 2003: Attribute PUBLIC" }    integer, public :: z  ! { dg-error "Fortran 2003: Attribute PUBLIC" }  end type ! { dg-error "Derived type definition at" }contains  subroutine foo     integer :: x     private :: x ! { dg-error "only allowed in the specification part of a module" }     type, private :: t ! { dg-error "only be PRIVATE in the specification part of a module" }        integer :: z     end type t ! { dg-error "Expecting END SUBROUTINE statement" }     type :: ttt        integer,public :: z ! { dg-error "not allowed outside of the specification part of a module" }     end type ttt ! { dg-error "Derived type definition at" }  end subroutineend moduleprogram x  implicit none  integer :: i  public  :: i ! { dg-error "only allowed in the specification part of a module" }  integer,public :: j ! { dg-error "not allowed outside of the specification part of a module" }end program x! { dg-final { cleanup-modules "test mod" } }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?