Re: git: 66edcb86f651 - 2024Q3 - devel/opentelemetry-cpp: fix build with clang 19

From: Sergey A. Osokin <osa_at_freebsd.org>
Date: Sun, 08 Sep 2024 21:07:56 UTC
Thank you, Dimitry.

On Sun, Sep 08, 2024 at 05:48:53PM +0000, Dimitry Andric wrote:
> The branch 2024Q3 has been updated by dim:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=66edcb86f65117393297fedb6a5e661f9e3db735
> 
> commit 66edcb86f65117393297fedb6a5e661f9e3db735
> Author:     Dimitry Andric <dim@FreeBSD.org>
> AuthorDate: 2024-09-08 09:20:21 +0000
> Commit:     Dimitry Andric <dim@FreeBSD.org>
> CommitDate: 2024-09-08 17:48:08 +0000
> 
>     devel/opentelemetry-cpp: fix build with clang 19
>     
>     Clang 19 now implements CWG 96 [1], which requires a template argument
>     list after a 'template' keyword, resulting in errors similar to:
>     
>         /wrkdirs/usr/ports/devel/opentelemetry-cpp/work/opentelemetry-cpp-1.16.1/api/include/opentelemetry/logs/logger_type_traits.h:169:69: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
>           169 |     return LogRecordSetterTrait<common::KeyValueIterable>::template Set(
>               |                                                                     ^
>         /wrkdirs/usr/ports/devel/opentelemetry-cpp/work/opentelemetry-cpp-1.16.1/api/include/opentelemetry/logs/logger.h:76:89: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
>            76 |         detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::template Set(
>               |                                                                                         ^
>         /wrkdirs/usr/ports/devel/opentelemetry-cpp/work/opentelemetry-cpp-1.16.1/api/include/opentelemetry/logs/event_logger.h:69:89: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
>            69 |         detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::template Set(
>               |                                                                                         ^
>     
>     In these cases, appending "<>" is enough to satisfy the constraint.
>     
>     PR:             281359
>     Approved by:    osa (maintainer)
>     MFH:            2024Q3
>     
>     (cherry picked from commit 676864fd474bdd6ec1d74496d0a58d9a5a046601)
> ---
>  .../patch-api_include_opentelemetry_logs_event__logger.h      | 11 +++++++++++
>  .../files/patch-api_include_opentelemetry_logs_logger.h       | 11 +++++++++++
>  ...atch-api_include_opentelemetry_logs_logger__type__traits.h | 11 +++++++++++
>  3 files changed, 33 insertions(+)
> 
> diff --git a/devel/opentelemetry-cpp/files/patch-api_include_opentelemetry_logs_event__logger.h b/devel/opentelemetry-cpp/files/patch-api_include_opentelemetry_logs_event__logger.h
> new file mode 100644
> index 000000000000..332f955f1bdf
> --- /dev/null
> +++ b/devel/opentelemetry-cpp/files/patch-api_include_opentelemetry_logs_event__logger.h
> @@ -0,0 +1,11 @@
> +--- api/include/opentelemetry/logs/event_logger.h.orig	2024-07-17 20:04:10 UTC
> ++++ api/include/opentelemetry/logs/event_logger.h
> +@@ -66,7 +66,7 @@ class EventLogger (public)
> +     nostd::unique_ptr<LogRecord> log_record = delegate_logger->CreateLogRecord();
> + 
> +     IgnoreTraitResult(
> +-        detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::template Set(
> ++        detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::template Set<>(
> +             log_record.get(), std::forward<ArgumentType>(args))...);
> + 
> +     EmitEvent(event_name, std::move(log_record));
> diff --git a/devel/opentelemetry-cpp/files/patch-api_include_opentelemetry_logs_logger.h b/devel/opentelemetry-cpp/files/patch-api_include_opentelemetry_logs_logger.h
> new file mode 100644
> index 000000000000..dc1c2541b51e
> --- /dev/null
> +++ b/devel/opentelemetry-cpp/files/patch-api_include_opentelemetry_logs_logger.h
> @@ -0,0 +1,11 @@
> +--- api/include/opentelemetry/logs/logger.h.orig	2024-07-17 20:04:10 UTC
> ++++ api/include/opentelemetry/logs/logger.h
> +@@ -73,7 +73,7 @@ class Logger (public)
> +     }
> + 
> +     IgnoreTraitResult(
> +-        detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::template Set(
> ++        detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::template Set<>(
> +             log_record.get(), std::forward<ArgumentType>(args))...);
> + 
> +     EmitLogRecord(std::move(log_record));
> diff --git a/devel/opentelemetry-cpp/files/patch-api_include_opentelemetry_logs_logger__type__traits.h b/devel/opentelemetry-cpp/files/patch-api_include_opentelemetry_logs_logger__type__traits.h
> new file mode 100644
> index 000000000000..46d4327274a5
> --- /dev/null
> +++ b/devel/opentelemetry-cpp/files/patch-api_include_opentelemetry_logs_logger__type__traits.h
> @@ -0,0 +1,11 @@
> +--- api/include/opentelemetry/logs/logger_type_traits.h.orig	2024-07-17 20:04:10 UTC
> ++++ api/include/opentelemetry/logs/logger_type_traits.h
> +@@ -166,7 +166,7 @@ struct LogRecordSetterTrait
> +                 * = nullptr>
> +   inline static LogRecord *Set(LogRecord *log_record, ArgumentType &&arg) noexcept
> +   {
> +-    return LogRecordSetterTrait<common::KeyValueIterable>::template Set(
> ++    return LogRecordSetterTrait<common::KeyValueIterable>::template Set<>(
> +         log_record, std::forward<ArgumentType>(arg));
> +   }
> +