Subject: Re: [boost] C++11 Metaprogramming
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-04-05 07:58:32


On 04/03/2012 10:26 PM, Pyry Jahkola wrote:

> Yep, same thing on clang: as soon as I enable noexcept in the
> RETURNS(...) macro, it gives "error: invalid use of 'this' outside of a
> nonstatic member function".
>
>> // ****** workaround ******
>> static mul_ get() noexcept { return mul_(); }
>
> I'm not sure which one is correct here, GCC or Clang, but but this trick
> had a similar result: "error: calling 'get' with incomplete return type
> 'mul_'".
>
> The only alternative way I could fix it was to define a function
> returning a reference

Could it be that the compiler forces instantiation of the code inside
noexcept, like earlier MSVC versions did with decltype?

Not sure what the standard says about this.