Peter Klausler 1fa9ef620b [flang] Consolidate and enhance pointer assignment checks
Consolidate aspects of pointer assignment & structure constructor pointer component
checking from Semantics/assignment.cpp and /expression.cpp into /pointer-assignment.cpp,
and add a warning about data targets that are not definable objects
but not hard errors.  Specifically, a structure component pointer component data
target is not allowed to be a USE-associated object in a pure context by a numbered
constraint, but the right-hand side data target of a pointer assignment statement
has no such constraint, and that's the new warning.

Differential Revision: https://reviews.llvm.org/D146581
2023-03-27 16:19:54 -07:00

8 lines
288 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Can't associate a pointer with a substring of a character literal
program main
character(:), pointer :: cp
!ERROR: Target associated with pointer 'cp' must be a designator or a call to a pointer-valued function
cp => "abcd"(1:4)
end