flang-compiler / flang

Flang is a Fortran language front-end designed for integration with LLVM.
Other
791 stars 135 forks source link

Flang admits instantiation of abstract derived types #873

Open difference-scheme opened 4 years ago

difference-scheme commented 4 years ago

My understanding of the Fortran standard is that the following code sample is invalid, and should thus be rejected by standard-conforming compilers. It isn't by flang.

program test

   type, abstract :: basic      
   end type basic

   type(basic) :: obj

end program test
kiranchandramohan commented 4 years ago

f18 also does not seem to catch this.

kiranchandramohan commented 4 years ago

I was wrong here since i was using an old build. f18 does catch this. abstra.f90:6:4: error: ABSTRACT derived type may not be used here type(basic) :: obj ^^^^^^^^^^^^^^^^^^ ./build/tools/f18/bin/f18: semantic errors in abstra.f90

mleair commented 4 years ago

See my comments for #874. This bug only occurs with empty abstract derived types. If the abstract type is non-empty, Flang issues an error message.