[flang][msvc] Disambiguate injected class name.
authorMichael Kruse <llvm-project@meinersbur.de>
Sat, 22 Aug 2020 17:05:17 +0000 (12:05 -0500)
committerMichael Kruse <llvm-project@meinersbur.de>
Sat, 22 Aug 2020 17:16:10 +0000 (12:16 -0500)
The identifier `Expr` within the scope of the Expr class (including its temple specializations) refers to the current template/instantiation (see https://en.cppreference.com/w/cpp/language/injected-class-name for details). The `MapTemplate` template expect a non-instantiated template as the first template argument, not the concrete instantiation of `Expr`.

At least msvc interprets `Expr` as the injected class name, whereas gcc and clang use the global `flang::evaluate::Expr` template. Disambiguate by explicitly using the namespace.

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

Reviewed By: DavidTruby

Differential Revision: https://reviews.llvm.org/D85646

flang/include/flang/Evaluate/expression.h

index 3cb8dd6..fffd464 100644 (file)
@@ -745,7 +745,7 @@ public:
   using Result = SomeKind<CAT>;
   EVALUATE_UNION_CLASS_BOILERPLATE(Expr)
   int GetKind() const;
-  common::MapTemplate<Expr, CategoryTypes<CAT>> u;
+  common::MapTemplate<evaluate::Expr, CategoryTypes<CAT>> u;
 };
 
 template <> class Expr<SomeCharacter> : public ExpressionBase<SomeCharacter> {