[all-commits] [llvm/llvm-project] 239189: [libc++] Disable mistakenly enabled `optional<T&>`...

William Tran-Viet via All-commits all-commits at lists.llvm.org
Wed Apr 29 03:16:06 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 239189ca28847aa4797368827107c22c32080509
      https://github.com/llvm/llvm-project/commit/239189ca28847aa4797368827107c22c32080509
  Author: William Tran-Viet <wtranviet at proton.me>
  Date:   2026-04-29 (Wed, 29 Apr 2026)

  Changed paths:
    M libcxx/include/optional
    M libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/const_optional_U.pass.cpp
    M libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/optional_U.pass.cpp
    M libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/ref_constructs_from_temporary.verify.cpp
    M libcxx/test/std/utilities/optional/optional.object/optional_helper_types.h

  Log Message:
  -----------
  [libc++] Disable mistakenly enabled `optional<T&>` constructors for `optional<T>` (#194446)

Resolves #194415 

- A constructor specifically meant for `optional<T&>` was left enabled
for `optional<T>`
- Fix it, and add a test to check for regression.
- This patch also corrects the constraints for `optional(optional<U>&)`
and `optional(const optional<U>&)` , as they were incorrectly
disallowing [valid conversions](https://godbolt.org/z/1r5Ea7z5M)
- Also, correct the `noexcept` specification.
- Add tests for both corrections.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list