Bug 293446 - devel/catch: fix build with clang 21
Summary: devel/catch: fix build with clang 21
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 292067
  Show dependency treegraph
 
Reported: 2026-02-25 19:20 UTC by Dimitry Andric
Modified: 2026-03-09 18:05 UTC (History)
0 users

See Also:
sunpoet: maintainer-feedback+


Attachments
devel/catch: fix build with clang 21 (6.91 KB, patch)
2026-02-25 19:21 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2026-02-25 19:20:44 UTC
With clang 21 devel/catch fails to build, with errors similar to:

    /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_stringref.h:95:32: error: identifier '_sr' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
       95 |     constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {
          |                    ~~~~~~~~~~~~^~~
          |                    operator""_sr
    /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_stringref.h:100:28: error: identifier '_catch_sr' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
      100 | constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef {
          |                ~~~~~~~~~~~~^~~~~~~~~
          |                operator""_catch_sr
    /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/IntrospectiveTests/String.tests.cpp:144:33: error: identifier '_sr' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
      144 |         using Catch::operator"" _sr;
          |                      ~~~~~~~~~~~^~~
          |                      operator""_sr

and later:

    /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/ToStringVariant.tests.cpp:13:14: error: function 'operator=' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
       13 |     MyType1& operator=(MyType1 const&) { throw 3; }
          |              ^
    /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/ToStringVariant.tests.cpp:18:14: error: function 'operator=' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
       18 |     MyType2& operator=(MyType2 const&) { throw 4; }
          |              ^

The former can be fixed by removing the space between the identifier and
the double quotes, the latter by declaring the functions with
[[noreturn]].
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2026-02-25 19:21:43 UTC
Created attachment 268355 [details]
devel/catch: fix build with clang 21
Comment 2 Po-Chuan Hsieh freebsd_committer freebsd_triage 2026-03-09 18:05:55 UTC
LGTM. Please name the patch file as patch-clang21. Thanks.