ut icon indicating copy to clipboard operation
ut copied to clipboard

The 'struct override{}' causes compilation failure

Open bjadamson opened this issue 2 years ago • 1 comments

Hello, this line is causing my compilation to fail to compile.

It happens when my test includes libfmt:

home/badamson/projects/rrogue/source/external/fmt/include/fmt/format.h:328:33: error: two or more data types in declaration of ‘type name’
  328 |   auto overflow(int_type ch) -> int_type override {
      |                                 ^~~~~~~~
/home/badamson/projects/rrogue/source/external/fmt/include/fmt/format.h:334:56: error: two or more data types in declaration of ‘type name’
  334 |   auto xsputn(const char_type* s, streamsize count) -> streamsize override {

The output is misleading, the cause over the error is because inside ut.hpp there is a 'struct override'. I don't know if this is a bug in gcc (it only happens when I build in release mode) but would you consider a different name than override for the struct here?

bjadamson avatar Jul 17 '23 03:07 bjadamson

I forgot to add, changing the name of the struct to anything else fixes the issue.

bjadamson avatar Jul 17 '23 03:07 bjadamson