[flang-commits] [flang] ad95c8d - [flang][MSVC] Take 2 on a work-around for bogus MSVC error
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Sun Oct 30 13:32:35 PDT 2022
Author: Peter Klausler
Date: 2022-10-30T13:32:24-07:00
New Revision: ad95c8d8d2cf17dee5023088884aa6480803b6f5
URL: https://github.com/llvm/llvm-project/commit/ad95c8d8d2cf17dee5023088884aa6480803b6f5
DIFF: https://github.com/llvm/llvm-project/commit/ad95c8d8d2cf17dee5023088884aa6480803b6f5.diff
LOG: [flang][MSVC] Take 2 on a work-around for bogus MSVC error
Previous attempt to work around a bogus error from MSVC 14 on
code from a recent patch failed, so add an #ifdef and disable
the feature for MSVC builds to get the build bot back up.
Added:
Modified:
flang/lib/Evaluate/fold-integer.cpp
Removed:
################################################################################
diff --git a/flang/lib/Evaluate/fold-integer.cpp b/flang/lib/Evaluate/fold-integer.cpp
index f72a5a06ca1a..bc4bd3b19ea2 100644
--- a/flang/lib/Evaluate/fold-integer.cpp
+++ b/flang/lib/Evaluate/fold-integer.cpp
@@ -611,15 +611,25 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldIntrinsicFunction(
} else {
return common::visit(
[&funcRef, &context, &FromInt64](const auto &str) -> Expr<T> {
- using CharTy = typename std::decay_t<decltype(str)>::Result;
- constexpr int charKind{CharTy::kind};
- using MSVCWorkaround = Type<TypeCategory::Character, charKind>;
- return FoldElementalIntrinsic<T, MSVCWorkaround>(context,
+ using Char = typename std::decay_t<decltype(str)>::Result;
+ return FoldElementalIntrinsic<T, Char>(context,
std::move(funcRef),
- ScalarFunc<T, MSVCWorkaround>(
- [&FromInt64](const Scalar<MSVCWorkaround> &c) {
- return FromInt64(CharacterUtils<charKind>::ICHAR(c));
+ ScalarFunc<T, Char>(
+#ifndef _MSC_VER
+ [&FromInt64](const Scalar<Char> &c) {
+ return FromInt64(CharacterUtils<Char::kind>::ICHAR(c));
}));
+#else // _MSC_VER
+ // MSVC 14 get confused by the original code above and
+ // ends up emitting an error about passing a std::string
+ // to the std::u16string instantiation of
+ // CharacterUtils<2>::ICHAR(). Can't find a work-around,
+ // so remove the FromInt64 error checking lambda that
+ // seems to have caused the proble.
+ [](const Scalar<Char> &c) {
+ return CharacterUtils<Char::kind>::ICHAR(c);
+ }));
+#endif // _MSC_VER
},
someChar->u);
}
More information about the flang-commits
mailing list