Skip to content

Won't compile with gcc 15.2 #2

@vldevel

Description

@vldevel

I cannot compile this with gcc 15.2 or clang 21.1.1.

With clang (which outputs more explicit error messages), I get:

~/poc/include/hammer/pattern.hpp:79:10: error: no member named 'rotate' in namespace 'std'
   79 |     std::rotate(dst.begin(), dst.end() - shift, dst.end());
      |          ^~~~~~
~/poc/src/pattern.cpp:17:10: error: no member named 'sort' in namespace 'std'; did you mean 'qsort'?
   17 |     std::sort(flat.begin(), flat.end(), cmp);
      |          ^~~~
      |          qsort
/usr/bin/../lib/gcc/x86_64-mandriva-linux/15/../../../../include/c++/15/cstdlib:167:11: note: 'qsort' declared here
  167 |   using ::qsort;
      |           ^
~/poc/src/pattern.cpp:17:44: error: too few arguments to function call, expected 4, have 3
   17 |     std::sort(flat.begin(), flat.end(), cmp);
      |     ~~~~~~~~~                              ^
/usr/include/stdlib.h:970:13: note: 'qsort' declared here
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |             ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~~~~~~~~~
~/poc/src/pattern.cpp:112:17: error: implicit instantiation of undefined template 'std::array, 4>'
  112 |     burst_array template_bursts;
      |                 ^
/usr/bin/../lib/gcc/x86_64-mandriva-linux/15/../../../../include/c++/15/bits/stl_pair.h:99:12: note: template is declared here
   99 |     struct array;
      |            ^
~/poc/src/pattern.cpp:169:17: error: implicit instantiation of undefined template 'std::array, 5>'
  169 |     burst_array template_bursts;
      |                 ^
/usr/bin/../lib/gcc/x86_64-mandriva-linux/15/../../../../include/c++/15/bits/stl_pair.h:99:12: note: template is declared here
   99 |     struct array;
      |            ^
5 errors generated.

To resolve this you need to add #include <algorithm> and #include <array> to include/hammer/pattern.hpp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions