|
Proto : |
Subject: Re: [proto] Proto v5
From: Eric Niebler (eric_at_[hidden])
Date: 2013-06-17 20:20:54
On 6/16/2013 11:59 AM, Agustín K-ballo Bergé wrote:
> On 15/06/2013 10:59 p.m., Eric Niebler wrote:
>>> >- Some specific uses of Proto actions in constant expressions fail. GCC
>>> >reports an ambiguity with ref-qualifiers in the following scenario:
>>> >
>>> > struct foo
>>> > {
>>> > int& bar() &
>>> > { return _bar; }
>>> > //~ int&& bar() &&
>>> > //~ { return static_cast<int&&>(_bar); }
>>> > constexpr int const& bar() const &
>>> > { return _bar; }
>>> > constexpr int const&& bar() const &&
>>> > { return static_cast<int const&&>(_bar); }
>>> >
>>> > int _bar;
>>> > };
>>> >
>>> > foo().bar();
>>> >
>>> > For that to work correctly, the 4 overloads need to be provided.
>> Huh. According to the standard, or according to gcc? I won't work around
>> a bug in a compiler without filing it first.
>>
>
> I got a thorough explanation on the subject from this SO question:
> http://stackoverflow.com/questions/17130607/overload-resolution-with-ref-qualifiers
> . The answer confirms this is a GCC bug, and hints to a "better
> workaround" that would retain constexpr functionality. I may pursue this
> alternative workaround if I ever get to play with the constexpr side of
> Proto v5 (that is, if I use it in a place other than next to an `omg` or
> `srsly` identifier :P).
>
> Another GCC bug (as far as I understand) is that instantiations within
> template arguments to a template alias are completely ignored when the
> aliased type does not depend on those, thus breaking SFINAE rules. I
> have attached a small code sample that reproduces this issue.
Thanks for your research. When I get a chance, I'll check gcc's bugzilla
to see if they have been filed already, unless you beat me to it.
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Proto list run by eric at boostpro.com