1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! C801 The same attr-spec shall not appear more than once in a given
3 ! type-declaration-stmt.
5 ! R801 type-declaration-stmt ->
6 ! declaration-type-spec [[, attr-spec]... ::] entity-decl-list
7 ! attr-spec values are:
8 ! PUBLIC, PRIVATE, ALLOCATABLE, ASYNCHRONOUS, CODIMENSION, CONTIGUOUS,
9 ! DIMENSION (array-spec), EXTERNAL, INTENT (intent-spec), INTRINSIC,
10 ! BIND(C), OPTIONAL, PARAMETER, POINTER, PROTECTED, SAVE, TARGET, VALUE,
14 !WARNING: Attribute 'PUBLIC' cannot be used more than once
15 real, public
, allocatable
, public
:: publicVar
16 !WARNING: Attribute 'PRIVATE' cannot be used more than once
17 real, private
, allocatable
, private
:: privateVar
18 !WARNING: Attribute 'ALLOCATABLE' cannot be used more than once
19 real, allocatable
, allocatable
:: allocVar
20 !WARNING: Attribute 'ASYNCHRONOUS' cannot be used more than once
21 real, asynchronous
, public
, asynchronous
:: asynchVar
22 !ERROR: Attribute 'CODIMENSION' cannot be used more than once
23 real, codimension
[*], codimension
[*] :: codimensionVar
24 !WARNING: Attribute 'CONTIGUOUS' cannot be used more than once
25 real, contiguous
, pointer, contiguous
:: contigVar(:)
26 !ERROR: Attribute 'DIMENSION' cannot be used more than once
27 real, dimension(5), dimension(5) :: arrayVar
28 !WARNING: Attribute 'EXTERNAL' cannot be used more than once
29 real, external, external :: externFunc
30 !WARNING: Attribute 'INTRINSIC' cannot be used more than once
31 real, intrinsic, bind(c
), intrinsic :: cos
32 !WARNING: Attribute 'BIND(C)' cannot be used more than once
33 integer, bind(c
), volatile, bind(c
) :: bindVar
34 !WARNING: Attribute 'PARAMETER' cannot be used more than once
35 real, parameter, parameter :: realConst
= 4.3
36 !WARNING: Attribute 'POINTER' cannot be used more than once
37 real, pointer, pointer :: realPtr
38 !WARNING: Attribute 'PROTECTED' cannot be used more than once
39 real, protected
, protected
:: realProt
40 !WARNING: Attribute 'SAVE' cannot be used more than once
41 real, save, save :: saveVar
42 !WARNING: Attribute 'TARGET' cannot be used more than once
43 real, target
, target
:: targetVar
44 !WARNING: Attribute 'VOLATILE' cannot be used more than once
45 real, volatile, volatile :: volatileVar
48 subroutine testTypeDecl(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
)
49 !WARNING: Attribute 'INTENT(IN)' cannot be used more than once
50 real, intent(in
), intent(in
) :: arg1
51 !WARNING: Attribute 'INTENT(OUT)' cannot be used more than once
52 real, intent(out
), intent(out
) :: arg2
53 !WARNING: Attribute 'INTENT(INOUT)' cannot be used more than once
54 real, intent(inout
), intent(inout
) :: arg3
55 !WARNING: Attribute 'OPTIONAL' cannot be used more than once
56 integer, optional
, intent(in
), optional
:: arg4
57 !WARNING: Attribute 'VALUE' cannot be used more than once
58 integer, value
, intent(in
), value
:: arg5
59 !ERROR: Attributes 'INTENT(IN)' and 'INTENT(INOUT)' conflict with each other
60 integer, intent(in
), pointer, intent(inout
) :: arg6
63 end subroutine testTypeDecl