Index: flang/include/flang/Evaluate/tools.h =================================================================== --- flang/include/flang/Evaluate/tools.h +++ flang/include/flang/Evaluate/tools.h @@ -61,6 +61,9 @@ return (*this)(x.u); } } + template Result operator()(const TypeParamInquiry &x) const { + return (*this)(x.base()); + } }; template bool IsVariable(const A &x) { @@ -764,6 +767,9 @@ return (*this)(x.u); } } + template Result operator()(const TypeParamInquiry &x) const { + return (*this)(x.base()); + } }; template const Symbol *GetLastSymbol(const A &x) { @@ -835,6 +841,9 @@ Result operator()(const Component &) const; Result operator()(const ArrayRef &) const; Result operator()(const CoarrayRef &) const; + template Result operator()(const TypeParamInquiry &x) const { + return (*this)(x.base()); + } }; template SymbolVector GetSymbolVector(const A &x) { return GetSymbolVectorHelper{}(x); @@ -886,6 +895,9 @@ UnexpandabilityFindingVisitor() : Base{*this} {} template bool operator()(const FunctionRef &) { return true; } bool operator()(const CoarrayRef &) { return true; } + template bool operator()(const TypeParamInquiry &x) const { + return (*this)(x.base()); + } }; template bool IsExpandableScalar(const Expr &expr) { Index: flang/include/flang/Evaluate/traverse.h =================================================================== --- flang/include/flang/Evaluate/traverse.h +++ flang/include/flang/Evaluate/traverse.h @@ -120,9 +120,6 @@ return visitor_(x.GetFirstSymbol()); } } - template Result operator()(const TypeParamInquiry &x) const { - return visitor_(x.base()); - } Result operator()(const Triplet &x) const { return Combine(x.lower(), x.upper(), x.stride()); } @@ -280,6 +277,9 @@ return std::move(y); } } + template Result operator()(const TypeParamInquiry &x) const { + return (*this)(x.base()); + } private: Result default_{}; Index: flang/lib/Evaluate/check-expression.cpp =================================================================== --- flang/lib/Evaluate/check-expression.cpp +++ flang/lib/Evaluate/check-expression.cpp @@ -461,6 +461,10 @@ return false; } + template Result operator()(const TypeParamInquiry &x) const { + return (*this)(x.base()); + } + private: // If the subscripts can possibly be on a simply-contiguous array reference, // return the rank. Index: flang/lib/Evaluate/shape.cpp =================================================================== --- flang/lib/Evaluate/shape.cpp +++ flang/lib/Evaluate/shape.cpp @@ -191,6 +191,9 @@ static ExtentExpr Combine(Result &&, Result &&) { return Default(); } ExtentExpr operator()(const Symbol &); ExtentExpr operator()(const Component &); + template Result operator()(const TypeParamInquiry &x) const { + return (*this)(x.base()); + } private: FoldingContext &context_; Index: flang/lib/Evaluate/tools.cpp =================================================================== --- flang/lib/Evaluate/tools.cpp +++ flang/lib/Evaluate/tools.cpp @@ -730,6 +730,9 @@ characteristics::Procedure::Attr::NullPointer); } bool operator()(const NullPointer &) const { return true; } + template bool operator()(const TypeParamInquiry &x) const { + return (*this)(x.base()); + } }; bool IsNullPointer(const Expr &expr) { return IsNullPointerHelper{}(expr); @@ -782,6 +785,10 @@ semantics::SymbolSet operator()(const Symbol &symbol) const { return {symbol}; } + template + semantics::SymbolSet operator()(const TypeParamInquiry &x) const { + return (*this)(x.base()); + } }; template semantics::SymbolSet CollectSymbols(const A &x) { return CollectSymbolsHelper{}(x); Index: flang/lib/Semantics/check-data.cpp =================================================================== --- flang/lib/Semantics/check-data.cpp +++ flang/lib/Semantics/check-data.cpp @@ -139,6 +139,10 @@ "Data object variable must not be a function reference"_err_en_US); return false; } + template + bool operator()(const evaluate::TypeParamInquiry &x) const { + return (*this)(x.base()); + } void RestrictPointer() { isPointerAllowed_ = false; } private: Index: flang/lib/Semantics/check-do-forall.cpp =================================================================== --- flang/lib/Semantics/check-do-forall.cpp +++ flang/lib/Semantics/check-do-forall.cpp @@ -1037,6 +1037,11 @@ return Combine(ActualArgumentSet{arg}, CollectActualArgumentsHelper{}(arg.UnwrapExpr())); } + template + ActualArgumentSet operator()( + const evaluate::TypeParamInquiry &x) const { + return (*this)(x.base()); + } }; template ActualArgumentSet CollectActualArguments(const A &x) {