Re: error with d28016d16e9a (change to jsonencode.cc)

Carlo De Falco <[email protected]> Thu, 1 Oct 2020 17:41:23 +0000
Newsgroups gmane.comp.gnu.octave.maintainers
Message-ID <[email protected]>

> Il giorno 1 ott 2020, alle ore 19:24, Rik <[email protected]> ha scritto:
> 
> In one sense, this is easy to resolve.  Instead of using the keyword "auto" just specify the exact type of the underlying variable.  However, the compiler really should be able to handle this construct.  Could you try 'g++ --version'?  And is it really GNU g++ or is this a soft link to clang?

Isn't this a C++14 feature?

the following simple example compiles for me with std=c++14 or std=c++17 but fails with std=c++11 or std=gnu++11 :

int main ()
{
  auto f = [] (auto x) { return x + 1; };
  f (1.0);
}


$ clang++ -std=gnu++11 pippo.cc -o pippo
pippo.cc:3:16: error: 'auto' not allowed in lambda parameter
  auto f = [] (auto x) { return x + 1; };
               ^~~~
1 error generated.

> --Rik

c.