open-telemetry / opentelemetry-cpp

The OpenTelemetry C++ Client
https://opentelemetry.io/
Apache License 2.0
890 stars 426 forks source link

Build error with clang-19 #3124

Closed veblush closed 2 weeks ago

veblush commented 2 weeks ago

Describe your environment

Build HEAD with clang-19

Steps to reproduce

Using the environment having clang-19 such as the docker image, silkeh/clang:19, build opentelemetry-cpp with cmake.

What is the expected behavior?

Built succesfully.

What is the actual behavior?

Clang 19 throws compilation errors as follows

opentelemetry-cpp/api/include/opentelemetry/logs/logger_type_traits.h:164:69: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  164 |     return LogRecordSetterTrait::template Set(
      |                                                                     ^

opentelemetry-cpp/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::type>::template Set(
      |                                                                                         ^

opentelemetry-cpp/api/include/opentelemetry/logs/event_logger.h:73:89: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
   73 |         detail::LogRecordSetterTrait::type>::template Set(
      |                                                                                         ^

Additional context

Clang-18 is able to build it so this is a new issue from clang-19. https://github.com/llvm/llvm-project/issues/94194 is the reference point about this issue. Note that missing-template-arg-list-after-template-kw is treated as an error by default.

veblush commented 2 weeks ago

@yashykt FYI