On Fri, Jan 17, 2020 at 09:29:33AM +0100, Tobias Burnus wrote: > On 1/17/20 4:49 AM, Steve Kargl wrote: > > On Thu, Jan 16, 2020 at 11:34:43PM +0100, Thomas Koenig wrote: > >> +type(t) :: foo > >> +print *, foo(1)%a ! { dg-error "Function call can not contain a > >> reference" } > > I do not understand this error message, and find it to be confusing. > > foo(1)%a looks like an invalid array reference. That is, foo is scalar > > and foo(1) is an array element. > > Well, we simply do not know whether "external" or "dimension" has been > forgotten. As "external" can also be determined by the use, we end up > regarding it as function reference… > > Another example: > > character(len=4):: str > print *, str(1)(1:4) > end > > Maybe a more helpful error message is: "Unexpected junk after function > reference or missing dimension declaration for %s", sym->name) > > (Or instead of "junk" the fancier variant of my previous email.) >
Gfortran probably should not try to guess what the user thought s/he wanted. The generic "Syntax error" would seem to apply here. To me, foo(1)%a looks much more like an array reference rather than a function reference. -- Steve