Skip to content

Commit b31ee8e

Browse files
authored
[mlir] Use default RemarkOpts constructor for c++20 compat (#154887)
Using the default constructor makes this header work in both c++17 and c++20 codebases. Without this, a c++20 codebase will break like this: ```c++ external/llvm-project/mlir/include/mlir/IR/Remarks.h:66:12: error: no matching constructor for initialization of 'RemarkOpts' 66 | return RemarkOpts{n, {}, {}, {}}; | ^ ~~~~~~~~~~~~~~~ external/llvm-project/mlir/include/mlir/IR/Remarks.h:58:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 4 were provided 58 | struct RemarkOpts { | ^~~~~~~~~~ external/llvm-project/mlir/include/mlir/IR/Remarks.h:58:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 4 were provided 58 | struct RemarkOpts { | ^~~~~~~~~~ external/llvm-project/mlir/include/mlir/IR/Remarks.h:63:3: note: candidate constructor not viable: requires 0 arguments, but 4 were provided 63 | RemarkOpts() = delete; | ^ external/llvm-project/mlir/include/mlir/IR/Remarks.h:65:31: error: constexpr function's return type 'RemarkOpts' is not a literal type 65 | static constexpr RemarkOpts name(StringRef n) { | ^ external/llvm-project/mlir/include/mlir/IR/Remarks.h:58:8: note: 'RemarkOpts' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors 58 | struct RemarkOpts { | ^ ```
1 parent ee7826b commit b31ee8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mlir/include/mlir/IR/Remarks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct RemarkOpts {
6060
StringRef categoryName; // Category name (subject to regex filtering)
6161
StringRef subCategoryName; // Subcategory name
6262
StringRef functionName; // Function name if available
63-
RemarkOpts() = delete;
63+
6464
// Construct RemarkOpts from a remark name.
6565
static constexpr RemarkOpts name(StringRef n) {
6666
return RemarkOpts{n, {}, {}, {}};

0 commit comments

Comments
 (0)