[flang-commits] [flang] 2aaa5a5 - [flang][msvc] Disambiguate injected class name.

Michael Kruse via flang-commits flang-commits at lists.llvm.org
Sat Aug 22 10:16:17 PDT 2020


Author: Michael Kruse
Date: 2020-08-22T12:16:10-05:00
New Revision: 2aaa5a546ea016b8e2092ced1bd7147db51d483a

URL: https://github.com/llvm/llvm-project/commit/2aaa5a546ea016b8e2092ced1bd7147db51d483a
DIFF: https://github.com/llvm/llvm-project/commit/2aaa5a546ea016b8e2092ced1bd7147db51d483a.diff

LOG: [flang][msvc] Disambiguate injected class name.

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

Added: 
    

Modified: 
    flang/include/flang/Evaluate/expression.h

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Evaluate/expression.h b/flang/include/flang/Evaluate/expression.h
index 3cb8dd688f76..fffd4645cc9f 100644
--- a/flang/include/flang/Evaluate/expression.h
+++ b/flang/include/flang/Evaluate/expression.h
@@ -745,7 +745,7 @@ class Expr<SomeKind<CAT>> : public ExpressionBase<SomeKind<CAT>> {
   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> {


        


More information about the flang-commits mailing list