Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Unable to build shared libraries with Clang for Windows #291

Copy link
Copy link
@HC-pel

Description

@HC-pel
Issue body actions

Clang appears to be pickier than MSVC about where attribute lists are allowed to appear, leading to errors such as the following:

[...]\include\graphqlservice/GraphQLParse.h(43,21): error: 'nodiscard' attribute cannot be applied to types
GRAPHQLPEG_EXPORT [[nodiscard]] ast parseSchemaFile(
                    ^
[...]\include/graphqlservice/GraphQLService.h(170,24): error: an attribute list cannot appear here
        GRAPHQLSERVICE_EXPORT [[nodiscard]] bool await_ready() const;
                              ^~~~~~~~~~~~~

Moving the [[nodiscard]] before the export macro will fix both types of errors. I'm not sure who exactly is to blame for this, as __declspec is of course a Microsoft extension and Clang tries to maintain compatibility with MSVC, but it would be nice to be able to build with both compilers.

I've written a minimal example here: https://godbolt.org/z/5WfvP4Gea

Reactions are currently unavailable

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.