[PATCH] D88109: [flang][msvc] Avoid ReferenceVariantBase ctor ambiguity. NFC.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 18:50:29 PDT 2020


Meinersbur updated this revision to Diff 295452.
Meinersbur added a comment.

- Compile fix (forgotten rename)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88109/new/

https://reviews.llvm.org/D88109

Files:
  flang/include/flang/Lower/PFTBuilder.h
  flang/lib/Lower/PFTBuilder.cpp


Index: flang/lib/Lower/PFTBuilder.cpp
===================================================================
--- flang/lib/Lower/PFTBuilder.cpp
+++ flang/lib/Lower/PFTBuilder.cpp
@@ -64,8 +64,11 @@
 class PFTBuilder {
 public:
   PFTBuilder(const semantics::SemanticsContext &semanticsContext)
-      : pgm{std::make_unique<lower::pft::Program>()},
-        parentVariantStack{*pgm.get()}, semanticsContext{semanticsContext} {}
+      : pgm{std::make_unique<lower::pft::Program>()}, semanticsContext{
+                                                          semanticsContext} {
+    lower::pft::ParentVariant parent{*pgm.get()};
+    parentVariantStack.push_back(parent);
+  }
 
   /// Get the result
   std::unique_ptr<lower::pft::Program> result() { return std::move(pgm); }
@@ -905,11 +908,15 @@
 template <typename A, typename T>
 static lower::pft::FunctionLikeUnit::FunctionStatement
 getFunctionStmt(const T &func) {
-  return std::get<parser::Statement<A>>(func.t);
+  lower::pft::FunctionLikeUnit::FunctionStatement result{
+      std::get<parser::Statement<A>>(func.t)};
+  return result;
 }
 template <typename A, typename T>
 static lower::pft::ModuleLikeUnit::ModuleStatement getModuleStmt(const T &mod) {
-  return std::get<parser::Statement<A>>(mod.t);
+  lower::pft::ModuleLikeUnit::ModuleStatement result{
+      std::get<parser::Statement<A>>(mod.t)};
+  return result;
 }
 
 static const semantics::Symbol *getSymbol(
@@ -1078,7 +1085,8 @@
   const auto &ps{
       std::get<std::optional<parser::Statement<parser::ProgramStmt>>>(func.t)};
   if (ps.has_value()) {
-    beginStmt = ps.value();
+    FunctionStatement begin{ps.value()};
+    beginStmt = begin;
     symbol = getSymbol(beginStmt);
     processSymbolTable(*symbol->scope());
   } else {
Index: flang/include/flang/Lower/PFTBuilder.h
===================================================================
--- flang/include/flang/Lower/PFTBuilder.h
+++ flang/include/flang/Lower/PFTBuilder.h
@@ -55,8 +55,9 @@
   using Ref = common::Reference<BaseType<B>>;
 
   ReferenceVariantBase() = delete;
-  template <typename B>
-  ReferenceVariantBase(B &b) : u{Ref<B>{b}} {}
+  ReferenceVariantBase(std::variant<Ref<A>...> b) : u(b) {}
+  template <typename T>
+  ReferenceVariantBase(Ref<T> b) : u(b) {}
 
   template <typename B>
   constexpr BaseType<B> &get() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88109.295452.patch
Type: text/x-patch
Size: 2342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201001/14f5bf01/attachment.bin>


More information about the llvm-commits mailing list