https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62125
--- Comment #2 from mrestelli <mrestelli at gmail dot com> --- I can not say 100% that the code is correct, but at least reading 8.6 "The SELECT TYPE Construct" of "The Fortran 2003 Handbook" I don't see why it shouldn't. Notice that: among rules and restrictions, 1. says "The selector must be polymorphic." and then "In the block following a CLASS IS type guard, the associating entity is polymorphic and has the same declared type as the selector. The type parameter values are those of the declared type of the selector." So, after the type guard class is(t2) I understand that u is a polymorphic variable of type class(t2) which can be used as the selector of a nested select type construct. (Assuming the code is not legal, I would then claim that the error message is not very clear, since inside the SELECT TYPE construct the type of u is t2, not t1)
