Skip to content

Commit 5e2e85c

Browse files
committed
do not use static assert(false)
1 parent 0fd7b90 commit 5e2e85c

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

ortools/port/proto_utils.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ std::string ProtobufDebugString(const P& message) {
3636
} else if constexpr (std::is_base_of_v<google::protobuf::MessageLite, P>) {
3737
return std::string(message.GetTypeName());
3838
} else {
39-
static_assert(false, "Unsupported type");
39+
LOG(FATAL) << "Unsupported type";
40+
return "";
4041
}
4142
}
4243

@@ -52,7 +53,8 @@ std::string ProtobufShortDebugString(const P& message) {
5253
} else if constexpr (std::is_base_of_v<google::protobuf::MessageLite, P>) {
5354
return std::string(message.GetTypeName());
5455
} else {
55-
static_assert(false, "Unsupported type");
56+
LOG(FATAL) << "Unsupported type";
57+
return "";
5658
}
5759
}
5860

@@ -82,7 +84,8 @@ bool ProtobufTextFormatMergeFromString(absl::string_view proto_text_string,
8284
ProtoType>) {
8385
return false;
8486
} else {
85-
static_assert(false, "Unsupported type");
87+
LOG(FATAL) << "Unsupported type";
88+
return false;
8689
}
8790
}
8891

@@ -112,7 +115,8 @@ bool ProtobufParseTextProtoForFlag(absl::string_view text,
112115
"do not support parsing text protos)";
113116
return false;
114117
} else {
115-
static_assert(false, "Unsupported type");
118+
LOG(FATAL) << "Unsupported type";
119+
return false;
116120
}
117121
}
118122

0 commit comments

Comments
 (0)