[flang-commits] [PATCH] D115735: [flang] Make f18 build with GCC 11.2.0 and with --std=c++20

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Mar 24 10:45:26 PDT 2022


Meinersbur accepted this revision.
Meinersbur added a comment.

Sorry for the long wait. msvc successfully compiles this with CMAKE_CXX_STANDARD set to 20 (which cmake translates to `/std:c++20`).

LGTM



================
Comment at: flang/CMakeLists.txt:6-7
+# Flang requires C++17 or later.
 set(CMAKE_CXX_STANDARD 17)
+#set(CMAKE_CXX_STANDARD 20) # also works
 set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
----------------
[suggestion] `CMAKE_CXX_STANDARD` is set by the user, so this will just overwrite it even if the user set it to `CMAKE_CXX_STANDARD=20`. Why not just check that the value is at least 17 and if not, override it with a warning like lined 117ff?


================
Comment at: flang/CMakeLists.txt:120
     message("LLVM configuration set a C++ standard: ${LLVM_CXX_STD}")
-    if (NOT LLVM_CXX_STD EQUAL "c++17")
+    if (NOT LLVM_CXX_STD STREQUAL "c++${CMAKE_CXX_STANDARD}")
       message("Flang: Overriding LLVM's 'cxx_std' setting...")
----------------
mvsc's option is `/std:...` (see https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=msvc-170), so the `string(REPLACE -std= ...)` will not work.  

`LLVM_CXX_STD` has been removed in rG2724d9e12960cc1d93eeabbfc9aa1bffffa041cc, so this code will never trigger anyway. 


================
Comment at: flang/lib/Lower/ConvertExpr.cpp:3732-3733
     // `array_access` Op in the continuation.
-    return [=](IterSpace iters) -> ExtValue {
+    return [this, arrLd, arrLdTypeParams, arrTy, components, extMemref, loc,
+            slice](IterSpace iters) -> ExtValue {
       mlir::Type eleTy = fir::applyPathToType(arrTy, iters.iterVec());
----------------
mvcs complains about `arrLoad` missing here, probably a result of changes this this patch.


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

https://reviews.llvm.org/D115735



More information about the flang-commits mailing list