Landing: ca3810f00133

Project / Subsystem

gcc / c++

Date

2026-07-13

Author

Joyee Cheung

Commit

ca3810f001338bb4d15da43160e017d453f234e8

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
commit_hash
ca3810f001338bb4d15da43160e017d453f234e8
source_type
github
headline
Fix C++ enum conversion with fixed bool underlying type.
tldr
C++ enum conversion now correctly handles fixed `bool` underlying types per C++ standard.
author
Joyee Cheung
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • c++
  • language compliance
discussion_id_link
bugzilla_pr
date
2026-07-13T00:00:00.000Z

A bug in GCC’s C++ type conversion has been fixed, resolving incorrect behavior when casting to an enum with a bool underlying type. The C++ standard requires that such operands first be converted to the underlying type (bool in this case) and then to the enum. Previously, GCC would directly convert to the enum type, which for bool underlying types truncated to a single bit, causing values like 2 to be misinterpreted as false. This patch ensures the conversion follows the standard by going through the bool type, correctly handling truth values and integrating with existing boolean warning diagnostics.