Bug 280796

Summary: chinese/opencc: fix build with clang 19
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Some People CC: lichray
Priority: --- Flags: lichray: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 280562    
Attachments:
Description Flags
chinese/opencc: fix build with clang 19 none

Description Dimitry Andric freebsd_committer freebsd_triage 2024-08-13 12:12:10 UTC
Clang 19 now diagnoses incorrect member accesses, which causes
chinese/opencc to fail with an error similar to:

    /wrkdirs/usr/ports/chinese/opencc/work/OpenCC-ver.1.1.6/src/../deps/rapidjson-1.1.0/rapidjson/document.h:319:82: error: cannot assign to non-static data member 'length' with const-qualified type 'const SizeType' (aka 'const unsigned int')
      319 |     GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
          |                                                                           ~~~~~~ ^
    /wrkdirs/usr/ports/chinese/opencc/work/OpenCC-ver.1.1.6/src/../deps/rapidjson-1.1.0/rapidjson/document.h:325:20: note: non-static data member 'length' declared const here
      325 |     const SizeType length; //!< length of the string (excluding the trailing NULL terminator)
          |     ~~~~~~~~~~~~~~~^~~~~~

Upstream rapidjson fixed this by removing the operator= function in
https://github.com/Tencent/rapidjson/commit/3b2441b8, so pull this in as
a patch and apply it.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-08-13 12:13:35 UTC
Created attachment 252732 [details]
chinese/opencc: fix build with clang 19
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-08-16 15:40:20 UTC
A commit in branch main references this bug:

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

commit 438b693be17d522b4a9a6620b5848ae965937511
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-08-13 12:12:32 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-08-16 15:36:07 +0000

    chinese/opencc: fix build with clang 19

    Clang 19 now diagnoses incorrect member accesses, which causes
    chinese/opencc to fail with an error similar to:

        /wrkdirs/usr/ports/chinese/opencc/work/OpenCC-ver.1.1.6/src/../deps/rapidjson-1.1.0/rapidjson/document.h:319:82: error: cannot assign to non-static data member 'length' with const-qualified type 'const SizeType' (aka 'const unsigned int')
          319 |     GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
              |                                                                           ~~~~~~ ^
        /wrkdirs/usr/ports/chinese/opencc/work/OpenCC-ver.1.1.6/src/../deps/rapidjson-1.1.0/rapidjson/document.h:325:20: note: non-static data member 'length' declared const here
          325 |     const SizeType length; //!< length of the string (excluding the trailing NULL terminator)
              |     ~~~~~~~~~~~~~~~^~~~~~

    Upstream rapidjson fixed this by removing the operator= function in
    https://github.com/Tencent/rapidjson/commit/3b2441b8, so pull this in as
    a patch and apply it.

    PR:             280796
    Approved by:    lichray@gmail.com (maintainer)
    MFH:            2024Q3

 .../patch-deps_rapidjson-1.1.0_rapidjson_document.h (new)     | 11 +++++++++++
 1 file changed, 11 insertions(+)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-08-16 15:45:27 UTC
A commit in branch 2024Q3 references this bug:

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

commit 119f5ebf6044f8c5333e1e8e1671532dd057eb17
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-08-13 12:12:32 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-08-16 15:44:23 +0000

    chinese/opencc: fix build with clang 19

    Clang 19 now diagnoses incorrect member accesses, which causes
    chinese/opencc to fail with an error similar to:

        /wrkdirs/usr/ports/chinese/opencc/work/OpenCC-ver.1.1.6/src/../deps/rapidjson-1.1.0/rapidjson/document.h:319:82: error: cannot assign to non-static data member 'length' with const-qualified type 'const SizeType' (aka 'const unsigned int')
          319 |     GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
              |                                                                           ~~~~~~ ^
        /wrkdirs/usr/ports/chinese/opencc/work/OpenCC-ver.1.1.6/src/../deps/rapidjson-1.1.0/rapidjson/document.h:325:20: note: non-static data member 'length' declared const here
          325 |     const SizeType length; //!< length of the string (excluding the trailing NULL terminator)
              |     ~~~~~~~~~~~~~~~^~~~~~

    Upstream rapidjson fixed this by removing the operator= function in
    https://github.com/Tencent/rapidjson/commit/3b2441b8, so pull this in as
    a patch and apply it.

    PR:             280796
    Approved by:    lichray@gmail.com (maintainer)
    MFH:            2024Q3

    (cherry picked from commit 438b693be17d522b4a9a6620b5848ae965937511)

 .../patch-deps_rapidjson-1.1.0_rapidjson_document.h (new)     | 11 +++++++++++
 1 file changed, 11 insertions(+)