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

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Sep 30 18:54:20 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb656189e6a60: [flang][msvc] Avoid ReferenceVariantBase ctor ambiguity. NFC. (authored by Meinersbur).

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.295453.patch
Type: text/x-patch
Size: 2342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20201001/65ee1652/attachment-0001.bin>


More information about the flang-commits mailing list