Skip to content

Error: unknown type name 'FMT_NO_UNIQUE_ADDRESS' #3492

Closed
@KellanClark

Description

@KellanClark

I noticed recently that fmt was causing errors and preventing my project from compiling. The stream of errors is very long, but they all stem from

[build] In file included from C:/Users/Kellan/CLionProjects/ortin/modules/fmt/src/os.cc:13:
[build] In file included from C:/Users/Kellan/CLionProjects/ortin/modules/fmt/include\fmt/os.h:20:
[build] C:/Users/Kellan/CLionProjects/ortin/modules/fmt/include\fmt/format.h:935:3: error: unknown type name 'FMT_NO_UNIQUE_ADDRESS'
[build]   FMT_NO_UNIQUE_ADDRESS Allocator alloc_;
[build]   ^
[build] C:/Users/Kellan/CLionProjects/ortin/modules/fmt/include\fmt/format.h:935:25: warning: declaration of 'Allocator' shadows template parameter [-Wmicrosoft-template-shadow]
[build]   FMT_NO_UNIQUE_ADDRESS Allocator alloc_;
[build]                         ^
[build] C:/Users/Kellan/CLionProjects/ortin/modules/fmt/include\fmt/format.h:929:20: note: template parameter is declared here
[build]           typename Allocator = std::allocator<T>>
[build]                    ^

I bisected and found #3485 was the culprit. There's a couple confusing things about this error.

  1. FMT_NO_UNIQUE_ADDRESS should be defined. It's further up in the file and my IDE shows it should expand to [[no_unique_address]] in my environment. For some reason, it's not getting replaced by the preprocessor.
  2. I can't replicate this in Godbolt. It may be that I'm using the GNU command line version of Clang 15.0.1 installed by Visual Studio (not clang-cl, the clang.exe installed with it), which isn't an option.

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