Fix printer.h compile error in -std=c++2b (#12870)

Closes #12869

Closes #12870

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12870 from lukeocamden:patch-1 28bd987181
PiperOrigin-RevId: 534717297
pull/12891/head
lukeocamden 2 years ago committed by Copybara-Service
parent 033c764145
commit 3b6b996ba2
  1. 6
      src/google/protobuf/io/printer.cc
  2. 5
      src/google/protobuf/io/printer.h

@ -277,6 +277,8 @@ Printer::Format Printer::TokenizeFormat(absl::string_view format_string,
constexpr absl::string_view Printer::kProtocCodegenTrace;
Printer::Printer(ZeroCopyOutputStream* output) : Printer(output, Options{}) {}
Printer::Printer(ZeroCopyOutputStream* output, Options options)
: sink_(output), options_(options) {
if (!options_.enable_codegen_trace.has_value()) {
@ -289,6 +291,10 @@ Printer::Printer(ZeroCopyOutputStream* output, Options options)
}
}
Printer::Printer(ZeroCopyOutputStream* output, char variable_delimiter,
AnnotationCollector* annotation_collector)
: Printer(output, Options{variable_delimiter, annotation_collector}) {}
absl::string_view Printer::LookupVar(absl::string_view var) {
auto result = LookupInFrameStack(var, absl::MakeSpan(var_lookups_));
ABSL_CHECK(result.has_value()) << "could not find " << var;

@ -518,7 +518,7 @@ class PROTOBUF_EXPORT Printer {
// Constructs a new Printer with the default options to output to
// `output`.
explicit Printer(ZeroCopyOutputStream* output) : Printer(output, Options{}) {}
explicit Printer(ZeroCopyOutputStream* output);
// Constructs a new printer with the given set of options to output to
// `output`.
@ -528,8 +528,7 @@ class PROTOBUF_EXPORT Printer {
//
// Will eventually be marked as deprecated.
Printer(ZeroCopyOutputStream* output, char variable_delimiter,
AnnotationCollector* annotation_collector = nullptr)
: Printer(output, Options{variable_delimiter, annotation_collector}) {}
AnnotationCollector* annotation_collector = nullptr);
Printer(const Printer&) = delete;
Printer& operator=(const Printer&) = delete;

Loading…
Cancel
Save