[flang-commits] [flang] 6e08ac8 - [flang][NFC] Add a no-arg constructor for `Verbatim`.
Jordan Rupprecht via flang-commits
flang-commits at lists.llvm.org
Mon Dec 5 07:30:37 PST 2022
Author: Samira Bazuzi
Date: 2022-12-05T07:30:30-08:00
New Revision: 6e08ac8dce919c7497876d36a04a05ffc52d0e93
URL: https://github.com/llvm/llvm-project/commit/6e08ac8dce919c7497876d36a04a05ffc52d0e93
DIFF: https://github.com/llvm/llvm-project/commit/6e08ac8dce919c7497876d36a04a05ffc52d0e93.diff
LOG: [flang][NFC] Add a no-arg constructor for `Verbatim`.
In C++20, types that declare or delete any constructors are no longer aggregates, breaking compilation of many existing uses of aggregate initialization.
Although `Verbatim` declares itself to not have a no-arg default constructor, this is circumvented in `basic-parsers.h` which returns a `RESULT{}` a.k.a. `Verbatim{}`. Adding the no-arg constructor while still deleting the copy/assignment constructors maintains the current state and also supports eventually building this in c++20 mode.
Fix suggested in https://discourse.llvm.org/t/build-failure-when-attempting-to-build-flang-with-c-20/66953.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D139228
Added:
Modified:
flang/include/flang/Parser/parse-tree.h
Removed:
################################################################################
diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 39156c63c7cfe..8d7a878bf86d0 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -270,7 +270,9 @@ using Location = const char *;
// A parse tree node with provenance only
struct Verbatim {
- BOILERPLATE(Verbatim);
+ // Allow a no-arg constructor for Verbatim so parsers can return `RESULT{}`.
+ constexpr Verbatim() {}
+ COPY_AND_ASSIGN_BOILERPLATE(Verbatim);
using EmptyTrait = std::true_type;
CharBlock source;
};
More information about the flang-commits
mailing list