Boost logo

Proto :

Subject: Re: [proto] Proto v5
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2013-06-15 18:40:02


On 15/06/2013 03:43 a.m., Agustín K-ballo Bergé wrote:
> On 14/06/2013 11:06 p.m., Eric Niebler wrote:
>>
>> (Sorry for the top-posting. I'm away from my computer.)
>>
>> The repository *is* compilable, if your compiler is clang built from
>> trunk. I suspect there are bugs in Proto, gcc, and clang, and sorting
>> it all out will be fun.
>>
>> Thanks for your patch. I'll apply it as soon as I can.
>>
>> Eric
>
> That's the green light I was expecting to start picking Proto v5 at GCC.
> I just got the first test compiling and passing successfully
> (action.cpp). I have pushed all the changes to my fork of the
> repository, so if you are interested keep an eye on it.
>
> Even after disabling the substitution_failure machinery (to get the full
> instantiation spew), going through the compiler output is mind
> bending... My respects to you, sir!
>
>>

The fork of Proto v5 at https://github.com/K-ballo/proto-0x correctly
compiles and passes (almost*) all test cases and examples with GCC
4.8.1. There are two caveats:

- GCC does not allow the use of `this` within noexcept specifications,
so those are disabled. This is a bug in GCC (reported by Dave Abrahams
here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869)

- 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.
This, in turn, means that non-const rvalues (?) cannot be used in
constant expressions since constexpr implies const (in C++11, not
anymore in C++14). Anyway, this is more than I can digest at the moment.

(*) the bit failing to compile is a use of Proto actions as a constant
expression [the `omg` case at everywhere.cpp], due to the issue with
ref-qualifier overloads.

Regards,

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

Proto list run by eric at boostpro.com