From 217519b1b4162e1d11f2820f6cef628a65d15be2 Mon Sep 17 00:00:00 2001 From: Mads Kiilerich Date: Sat, 9 Apr 2022 18:03:21 -0600 Subject: [PATCH] Put ostream operator<< for PresentationInfo in std namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix compilation error seen with gcc 12.0.1 on Fedora 36: In file included from ../libs/ardour/ardour/variant.h:30, from ../libs/ardour/ardour/parameter_descriptor.h:25, from ../libs/ardour/ardour/automation_control.h:39, from ../libs/ardour/ardour/amp.h:30, from ../libs/ardour/session.cc:61: ../libs/pbd/pbd/compose.h: In instantiation of ‘StringPrivate::Composition& StringPrivate::Composition::arg(const T&) [with T = ARDOUR::PresentationInfo]’: ../libs/pbd/pbd/compose.h:277:31: required from ‘std::string string_compose(const std::string&, const T1&, const T2&, const T3&, const T4&) [with T1 = std::__cxx11::basic_string; T2 = unsigned int; T3 = std::__cxx11::basic_string; T4 = ARDOUR::PresentationInfo; std::string = std::__cxx11::basic_string]’ ../libs/ardour/session.cc:3268:4: required from here ../libs/pbd/pbd/compose.h:122:20: error: no match for ‘operator<<’ (operand types are ‘std::ostringstream’ {aka ‘std::__cxx11::basic_ostringstream’} and ‘const ARDOUR::PresentationInfo’) 122 | os << obj; | ~~~^~~~~~ This might also fix a similar problem with clang, and https://github.com/Ardour/ardour/commit/5bbfac23808 can be backed out. --- libs/ardour/ardour/presentation_info.h | 2 ++ libs/ardour/presentation_info.cc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/presentation_info.h b/libs/ardour/ardour/presentation_info.h index 8e55ccee04..3949ef3787 100644 --- a/libs/ardour/ardour/presentation_info.h +++ b/libs/ardour/ardour/presentation_info.h @@ -294,6 +294,8 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful } +namespace std { std::ostream& operator<<(std::ostream& o, ARDOUR::PresentationInfo const& rid); +} #endif /* __libardour_presentation_info_h__ */ diff --git a/libs/ardour/presentation_info.cc b/libs/ardour/presentation_info.cc index 37d6e115f3..3d8a4ee271 100644 --- a/libs/ardour/presentation_info.cc +++ b/libs/ardour/presentation_info.cc @@ -318,7 +318,7 @@ PresentationInfo::operator= (PresentationInfo const& other) } std::ostream& -operator<<(std::ostream& o, ARDOUR::PresentationInfo const& pi) +std::operator<<(std::ostream& o, ARDOUR::PresentationInfo const& pi) { return o << pi.order() << '/' << enum_2_string (pi.flags()) << '/' << pi.color(); }