[flang] Use local name for structure constructor (#132047)
When reinterpreting an ambiguously parsed function reference as a structure constructor, use the original symbol of the type in the representation of the derived type spec of the structure constructor, not its ultimate resolution. The distinction turns out to matter when generating module files containing derived type constants as initializers when the derived types' names have undergone USE association renaming. Fixes https://github.com/llvm/llvm-project/issues/131579.
This commit is contained in:
@@ -3268,7 +3268,7 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::FunctionReference &funcRef,
|
||||
const auto &designator{std::get<parser::ProcedureDesignator>(call.t)};
|
||||
if (const auto *name{std::get_if<parser::Name>(&designator.u)}) {
|
||||
semantics::Scope &scope{context_.FindScope(name->source)};
|
||||
semantics::DerivedTypeSpec dtSpec{name->source, symbol.GetUltimate()};
|
||||
semantics::DerivedTypeSpec dtSpec{name->source, symbol};
|
||||
if (!CheckIsValidForwardReference(dtSpec)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user