Skip to content

Compilation issue with G++ 12 to 14 #711

@mikael-s

Description

@mikael-s

Hello,

I've downloaded the amalgamated files with:

wget https://github.com/RoaringBitmap/CRoaring/releases/download/v4.3.3/roaring.{h,hh,c}

I created the demo.cpp by copying-pasting the example in the README.

Then I've attempted to compile the demo.cpp file with g++ -std=c++11 -o demopp demo.cpp and the compilation fails with:

In file included from demo.cpp:3:
roaring.c:11436:15: error: expected constructor, destructor, or type conversion before ‘(’ token
11436 | _Static_assert(alignof(art_leaf_t) == alignof(art_node4_t),
      |               ^
roaring.c:11438:15: error: expected constructor, destructor, or type conversion before ‘(’ token
11438 | _Static_assert(alignof(art_leaf_t) == alignof(art_node16_t),
      |               ^
roaring.c:11440:15: error: expected constructor, destructor, or type conversion before ‘(’ token
11440 | _Static_assert(alignof(art_leaf_t) == alignof(art_node48_t),
      |               ^
roaring.c:11442:15: error: expected constructor, destructor, or type conversion before ‘(’ token
11442 | _Static_assert(alignof(art_leaf_t) == alignof(art_node256_t),
      |               ^
roaring.c: In function ‘size_t roaring::internal::art_frozen_view(const char*, size_t, art_t*)’:
roaring.c:11515:5: error: ‘_Static_assert’ was not declared in this scope; did you mean ‘static_assert’?
11515 |     _Static_assert(sizeof(art->first_free) == sizeof(art->capacities),
      |     ^~~~~~~~~~~~~~
      |     static_assert
roaring.c: In function ‘void roaring::api::extend_containers(roaring64_bitmap_t*)’:
roaring.c:24537:24: error: invalid conversion from ‘void*’ to ‘roaring::internal::container_t**’ {aka ‘roaring::api::container_s**’} [-fpermissive]
24537 |         roaring_realloc(r->containers, new_capacity * sizeof(container_t *));
      |         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                        |
      |                        void*
roaring.c: In function ‘size_t roaring::api::roaring64_bitmap_shrink_to_fit(roaring64_bitmap_t*)’:
roaring.c:25394:40: error: invalid conversion from ‘void*’ to ‘roaring::internal::container_t**’ {aka ‘roaring::api::container_s**’} [-fpermissive]
25394 |         r->containers = roaring_realloc(r->containers,
      |                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      |                                        |
      |                                        void*
25395 |                                         new_capacity * sizeof(container_t *));
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
roaring.c: In function ‘roaring::api::roaring64_bitmap_t* roaring::api::roaring64_bitmap_frozen_view(const char*, size_t)’:
roaring.c:26861:9: error: cannot convert ‘roaring::internal::container_t*’ {aka ‘roaring::api::container_s*’} to ‘roaring::internal::container_t**’ {aka ‘roaring::api::container_s**’} in assignment
26861 |         (container_t *)roaring_malloc(r->capacity * sizeof(container_t *));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         |
      |         roaring::internal::container_t* {aka roaring::api::container_s*}

My default g++ version is 14.2.0. I've also tested with g++ 12 and g++ 13 and the compilation still fails with the same errors.

Are the amalgamated files still usable?

Thanks!

Metadata

Metadata

Assignees

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