[flang][msvc] Work around if constexpr (false) evaluation. NFC.
authorMichael Kruse <llvm-project@meinersbur.de>
Wed, 16 Sep 2020 19:58:29 +0000 (14:58 -0500)
committerMichael Kruse <llvm-project@meinersbur.de>
Wed, 16 Sep 2020 20:01:39 +0000 (15:01 -0500)
commitdee4686227842aa0e8380c7925049a5df9c4f781
tree01331625673c8441054873d67bf1433de6902c6d
parent7af4f44c3e3dfb4483fb4dcc200f9376e96d6208
 [flang][msvc] Work around if constexpr (false) evaluation. NFC.

MSVC tries to expand templates that are in the false-branch of a `if constexpr` construct. In this case, the condition checks whether a tuple has at least one element and then is trying to access it using `std::get<0>`, which fails when the tuple has 0 elements.

The workaround is to extract that case into a separate method.

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/D87728
flang/lib/Parser/basic-parsers.h