You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[flang] Improve USE merging of homonymous types, interfaces, and proc… (#79364)
…edures
Fortran allows a generic interface to have the same name as a derived
type in the same scope. It also allows a generic interface to have the
same name as one of its specific procedures.
When two modules define the same name, possibly more than once each,
things get exciting. The standard is not clear, and other compilers do
variously different things. We are currently emitting some errors
prematurely for some usage in pfUnit due to how it combines two versions
of a package together via USE association.
This patch handles combinations of derived types and generic interfaces
and their specific procedures in a more principled way. Errors due to
ambiguity are deferred to actual usage of derived types and specific
procedures -- and when they're not used, the program is unambiguous and
no error issues.
Copy file name to clipboardExpand all lines: flang/test/Semantics/resolve18.f90
+100-8Lines changed: 100 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -229,10 +229,10 @@ function foo(x)
229
229
230
230
subroutinetest15
231
231
use m15a
232
-
!ERROR: Cannot use-associate generic interface 'foo' with specific procedure of the same name when another such interface and procedure are in scope
233
-
use m15b
232
+
use m15b ! ok
234
233
end
235
234
235
+
236
236
module m16a
237
237
typefoo
238
238
integer j
@@ -259,18 +259,110 @@ function bar(x,y)
259
259
260
260
subroutinetest16
261
261
use m16a
262
-
!ERROR: Generic interface 'foo' has ambiguous derived types from modules 'm16a' and 'm16b'
263
-
use m16b
262
+
use m16b ! ok
264
263
end
265
264
266
265
subroutinetest17
267
266
use m15a
268
-
!ERROR: Cannot use-associate generic interface 'foo' with derived type of the same name when another such interface and procedure are in scope
269
-
use m16a
267
+
use m16a ! ok
270
268
end
271
269
272
270
subroutinetest18
273
271
use m16a
274
-
!ERROR: Cannot use-associate generic interface 'foo' with specific procedure of the same name when another such interface and derived type are in scope
0 commit comments