[flang][msvc] Workaround 'forgotten' symbols in FoldOperation. NFC.
authorMichael Kruse <llvm-project@meinersbur.de>
Thu, 1 Oct 2020 01:55:44 +0000 (20:55 -0500)
committerMichael Kruse <llvm-project@meinersbur.de>
Thu, 1 Oct 2020 02:28:34 +0000 (21:28 -0500)
commitd4a1db4f3fd7ce701454127465dd0ddbdb7face2
tree84f2abbed0ef3e156f07233ccd7dde16479e5e34
parent6cd8511e5932e4a53b2bb7780f69489355fc7783
[flang][msvc] Workaround 'forgotten' symbols in FoldOperation. NFC.

This resolves an issue where the Microsoft compiler 'forgets' symbols when using constexpr in a lambda in a templated function. The symbols are:

1. The implicit lambda captures `context` and `convert`. Fix by making them explicit captures. The error message was:
```
fold-implementation.h(1220): error C2065: 'convert': undeclared identifier
```

2. The function template argument FROMCAT. Fix by storing it in a temporary constexpr variable inside the function. The error message was:
```
fold-implementation.h(1216): error C2065: 'FROMCAT': undeclared identifier
```

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D88504
flang/lib/Evaluate/fold-implementation.h