1! { dg-do compile }
2! { dg-options "-std=f95" }
3!
4! PR fortran/34438
5!
6! Check that error is not issued for local, non-module
7! variables.
8!
9! Contributed by Sven Buijssen
10!
11module demo
12  implicit none
13  private
14  type myint
15    integer :: bar = 42
16  end type myint
17  public :: func
18contains
19  subroutine func()
20    type(myint) :: foo
21  end subroutine func
22end module demo
23
24module demo2
25  implicit none
26  private
27  type myint
28    integer :: bar = 42
29  end type myint
30  type(myint), save :: foo2 ! { dg-error "of PRIVATE derived type" }
31  public :: foo2
32end module demo2
33