[PATCH] Fix parsing comma in default arguments.

Olivier Goffart ogoffart at kde.org
Thu Jun 13 17:12:09 PDT 2013


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;

-- 
Olivier



More information about the cfe-commits mailing list