[Development] C++20 ctor-level [[nodiscard]] (was: Re: C++20 @ Qt)

Thiago Macieira thiago.macieira at intel.com
Fri Jun 16 20:25:38 CEST 2023


On Friday, 16 June 2023 11:05:30 PDT Giuseppe D'Angelo via Development wrote:
> On 16/06/2023 18:00, Thiago Macieira wrote:
> > On Friday, 16 June 2023 01:06:33 PDT Stephen Kelly wrote:
> >> Make sure you're not hitting
> >> 
> >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96117
> > 
> > We are indeed hitting that. But there's nothing we can currently do about
> > it.
> Why can't we turn Q_DECL_EXPORT to [[gnu::visibility("default")]] to
> work around the bug?

Marc to comment, but I don't think it solves the MSVC problem we're also 
hitting, which means that adding no_discard to classes is still a problem. 
Therefore, there's no point in changing our Q_DECL_EXPORT.

We'd also need to change *all* our __attributes__, not just the visibility 
ones, and we still risk breaking users' code that have __attributes__ in their 
classes and especially functions but use Q_DECL_EXPORT.

Think of declarations like:

[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const 
char16_t *str) noexcept;


-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230616/d8eb8ca6/attachment.bin>


More information about the Development mailing list