@@ -4646,23 +4646,23 @@ bool DeclarationVisitor::Pre(const parser::OldParameterStmt &x) {
4646
4646
bool DeclarationVisitor::Pre (const parser::NamedConstantDef &x) {
4647
4647
auto &name{std::get<parser::NamedConstant>(x.t ).v };
4648
4648
auto &symbol{HandleAttributeStmt (Attr::PARAMETER, name)};
4649
- if (!ConvertToObjectEntity (symbol) ||
4650
- symbol.test (Symbol::Flag::CrayPointer) ||
4649
+ ConvertToObjectEntity (symbol);
4650
+ auto *details{symbol.detailsIf <ObjectEntityDetails>()};
4651
+ if (!details || symbol.test (Symbol::Flag::CrayPointer) ||
4651
4652
symbol.test (Symbol::Flag::CrayPointee)) {
4652
4653
SayWithDecl (
4653
4654
name, symbol, " PARAMETER attribute not allowed on '%s'" _err_en_US);
4654
4655
return false ;
4655
4656
}
4656
4657
const auto &expr{std::get<parser::ConstantExpr>(x.t )};
4657
- auto &details{symbol.get <ObjectEntityDetails>()};
4658
- if (details.init () || symbol.test (Symbol::Flag::InDataStmt)) {
4658
+ if (details->init () || symbol.test (Symbol::Flag::InDataStmt)) {
4659
4659
Say (name, " Named constant '%s' already has a value" _err_en_US);
4660
4660
}
4661
4661
if (inOldStyleParameterStmt_) {
4662
4662
// non-standard extension PARAMETER statement (no parentheses)
4663
4663
Walk (expr);
4664
4664
auto folded{EvaluateExpr (expr)};
4665
- if (details. type ()) {
4665
+ if (details-> type ()) {
4666
4666
SayWithDecl (name, symbol,
4667
4667
" Alternative style PARAMETER '%s' must not already have an explicit type" _err_en_US);
4668
4668
} else if (folded) {
@@ -4674,9 +4674,9 @@ bool DeclarationVisitor::Pre(const parser::NamedConstantDef &x) {
4674
4674
} else if (auto shape{ToArraySpec (
4675
4675
GetFoldingContext (), evaluate::GetShape (*folded))}) {
4676
4676
// The type of the named constant is assumed from the expression.
4677
- details. set_type (*type);
4678
- details. set_init (std::move (*folded));
4679
- details. set_shape (std::move (*shape));
4677
+ details-> set_type (*type);
4678
+ details-> set_init (std::move (*folded));
4679
+ details-> set_shape (std::move (*shape));
4680
4680
} else {
4681
4681
Say (at, " The expression must have constant shape" _err_en_US);
4682
4682
}
@@ -4693,7 +4693,7 @@ bool DeclarationVisitor::Pre(const parser::NamedConstantDef &x) {
4693
4693
Walk (expr);
4694
4694
if (auto converted{EvaluateNonPointerInitializer (
4695
4695
symbol, expr, expr.thing .value ().source )}) {
4696
- details. set_init (std::move (*converted));
4696
+ details-> set_init (std::move (*converted));
4697
4697
}
4698
4698
}
4699
4699
return false ;
0 commit comments