folly icon indicating copy to clipboard operation
folly copied to clipboard

Tests fail to compile: error: 'auto' not allowed in function prototype

Open yurivict opened this issue 1 year ago • 6 comments

/usr/ports/devel/folly/work/folly-2023.06.26.00/folly/detail/test/SimdForEachTest.cpp:32:45: error: 'auto' not allowed in function prototype
  bool step(char* s, ignore_extrema ignore, auto unroll_i) const { 
                                            ^~~~
/usr/ports/devel/folly/work/folly-2023.06.26.00/folly/detail/test/SimdForEachTest.cpp:53:35: error: 'auto' not allowed in function prototype
  bool step(char* s, ignore_none, auto unroll_i) const {
                                  ^~~~
In file included from /usr/ports/devel/folly/work/folly-2023.06.26.00/folly/detail/test/SimdForEachTest.cpp:17:
/usr/ports/devel/folly/work/folly-2023.06.26.00/folly/detail/SimdForEach.h:209:18: error: no member named 'step' in 'folly::simd_detail::TestDelegate<true>'
    if (delegate.step(af, ignore, detail::UnrollStep<0>{})) {
        ~~~~~~~~ ^
/usr/ports/devel/folly/work/folly-2023.06.26.00/folly/detail/test/SimdForEachTest.cpp:84:3: note: in instantiation of function template specialization 'folly::simd_detail::simdForEachAligning<2, char, folly::simd_detail::TestDelegate<true>>' requested here
  simdForEachAligning<unroll>(
  ^
/usr/ports/devel/folly/work/folly-2023.06.26.00/folly/detail/test/SimdForEachTest.cpp:91:19: note: in instantiation of function template specialization 'folly::simd_detail::run<2, true>' requested here
  EXPECT_EQ(res, (run<2, /*kSameUnrollValue*/ true>(offset, len, stopAt)));
                  ^
In file included from /usr/ports/devel/folly/work/folly-2023.06.26.00/folly/detail/test/SimdForEachTest.cpp:17:
/usr/ports/devel/folly/work/folly-2023.06.26.00/folly/detail/SimdForEach.h:227:12: error: no member named 'step' in 'folly::simd_detail::TestDelegate<true>'
  delegate.step(af, ignore, detail::UnrollStep<0>{});
  ~~~~~~~~ ^
/usr/ports/devel/folly/work/folly-2023.06.26.00/folly/detail/SimdForEach.h:137:30: error: no member named 'step' in 'folly::simd_detail::TestDelegate<true>'
      shouldBreak = delegate.step(f, ignore_none{}, unrollI);
                    ~~~~~~~~ ^

Version: 2023.06.26.00 clang-15 FreeBSD 13.2

yurivict avatar Jul 01 '23 01:07 yurivict

It seems the usage is allowed in cpp20.

infdahai avatar Jul 01 '23 05:07 infdahai

any update on this?

mayinghan avatar Jul 06 '23 21:07 mayinghan

I've put up a change internally to change this to:

template <typename Func>
bool step(char* s, ignore_extrema ignore, Func unroll_i) const {

Which should resolve the issue by supporting compiling against things before C++20. I hope to land it soon.

Orvid avatar Jul 10 '23 20:07 Orvid

in c++ versions 14,17 and 20 on gcc v9 you can use the auto type for function prototypes. But you will have the warning : \main.cpp [Warning] use of 'auto' in parameter declaration only available with '-fconcepts' this warning can also be suppressed by the -w parameter

Leumim2020 avatar Jul 12 '23 23:07 Leumim2020

Clang always prints an error in this case.

yurivict avatar Jul 13 '23 02:07 yurivict

Clang always prints an error in this case.

Oh😮 this is intersting!?

Leumim2020 avatar Jul 13 '23 07:07 Leumim2020

https://github.com/facebook/folly/pull/2039 should fix this when it lands.

Orvid avatar Jul 13 '23 18:07 Orvid