davidchisnall / dtc

FreeBSD Device Tree Compiler
18 stars 17 forks source link

error: 'auto' not allowed in lambda parameter #74

Closed jlduran closed 1 year ago

jlduran commented 1 year ago

Line: https://github.com/davidchisnall/dtc/blob/01c1ca8aa0209765237d7077be3b609b9a357502/fdt.cc#L1659 produces the following error when compiled on 14-CURRENT:

error: 'auto' not allowed in lambda parameter
                        auto expect = [&](auto token, const char *msg)
                                          ^~~~
1 error generated.
*** Error code 1

Stop.

Maybe, in the meantime, change it to int or change the Makefile to CXXSTD= c++14?

davidchisnall commented 1 year ago

Huh, what compiler doesn't default to at least C++14 in 2022? Clang 6.0 defaults to C++14, and it was released in 2018. Is there something in the base system explicitly requesting a lower default?

jlduran commented 1 year ago

Maybe: https://github.com/davidchisnall/dtc/blob/01c1ca8aa0209765237d7077be3b609b9a357502/Makefile#L11

If I change it explicitly to c++14. The build succeeds:

https://github.com/jlduran/freebsd-src/commit/b93bc34015d437a65bf2a8a3743336f4b5dfd263

EDIT: Reference https://github.com/freebsd/freebsd-src/commit/e713ba26f25f5a32785efb3806dc64175107dcea

jlduran commented 1 year ago

By the way, this is after importing 0206c0f266e8559bc1e3f0cbb8f5c094c43ec52d into base.

(I hit #64 trying to get past https://github.com/jlduran/RunningGUIFreeBSDInAVirtualMachineOnAMac/issues/1)

emaste commented 1 year ago

EDIT: Reference https://github.com/freebsd/freebsd-src/commit/e713ba26f25f5a32785efb3806dc64175107dcea

I presume this was added before Clang bumped the default to c++11 and ought to just be removed now.