Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yurivict opened this issue Jul 1, 2023 · 7 comments
Closed

Comments

@yurivict
Copy link

yurivict commented Jul 1, 2023

/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

@infdahai
Copy link

infdahai commented Jul 1, 2023

It seems the usage is allowed in cpp20.

@mayinghan
Copy link

any update on this?

@Orvid
Copy link
Contributor

Orvid commented Jul 10, 2023

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.

@Leumim2020
Copy link

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

@yurivict
Copy link
Author

Clang always prints an error in this case.

@Leumim2020
Copy link

Clang always prints an error in this case.

Oh😮 this is intersting!?

Orvid added a commit to Orvid/folly that referenced this issue Jul 13, 2023
Summary:
We're not yet to the point where we can blindly use C++20 features unguarded yet, so switch this to a normal template parameter
Fixes: facebook#2032

Reviewed By: DenisYaroshevskiy

Differential Revision: D47345349

fbshipit-source-id: 9aff6e757f78b8b549bc4ee5b9e87be43499629a
@Orvid
Copy link
Contributor

Orvid commented Jul 13, 2023

#2039 should fix this when it lands.

facebook-github-bot pushed a commit to facebook/hhvm that referenced this issue Jul 31, 2023
Summary:
X-link: facebook/folly#2039

We're not yet to the point where we can blindly use C++20 features unguarded yet, so switch this to a normal template parameter
Fixes: facebook/folly#2032

Reviewed By: DenisYaroshevskiy

Differential Revision: D47345349

fbshipit-source-id: 2b80f439edcee020aaefed30022a8057327c17f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants