Bug 293446 - devel/catch: fix build with clang 21
Summary: devel/catch: fix build with clang 21
Status: Closed FIXED
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 tree / graph
 
Reported: 2026-02-25 19:20 UTC by Dimitry Andric
Modified: 2026-03-13 08:53 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.
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-03-13 08:34:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a080335cdc0d1c38ab913096650e4b0cbcd9454e

commit a080335cdc0d1c38ab913096650e4b0cbcd9454e
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-02-25 19:21:07 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-03-13 08:33:17 +0000

    devel/catch: fix build with clang 21

    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]].

    PR:             293446
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2026Q1

 .../patch-include_internal_catch__approx.cpp (new)      | 15 +++++++++++++++
 .../files/patch-include_internal_catch__approx.h (new)  | 13 +++++++++++++
 .../patch-include_internal_catch__stringref.h (new)     | 17 +++++++++++++++++
 ...s_SelfTest_IntrospectiveTests_String.tests.cpp (new) | 11 +++++++++++
 ..._SelfTest_UsageTests_ToStringVariant.tests.cpp (new) | 17 +++++++++++++++++
 5 files changed, 73 insertions(+)
Comment 4 commit-hook freebsd_committer freebsd_triage 2026-03-13 08:35:41 UTC
A commit in branch 2026Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d92ebd379aa5c7098ce4ba2aab8ca7fd2f8f3657

commit d92ebd379aa5c7098ce4ba2aab8ca7fd2f8f3657
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-02-25 19:21:07 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-03-13 08:34:37 +0000

    devel/catch: fix build with clang 21

    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]].

    PR:             293446
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2026Q1

    (cherry picked from commit a080335cdc0d1c38ab913096650e4b0cbcd9454e)

 .../patch-include_internal_catch__approx.cpp (new)      | 15 +++++++++++++++
 .../files/patch-include_internal_catch__approx.h (new)  | 13 +++++++++++++
 .../patch-include_internal_catch__stringref.h (new)     | 17 +++++++++++++++++
 ...s_SelfTest_IntrospectiveTests_String.tests.cpp (new) | 11 +++++++++++
 ..._SelfTest_UsageTests_ToStringVariant.tests.cpp (new) | 17 +++++++++++++++++
 5 files changed, 73 insertions(+)
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2026-03-13 08:45:44 UTC
Sorry, I committed this while in a workflow where I had to commit another dozen bugs that had a maintainer timeout. I'll gather up the patches in to patch-clang21 and then re-commit with the correct message!
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-03-13 08:50:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9c2cb42fd6cfda42888e61feb6e287661125edcc

commit 9c2cb42fd6cfda42888e61feb6e287661125edcc
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-03-13 08:48:39 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-03-13 08:49:55 +0000

    devel/catch: fix build with clang 21, take 2

    Move the separate patches into patch-clang21, as requested by the
    maintainer.

    PR:             293446
    Approved by:    sunpoet (maintainer)
    MFH:            2026Q1

 devel/catch/files/patch-clang21 (new)              | 73 ++++++++++++++++++++++
 ...patch-include_internal_catch__approx.cpp (gone) | 15 -----
 .../patch-include_internal_catch__approx.h (gone)  | 13 ----
 ...atch-include_internal_catch__stringref.h (gone) | 17 -----
 ...Test_IntrospectiveTests_String.tests.cpp (gone) | 11 ----
 ...est_UsageTests_ToStringVariant.tests.cpp (gone) | 17 -----
 6 files changed, 73 insertions(+), 73 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-03-13 08:51:44 UTC
A commit in branch 2026Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a35bcf1c6849d1d3c5979f936eac77a54e6f44f7

commit a35bcf1c6849d1d3c5979f936eac77a54e6f44f7
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-03-13 08:48:39 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-03-13 08:51:21 +0000

    devel/catch: fix build with clang 21, take 2

    Move the separate patches into patch-clang21, as requested by the
    maintainer.

    PR:             293446
    Approved by:    sunpoet (maintainer)
    MFH:            2026Q1

    (cherry picked from commit 9c2cb42fd6cfda42888e61feb6e287661125edcc)

 devel/catch/files/patch-clang21 (new)              | 73 ++++++++++++++++++++++
 ...patch-include_internal_catch__approx.cpp (gone) | 15 -----
 .../patch-include_internal_catch__approx.h (gone)  | 13 ----
 ...atch-include_internal_catch__stringref.h (gone) | 17 -----
 ...Test_IntrospectiveTests_String.tests.cpp (gone) | 11 ----
 ...est_UsageTests_ToStringVariant.tests.cpp (gone) | 17 -----
 6 files changed, 73 insertions(+), 73 deletions(-)