[flang] Dodge bogus G++ 8.1.0 build warning

Original-commit: flang-compiler/f18@582c6d1eca
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
This commit is contained in:
peter klausler 2019-03-04 17:02:48 -08:00
parent da2ebb6063
commit 97038db10e

View file

@ -204,12 +204,11 @@ std::optional<DynamicType> ExpressionBase<A>::GetType() const {
return std::visit(
[](const auto &x) -> std::optional<DynamicType> {
using Ty = std::decay_t<decltype(x)>;
if constexpr (std::is_same_v<Ty, BOZLiteralConstant> ||
std::is_same_v<Ty, NullPointer>) {
return std::nullopt; // typeless really means "no type"
} else {
if constexpr (!std::is_same_v<Ty, BOZLiteralConstant> &&
!std::is_same_v<Ty, NullPointer>) {
return x.GetType();
}
return std::nullopt; // typeless really means "no type"
},
derived().u);
}