[PATCH] Fix parsing comma in default arguments.

Richard Smith richard at metafoo.co.uk
Thu Jun 13 17:40:25 PDT 2013


On Thu, Jun 13, 2013 at 5:12 PM, Olivier Goffart <ogoffart at kde.org> wrote:
> On Thursday 13 June 2013 16:30:22 Eli Friedman wrote:
>> > > > Also a template argument can contains = for example in this case:
>> > > >  struct S {constexpr S(){}; constexpr int operator=(int) const {return
>> > > >  5;}};
>> > > >  template <int> struct A {};
>> > > >  constexpr S s;
>> > > >  A<s=4> a;
>> > >
>> > > This is ill-formed.
>> >
>> > Why?
>> > the operator= is a constexpr
>>
>> It isn't a question of what operator= resolves to; the issue is that the
>> grammar doesn't allow an '=' in that spot.  See [gram.expr].
>
> Ah, right.
>
> But this would be valid:
>   A<false ? s=1 : s=4 > a;

Yes, it would.



More information about the cfe-commits mailing list