Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Oct 2024 01:44:32 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 282437] Latest clang upgrade causes a new C++ failure: no member named 'construct' in 'optional<type-parameter-0-0 &>' (port cad/librepcb)
Message-ID:  <bug-282437-29464-4yS7PjqCuv@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-282437-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-282437-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D282437

Mark Millard <marklmi26-fbsd@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marklmi26-fbsd@yahoo.com

--- Comment #1 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
When I look at the patched code I find lines
1555 .. 2044 (spanning 1989 where the error is reported):

/// Specialization for when `T` is a reference. `optional<T&>` acts similar=
ly
/// to a `T*`, but provides more operations and shows intent more clearly.
template <class T> class optional<T &> {
public:
. . . (no declaration or definition of construct) . . .
  /// Copy constructor
  ///
  /// If `rhs` contains a value, the stored value is direct-initialized with
  /// it. Otherwise, the constructed optional is empty.
  /// Constructs the value in-place, destroying the current one if there is
  /// one.
  template <class... Args> T &emplace(Args &&... args) noexcept {
    static_assert(std::is_constructible<T, Args &&...>::value,
                  "T must be constructible with Args");

    *this =3D nullopt;
    this->construct(std::forward<Args>(args)...);
    return value();
  }
. . . (no declaration or definition of construct) . . .
}

Note the lack of any base class, so no base class based
methods are present. Note also the lack of a definition
for construct.

The only definition of construct that I find is in:

// This base class provides some handy member functions which can be used in
// further derived classes
template <class T> struct optional_operations_base : optional_storage_base<=
T> {
  using optional_storage_base<T>::optional_storage_base;

  void hard_reset() noexcept {
    get().~T();
    this->m_has_value =3D false;
  }

  template <class... Args> void construct(Args &&... args) noexcept {
    new (std::addressof(this->m_value)) T(std::forward<Args>(args)...);
    this->m_has_value =3D true;
  }
. . .

that is not involved in the code at 1989 as far as I can tell.
For reference:

# grep -r "construct\>.*noexcept" /wrkdirs/usr/ports/cad/librepcb/work/ | m=
ore
/wrkdirs/usr/ports/cad/librepcb/work/librepcb-1.1.0/libs/optional/tl/option=
al.hpp:
 template <class... Args> void construct(Args &&... args) noexcept {

So: It appears to be the only example overall, not just in
the one file.

As far as I can tell, the error report looks correct for the
patched code that I looked at.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-282437-29464-4yS7PjqCuv>