Boost logo

Proto :

Subject: Re: [proto] Proto v5
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2013-06-16 14:59:03


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.

Regards,

-- 
Agustín K-ballo Bergé.-
http://talesofcpp.fusionfenix.com



Proto list run by eric at boostpro.com