[Development] Proposal: adding Q_DECL_NOEXCEPT to many methods

Thiago Macieira thiago.macieira at intel.com
Tue Aug 7 10:56:05 CEST 2012


On terça-feira, 7 de agosto de 2012 09.46.18, Marc Mutz wrote:
> On Friday August 3 2012, Thiago Macieira wrote:
> > On quinta-feira, 2 de agosto de 2012 23.57.58, Marc Mutz wrote:
> > > noexcept(std::declval<Object>().f()) should work.
> > 
> > error: invalid use of incomplete type ‘struct Object’
> 
> Of course the type needs to be complete. How would the compiler know
> anything about the exception specification of its functions if it wasn't?

Because I'm trying to get the exception specification of a sibling member 
function, in this same class. It looks to be impossible to do.

> You said that 'Object' in your case is the base class? So the type should be
> complete. Why isn't it?
> 
> /me confused

Ah, you're confusing the two examples. I want to get the noexcept status of a 
sibling function, available in this same class. In the example I came up with, 
it's just one class, no base class to rely on. That's showing what I consider 
to be a shortcoming in either the spec or in GCC's implementation.

In the real-world case, the function was actually in the base class, so I 
could have fixed it by using the dummy() hack. I chose instead to use a #define.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120807/642fc277/attachment.sig>


More information about the Development mailing list