Skip to content

std.optional.pointee not synthesized on newer MSVC STL releases #68068

Closed
@compnerd

Description

@compnerd

It seems that the std-optional test is failing as pointee is not synthesized. Taking a look at the std::optional implementation, it appears that we have the following structure:

struct S {
  constexpr void *& operator*() & noexcept;
  constexpr const void *& operator*() const & noexcept;
  constexpr void *&& operator*() && noexcept;
  constexpr const void *&& operator*() const && noexcept;
};

struct T: private S {
  using S::operator*;
};

I suspect that the use of using S::operator* is resulting in the decl not being visited as a CXXMethodDecl and subsequently we do not find the accessor.

From swift-ide-test -print-module -module-to-print=SR68068 -source-filename SR68068.swift -enable-experimental-cxx-interop:

struct S {
  init()
  var pointee: UnsafeRawPointer? { get nonmutating set }
  @available(*, unavailable, message: "use .pointee property")
  mutating func __operatorStar() -> UnsafeMutablePointer<UnsafeMutableRawPointer?>
  @available(*, unavailable, message: "use .pointee property")
  func __operatorStar() -> UnsafeMutablePointer<UnsafeRawPointer?>
  @available(*, unavailable, message: "use .pointee property")
  mutating func __operatorStar() -> UnsafeMutablePointer<UnsafeMutableRawPointer?>
  @available(*, unavailable, message: "use .pointee property")
  func __operatorStar() -> UnsafeMutablePointer<UnsafeRawPointer?>
}
struct T {
  init()
}

This results in the pointee member not being available.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions