Skip to content

Remove the BitSize helper template to fix -Wunused-template with clang 23 - #312

Merged
floitsch merged 1 commit into
google:masterfrom
rvandermeulen:bignum-unused-template
Sep 4, 2026
Merged

Remove the BitSize helper template to fix -Wunused-template with clang 23#312
floitsch merged 1 commit into
google:masterfrom
rvandermeulen:bignum-unused-template

Conversation

@rvandermeulen

Copy link
Copy Markdown
Contributor

BitSize in bignum.cc is only used inside DOUBLE_CONVERSION_ASSERT, so in builds where the assertion compiles to nothing it is an internal-linkage function template with no instantiations. clang 23.1.0 diagnoses that under -Wall:

double-conversion/bignum.cc:49:12: error: unused function template 'BitSize' [-Werror,-Wunused-template]

which breaks -Werror builds (seen building Firefox, which vendors double-conversion). The helper computes 8 * sizeof(value), so inline that into the single assertion and drop the template. Same spirit as #56 for Min/Max.

…g 23

BitSize was only used inside DOUBLE_CONVERSION_ASSERT, so in builds where the
assertion compiles to nothing it is an internal-linkage function template with
no instantiations. clang 23.1.0 diagnoses that under -Wall (-Wunused-template),
which breaks -Werror builds. Inline the trivial computation instead.

@floitsch floitsch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@floitsch
floitsch merged commit f501091 into google:master Sep 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants